added h264 profile/compat/level parser and fixed dash avc1 codec string

This commit is contained in:
Roman Arutyunyan 2013-11-29 12:55:42 +04:00
parent d01ffc0c88
commit 047b72c192
3 changed files with 20 additions and 4 deletions

View file

@ -281,7 +281,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
" <Representation\n" \
" id=\"%V_H264\"\n" \
" mimeType=\"video/mp4\"\n" \
" codecs=\"avc1.42c028\"\n" \
" codecs=\"avc1.%02uxi%02uxi%02uxi\"\n" \
" width=\"%ui\"\n" \
" height=\"%ui\"\n" \
" frameRate=\"%ui\"\n" \
@ -387,6 +387,9 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
codec_ctx->height,
codec_ctx->frame_rate,
&ctx->name,
codec_ctx->avc_profile,
codec_ctx->avc_compat,
codec_ctx->avc_level,
codec_ctx->width,
codec_ctx->height,
codec_ctx->frame_rate,

View file

@ -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,
"codec: AAC header arrived, sample_rate=%ui",
"codec: aac header arrived, sample_rate=%ui",
ctx->aac_sample_rate);
}
} else {
if (ctx->video_codec_id == NGX_RTMP_VIDEO_H264) {
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);
}
}

View file

@ -59,6 +59,9 @@ typedef struct {
ngx_uint_t audio_data_rate;
ngx_uint_t audio_codec_id;
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_size; /* 1=8bit, 2=16bit */
ngx_uint_t audio_channels; /* 1, 2 */