added presentation delay to dash fragments + Repr. IDs

This commit is contained in:
René Calles 2013-11-27 17:04:09 +00:00
parent ba94a0c1e4
commit ed68e4a2eb

View file

@ -263,6 +263,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
#define NGX_RTMP_DASH_MANIFEST_VIDEO \
" <AdaptationSet\n" \
" id=\"1\"\n" \
" segmentAlignment=\"true\"\n" \
" maxWidth=\"%ui\"\n" \
" maxHeight=\"%ui\"\n" \
@ -298,6 +299,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
#define NGX_RTMP_DASH_MANIFEST_AUDIO \
" <AdaptationSet\n" \
" id=\"2\"\n" \
" segmentAlignment=\"true\">\n" \
" <AudioChannelConfiguration\n" \
" schemeIdUri=\"urn:mpeg:dash:" \
@ -908,7 +910,7 @@ ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
static ngx_int_t
ngx_rtmp_dash_append(ngx_rtmp_session_t *s, ngx_chain_t *in,
ngx_rtmp_dash_track_t *t, ngx_int_t key, uint32_t timestamp)
ngx_rtmp_dash_track_t *t, ngx_int_t key, uint32_t timestamp, uint32_t delay)
{
u_char *p;
size_t size, bsize;
@ -1008,7 +1010,7 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
in->buf->pos += 2;
return ngx_rtmp_dash_append(s, in, &ctx->audio, 0, h->timestamp);
return ngx_rtmp_dash_append(s, in, &ctx->audio, 0, h->timestamp, 0);
}
@ -1016,7 +1018,9 @@ static ngx_int_t
ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
u_char *p;
uint8_t ftype, htype;
uint32_t delay;
ngx_rtmp_dash_ctx_t *ctx;
ngx_rtmp_codec_ctx_t *codec_ctx;
ngx_rtmp_dash_app_conf_t *dacf;
@ -1049,6 +1053,14 @@ ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
if (htype != 1) {
return NGX_OK;
}
p = (u_char *) &delay;
p[0] = in->buf->pos[4];
p[1] = in->buf->pos[3];
p[2] = in->buf->pos[2];
p[3] = 0;
ctx->has_video = 1;
@ -1056,7 +1068,8 @@ ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
in->buf->pos += 5;
return ngx_rtmp_dash_append(s, in, &ctx->video, ftype == 1, h->timestamp);
return ngx_rtmp_dash_append(s, in, &ctx->video, ftype == 1, h->timestamp,
delay);
}