diff --git a/demux/demux.c b/demux/demux.c index 11b89a7b37..e09a4e843c 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1245,6 +1245,7 @@ void demuxer_feed_caption(struct sh_stream *stream, demux_packet_t *dp) dp->keyframe = true; dp->pts = MP_ADD_PTS(dp->pts, -in->ts_offset); dp->dts = MP_ADD_PTS(dp->dts, -in->ts_offset); + dp->stream = sh->index; add_packet_locked(sh, dp); pthread_mutex_unlock(&in->lock); } @@ -1892,6 +1893,10 @@ static void add_packet_locked(struct sh_stream *stream, demux_packet_t *dp) talloc_free(dp); return; } + + assert(dp->stream == stream->index); + assert(!dp->next); + struct demux_internal *in = ds->in; in->after_seek = false; @@ -1945,9 +1950,6 @@ static void add_packet_locked(struct sh_stream *stream, demux_packet_t *dp) ds->global_correct_pos &= queue->correct_pos; ds->global_correct_dts &= queue->correct_dts; - dp->stream = stream->index; - dp->next = NULL; - // (keep in mind that even if the reader went out of data, the queue is not // necessarily empty due to the backbuffer) if (!ds->reader_head && (!ds->skip_to_keyframe || dp->keyframe)) {