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.
This commit is contained in:
wm4 2019-06-13 20:49:37 +02:00
parent e320f02187
commit 021ccb9644
1 changed files with 5 additions and 3 deletions

View File

@ -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)) {