mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-20 18:01:08 +02:00
added h264 profile/compat/level parser and fixed dash avc1 codec string
This commit is contained in:
parent
d01ffc0c88
commit
047b72c192
|
@ -281,7 +281,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
||||||
" <Representation\n" \
|
" <Representation\n" \
|
||||||
" id=\"%V_H264\"\n" \
|
" id=\"%V_H264\"\n" \
|
||||||
" mimeType=\"video/mp4\"\n" \
|
" mimeType=\"video/mp4\"\n" \
|
||||||
" codecs=\"avc1.42c028\"\n" \
|
" codecs=\"avc1.%02uxi%02uxi%02uxi\"\n" \
|
||||||
" width=\"%ui\"\n" \
|
" width=\"%ui\"\n" \
|
||||||
" height=\"%ui\"\n" \
|
" height=\"%ui\"\n" \
|
||||||
" frameRate=\"%ui\"\n" \
|
" frameRate=\"%ui\"\n" \
|
||||||
|
@ -387,6 +387,9 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
||||||
codec_ctx->height,
|
codec_ctx->height,
|
||||||
codec_ctx->frame_rate,
|
codec_ctx->frame_rate,
|
||||||
&ctx->name,
|
&ctx->name,
|
||||||
|
codec_ctx->avc_profile,
|
||||||
|
codec_ctx->avc_compat,
|
||||||
|
codec_ctx->avc_level,
|
||||||
codec_ctx->width,
|
codec_ctx->width,
|
||||||
codec_ctx->height,
|
codec_ctx->height,
|
||||||
codec_ctx->frame_rate,
|
codec_ctx->frame_rate,
|
||||||
|
|
|
@ -290,14 +290,24 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"codec: AAC header arrived, sample_rate=%ui",
|
"codec: aac header arrived, sample_rate=%ui",
|
||||||
ctx->aac_sample_rate);
|
ctx->aac_sample_rate);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ctx->video_codec_id == NGX_RTMP_VIDEO_H264) {
|
if (ctx->video_codec_id == NGX_RTMP_VIDEO_H264) {
|
||||||
header = &ctx->avc_header;
|
header = &ctx->avc_header;
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
|
||||||
"codec: AVC/H264 header arrived");
|
if (in->buf->last - in->buf->pos > 8) {
|
||||||
|
p = in->buf->pos;
|
||||||
|
ctx->avc_profile = p[6];
|
||||||
|
ctx->avc_compat = p[7];
|
||||||
|
ctx->avc_level = p[8];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
|
"codec: avc header arrived, "
|
||||||
|
"profile=%ui, compat=%ui, level=%ui",
|
||||||
|
ctx->avc_profile, ctx->avc_compat, ctx->avc_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,9 @@ typedef struct {
|
||||||
ngx_uint_t audio_data_rate;
|
ngx_uint_t audio_data_rate;
|
||||||
ngx_uint_t audio_codec_id;
|
ngx_uint_t audio_codec_id;
|
||||||
ngx_uint_t aac_sample_rate;
|
ngx_uint_t aac_sample_rate;
|
||||||
|
ngx_uint_t avc_profile;
|
||||||
|
ngx_uint_t avc_compat;
|
||||||
|
ngx_uint_t avc_level;
|
||||||
ngx_uint_t sample_rate; /* 5512, 11025, 22050, 44100 */
|
ngx_uint_t sample_rate; /* 5512, 11025, 22050, 44100 */
|
||||||
ngx_uint_t sample_size; /* 1=8bit, 2=16bit */
|
ngx_uint_t sample_size; /* 1=8bit, 2=16bit */
|
||||||
ngx_uint_t audio_channels; /* 1, 2 */
|
ngx_uint_t audio_channels; /* 1, 2 */
|
||||||
|
|
Loading…
Reference in a new issue