From e320f02187a19e62b5bb48d4fd7cf5625dbee83c Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 13 Jun 2019 19:34:20 +0200 Subject: [PATCH] demux: move a function The new location makes equally much sense (or more, since it's close to its per-stream companion function), and we don't need a forward declaration. --- demux/demux.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index 5c7cfcbd55..11b89a7b37 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -416,8 +416,6 @@ static void add_packet_locked(struct sh_stream *stream, demux_packet_t *dp); static struct demux_packet *advance_reader_head(struct demux_stream *ds); static bool queue_seek(struct demux_internal *in, double seek_pts, int flags, bool clear_back_state); -static void clear_reader_state(struct demux_internal *in, - bool clear_back_state); static uint64_t get_foward_buffered_bytes(struct demux_stream *ds) { @@ -801,6 +799,18 @@ static void ds_clear_reader_state(struct demux_stream *ds, } } +// called locked, from user thread only +static void clear_reader_state(struct demux_internal *in, + bool clear_back_state) +{ + for (int n = 0; n < in->num_streams; n++) + ds_clear_reader_state(in->streams[n]->ds, clear_back_state); + in->warned_queue_overflow = false; + in->d_user->filepos = -1; // implicitly synchronized + in->blocked = false; + in->need_back_seek = false; +} + // Call if the observed reader state on this stream somehow changes. The wakeup // is skipped if the reader successfully read a packet, because that means we // expect it to come back and ask for more. @@ -3175,18 +3185,6 @@ struct demuxer *demux_open_url(const char *url, return d; } -// called locked, from user thread only -static void clear_reader_state(struct demux_internal *in, - bool clear_back_state) -{ - for (int n = 0; n < in->num_streams; n++) - ds_clear_reader_state(in->streams[n]->ds, clear_back_state); - in->warned_queue_overflow = false; - in->d_user->filepos = -1; // implicitly synchronized - in->blocked = false; - in->need_back_seek = false; -} - // clear the packet queues void demux_flush(demuxer_t *demuxer) {