mirror of https://github.com/mpv-player/mpv
command, demux: make drop-buffers reset state even harder
Leave nothing left when it's executed.
This commit is contained in:
parent
602384348e
commit
9806e9f82b
|
@ -3487,12 +3487,19 @@ void demux_flush(demuxer_t *demuxer)
|
||||||
struct demux_internal *in = demuxer->in;
|
struct demux_internal *in = demuxer->in;
|
||||||
assert(demuxer == in->d_user);
|
assert(demuxer == in->d_user);
|
||||||
|
|
||||||
pthread_mutex_lock(&demuxer->in->lock);
|
pthread_mutex_lock(&in->lock);
|
||||||
clear_reader_state(in, true);
|
clear_reader_state(in, true);
|
||||||
for (int n = 0; n < in->num_ranges; n++)
|
for (int n = 0; n < in->num_ranges; n++)
|
||||||
clear_cached_range(in, in->ranges[n]);
|
clear_cached_range(in, in->ranges[n]);
|
||||||
free_empty_cached_ranges(in);
|
free_empty_cached_ranges(in);
|
||||||
pthread_mutex_unlock(&demuxer->in->lock);
|
for (int n = 0; n < in->num_streams; n++) {
|
||||||
|
struct demux_stream *ds = in->streams[n]->ds;
|
||||||
|
ds->refreshing = false;
|
||||||
|
ds->eof = false;
|
||||||
|
}
|
||||||
|
in->eof = false;
|
||||||
|
in->seeking = false;
|
||||||
|
pthread_mutex_unlock(&in->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does some (but not all) things for switching to another range.
|
// Does some (but not all) things for switching to another range.
|
||||||
|
|
|
@ -5561,8 +5561,7 @@ static void cmd_drop_buffers(void *p)
|
||||||
struct mp_cmd_ctx *cmd = p;
|
struct mp_cmd_ctx *cmd = p;
|
||||||
struct MPContext *mpctx = cmd->mpctx;
|
struct MPContext *mpctx = cmd->mpctx;
|
||||||
|
|
||||||
reset_audio_state(mpctx);
|
reset_playback_state(mpctx);
|
||||||
reset_video_state(mpctx);
|
|
||||||
|
|
||||||
if (mpctx->demuxer)
|
if (mpctx->demuxer)
|
||||||
demux_flush(mpctx->demuxer);
|
demux_flush(mpctx->demuxer);
|
||||||
|
|
Loading…
Reference in New Issue