Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
matroska muxer: update total duration using only audio/video tracks
  • Loading branch information
perexg committed Feb 2, 2015
1 parent 78b5fb6 commit 7a2560e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/muxer/tvh/mkmux.c
Expand Up @@ -51,6 +51,7 @@ typedef struct mk_track {
int avc;
int type;
int tracknum;
int tracktype;
int disabled;
int64_t nextpts;

Expand Down Expand Up @@ -334,6 +335,7 @@ mk_build_tracks(mk_mux_t *mkm, const streaming_start_t *ss)
}

tr->tracknum = ++tracknum;
tr->tracktype = tracktype;
mkm->has_video |= (tracktype == 1);

t = htsbuf_queue_alloc(0);
Expand Down Expand Up @@ -976,7 +978,7 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track_t *t, th_pkt_t *pkt)
nxt = ts_rescale(t->nextpts, 1000000000 / MATROSKA_TIMESCALE);
pts = ts_rescale(pts, 1000000000 / MATROSKA_TIMESCALE);

if(mkm->totduration < nxt)
if((t->tracktype == 1 || t->tracktype == 2) && mkm->totduration < nxt)
mkm->totduration = nxt;

delta = pts - mkm->cluster_tc;
Expand Down

0 comments on commit 7a2560e

Please sign in to comment.