1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 17:42:17 +00:00
mpv/input
wm4 f9ba1a3ddf demux: remove weird tripple-buffering for the sh_stream list
The demuxer infrastructure was originally single-threaded. To make it
suitable for multithreading (specifically, demuxing and decoding on
separate threads), some sort of tripple-buffering was introduced. There
are separate "struct demuxer" allocations. The demuxer thread sets the
state on d_thread. If anything changes, the state is copied to d_buffer
(the copy is protected by a lock), and the decoder thread is notified.
Then the decoder thread copies the state from d_buffer to d_user (again
while holding a lock). This avoids the need for locking in the
demuxer/decoder code itself (only demux.c needs an internal, "invisible"
lock.)

Remove the streams/num_streams fields from this tripple-buffering
schema. Move them to the internal struct, and protect them with the
internal lock. Use accessors for read access outside of demux.c.

Other than replacing all field accesses with accessors, this separates
allocating and adding sh_streams. This is needed to avoid race
conditions. Before this change, this was awkwardly handled by first
initializing the sh_stream, and then sending a stream change event. Now
the stream is allocated, then initialized, and then declared as
immutable and added (at which point it becomes visible to the decoder
thread immediately).

This change is useful for PR #2626. And eventually, we should probably
get entirely of the tripple buffering, and this makes a nice first step.
2015-12-23 21:52:16 +01:00
..
cmd_list.c command: make "add <property> 0" not change the value 2015-09-10 14:15:48 +02:00
cmd_list.h command: add a command for defining input bindings 2015-08-06 00:16:45 +02:00
cmd_parse.c input: add key name to script-binding command response 2015-12-23 19:10:48 +01:00
cmd_parse.h Update license headers 2015-04-13 12:10:01 +02:00
event.c player: rename and move find_subfiles.c 2015-09-20 18:05:06 +02:00
event.h input: add append argument to file drop event 2015-08-30 05:28:24 -07:00
input.c demux: remove weird tripple-buffering for the sh_stream list 2015-12-23 21:52:16 +01:00
input.h input: add key name to script-binding command response 2015-12-23 19:10:48 +01:00
ipc.c ipc: fix undefined behavior in some error cases 2015-07-06 00:08:29 +02:00
keycodes.c input: add a catch-all "unmapped" command 2015-12-23 19:13:45 +01:00
keycodes.h input: add a catch-all "unmapped" command 2015-12-23 19:13:45 +01:00
pipe-win32.c win32: input: use Vista CancelIoEx 2015-12-20 21:06:02 +11:00