From 1301a907617459237fb0071b4640ad53d0ae491f Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 16 Jul 2014 22:40:21 +0200 Subject: demux: add a demuxer thread This adds a thread to the demuxer which reads packets asynchronously. It will do so until a configurable minimum packet queue size is reached. (See options.rst additions.) For now, the thread is disabled by default. There are some corner cases that have to be fixed, such as fixing cache behavior with webradios. Note that most interaction with the demuxer is still blocking, so if e.g. network dies, the player will still freeze. But this change will make it possible to remove most causes for freezing. Most of the new code in demux.c actually consists of weird caches to compensate for thread-safety issues (with the previously single-threaded design), or to avoid blocking by having to wait on the demuxer thread. Most of the changes in the player are due to the fact that we must not access the source stream directly. the demuxer thread already accesses it, and the stream stuff is not thread-safe. For timeline stuff (like ordered chapters), we enable the thread for the current segment only. We also clear its packet queue on seek, so that the remaining (unconsumed) readahead buffer doesn't waste memory. Keep in mind that insane subtitles (such as ASS typesetting muxed into mkv files) will practically disable the readahead, because the total queue size is considered when checking whether the minimum queue size was reached. --- demux/stheader.h | 1 - 1 file changed, 1 deletion(-) (limited to 'demux/stheader.h') diff --git a/demux/stheader.h b/demux/stheader.h index 1771f75ff5..082fffa5e2 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -31,7 +31,6 @@ struct demuxer; struct sh_stream { enum stream_type type; - struct demuxer *demuxer; // Index into demuxer->streams. int index; // Demuxer/format specific ID. Corresponds to the stream IDs as encoded in -- cgit v1.2.3