summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-09 22:32:04 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-03-11 12:49:40 +0900
commit9e99a0c8b95980fc5ff7879c6a1b7e6de479b7dc (patch)
treecf13ffd2391a032d624112de07c58e880191276b
parente22ecb1585732fe7f950b72ed7021590597461ad (diff)
downloadmpv-9e99a0c8b95980fc5ff7879c6a1b7e6de479b7dc.tar.bz2
mpv-9e99a0c8b95980fc5ff7879c6a1b7e6de479b7dc.tar.xz
demux_mkv: check for playback aborts
Check async abort notification. libavformat already do something equivalent. Before this commit, the demuxer could enter resync mode (and print silly warning messages) when the stream stopped returning data because of an abort. (cherry picked from commit 39fa05d3742aea94c7638c5b9223d680459b7799)
-rw-r--r--demux/demux.c5
-rw-r--r--demux/demux.h2
-rw-r--r--demux/demux_mkv.c2
3 files changed, 9 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 06511aaa50..930d19f9cd 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1378,6 +1378,11 @@ void demux_unpause(demuxer_t *demuxer)
pthread_mutex_unlock(&in->lock);
}
+bool demux_cancel_test(struct demuxer *demuxer)
+{
+ return mp_cancel_test(demuxer->stream->cancel);
+}
+
struct demux_chapter *demux_copy_chapter_data(struct demux_chapter *c, int num)
{
struct demux_chapter *new = talloc_array(NULL, struct demux_chapter, num);
diff --git a/demux/demux.h b/demux/demux.h
index b2bedf0a23..0078ca8a7b 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -251,6 +251,8 @@ void demux_start_thread(struct demuxer *demuxer);
void demux_stop_thread(struct demuxer *demuxer);
void demux_set_wakeup_cb(struct demuxer *demuxer, void (*cb)(void *ctx), void *ctx);
+bool demux_cancel_test(struct demuxer *demuxer);
+
void demux_flush(struct demuxer *demuxer);
int demux_seek(struct demuxer *demuxer, double rel_seek_secs, int flags);
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 1a3f8f0a84..9cc521fab8 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -2522,6 +2522,8 @@ static int read_next_block(demuxer_t *demuxer, struct block_info *block)
break;
if (s->eof)
return -1;
+ if (demux_cancel_test(demuxer))
+ return -1;
if (id == EBML_ID_EBML && stream_tell(s) >= mkv_d->segment_end) {
// Appended segment - don't use its clusters, consider this EOF.
stream_seek(s, stream_tell(s) - 4);