mirror of https://github.com/mpv-player/mpv
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:
parent
e320f02187
commit
021ccb9644
|
@ -1245,6 +1245,7 @@ void demuxer_feed_caption(struct sh_stream *stream, demux_packet_t *dp)
|
||||||
dp->keyframe = true;
|
dp->keyframe = true;
|
||||||
dp->pts = MP_ADD_PTS(dp->pts, -in->ts_offset);
|
dp->pts = MP_ADD_PTS(dp->pts, -in->ts_offset);
|
||||||
dp->dts = MP_ADD_PTS(dp->dts, -in->ts_offset);
|
dp->dts = MP_ADD_PTS(dp->dts, -in->ts_offset);
|
||||||
|
dp->stream = sh->index;
|
||||||
add_packet_locked(sh, dp);
|
add_packet_locked(sh, dp);
|
||||||
pthread_mutex_unlock(&in->lock);
|
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);
|
talloc_free(dp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(dp->stream == stream->index);
|
||||||
|
assert(!dp->next);
|
||||||
|
|
||||||
struct demux_internal *in = ds->in;
|
struct demux_internal *in = ds->in;
|
||||||
|
|
||||||
in->after_seek = false;
|
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_pos &= queue->correct_pos;
|
||||||
ds->global_correct_dts &= queue->correct_dts;
|
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
|
// (keep in mind that even if the reader went out of data, the queue is not
|
||||||
// necessarily empty due to the backbuffer)
|
// necessarily empty due to the backbuffer)
|
||||||
if (!ds->reader_head && (!ds->skip_to_keyframe || dp->keyframe)) {
|
if (!ds->reader_head && (!ds->skip_to_keyframe || dp->keyframe)) {
|
||||||
|
|
Loading…
Reference in New Issue