From 021ccb96440e63a317d7a9737606a3eb720205d9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 13 Jun 2019 20:49:37 +0200 Subject: demux: turn some redundant assignments into asserts demux_packet.next should not be used outside of demux.c, and in this case it's a packet that was just passed to demux.c from the outside. demux_packet.stream is already set by the demuxer, and this is assured by the add_packet_locked() caller. --- demux/demux.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'demux/demux.c') 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)) { -- cgit v1.2.3