diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-11-20 18:15:08 +0100 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-11-20 18:15:08 +0100 |
commit | 8700700de8a4103724796077034f7f254ad974bc (patch) | |
tree | 2fce4dee518a202c45c3f16567db36edc92ed914 /sub/dec_sub.c | |
parent | e6b85c91700bee0ddc92e98a30d5021691bd6f65 (diff) | |
parent | eafc273d2c2ae6d247d741202e58ca23dc938cb2 (diff) | |
download | mpv-8700700de8a4103724796077034f7f254ad974bc.tar.bz2 mpv-8700700de8a4103724796077034f7f254ad974bc.tar.xz |
Merge branch 'master' into release/current
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r-- | sub/dec_sub.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 39eb032982..b9f04b3123 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -198,6 +198,12 @@ void sub_preload(struct dec_sub *sub) pthread_mutex_unlock(&sub->lock); } +static bool is_new_segment(struct dec_sub *sub, struct demux_packet *p) +{ + return p->new_segment && + (p->start != sub->start || p->end != sub->end || p->codec != sub->codec); +} + // Read packets from the demuxer stream passed to sub_create(). Return true if // enough packets were read, false if the player should wait until the demuxer // signals new packets available (and then should retry). @@ -236,7 +242,7 @@ bool sub_read_packets(struct dec_sub *sub, double video_pts) sub->last_pkt_pts = pkt->pts; - if (pkt->new_segment) { + if (is_new_segment(sub, pkt)) { sub->new_segment = pkt; // Note that this can be delayed to a much later point in time. update_segment(sub); @@ -294,7 +300,6 @@ void sub_reset(struct dec_sub *sub) if (sub->sd->driver->reset) sub->sd->driver->reset(sub->sd); sub->last_pkt_pts = MP_NOPTS_VALUE; - sub->start = sub->end = MP_NOPTS_VALUE; sub->last_vo_pts = MP_NOPTS_VALUE; talloc_free(sub->new_segment); sub->new_segment = NULL; |