mirror of https://github.com/mpv-player/mpv
demux: acquire lock before calling update_bytes_read
in->byte_level_seeks field is written and modified inside update_bytes_read at the same time when demux_get_reader_state is executing, which locks the demux thread mutex. This results in a data race, reported by Thread Sanitizer when playing mp3 file of sufficient long length.
This commit is contained in:
parent
be81470f54
commit
8ace8e8790
|
@ -4137,10 +4137,10 @@ static void update_cache(struct demux_internal *in)
|
||||||
stream_control(stream, STREAM_CTRL_GET_METADATA, &stream_metadata);
|
stream_control(stream, STREAM_CTRL_GET_METADATA, &stream_metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_bytes_read(in);
|
|
||||||
|
|
||||||
pthread_mutex_lock(&in->lock);
|
pthread_mutex_lock(&in->lock);
|
||||||
|
|
||||||
|
update_bytes_read(in);
|
||||||
|
|
||||||
if (do_update)
|
if (do_update)
|
||||||
in->stream_size = stream_size;
|
in->stream_size = stream_size;
|
||||||
if (stream_metadata) {
|
if (stream_metadata) {
|
||||||
|
|
Loading…
Reference in New Issue