From d444322f1fd8b1ed24cf8610b28cf5a31756885e Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Sat, 11 Nov 2017 19:55:19 +0800 Subject: [PATCH] demux: adaptive: fix setPosition If there is no valid streams, setPosition should not return true/success. This can happen when DEMUX_SET_TIME failed which lead to all streams disabled, and then try DEMUX_SET_POSITION. Signed-off-by: Francois Cartegnie --- modules/demux/adaptive/PlaylistManager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp index 95c817715e..700fa3a8d3 100644 --- a/modules/demux/adaptive/PlaylistManager.cpp +++ b/modules/demux/adaptive/PlaylistManager.cpp @@ -346,6 +346,7 @@ mtime_t PlaylistManager::getDuration() const bool PlaylistManager::setPosition(mtime_t time) { bool ret = true; + bool hasValidStream = false; for(int real = 0; real < 2; real++) { /* Always probe if we can seek first */ @@ -354,11 +355,19 @@ bool PlaylistManager::setPosition(mtime_t time) { AbstractStream *st = *it; if(!st->isDisabled()) + { + hasValidStream = true; ret &= st->setPosition(time, !real); + } } if(!ret) break; } + if(!hasValidStream) + { + msg_Warn(p_demux, "there is no valid streams"); + ret = false; + } return ret; } -- 2.11.4.GIT