[vlc-commits] demux: mkv: do not use the file if there's no usable stream/segment
Steve Lhomme
git at videolan.org
Wed Aug 14 18:13:21 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 24 12:01:20 2019 +0200| [dfa50b418711da81e941f059c4704c4a1a21ffab] | committer: Hugo Beauzée-Luyssen
demux: mkv: do not use the file if there's no usable stream/segment
Ref #22474
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dfa50b418711da81e941f059c4704c4a1a21ffab
---
modules/demux/mkv/demux.cpp | 4 +++-
modules/demux/mkv/demux.hpp | 2 +-
modules/demux/mkv/mkv.cpp | 6 +++++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index b2f6507668..6fde3aa8c3 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -259,7 +259,7 @@ bool demux_sys_t::PreloadLinked()
return true;
}
-void demux_sys_t::FreeUnused()
+bool demux_sys_t::FreeUnused()
{
auto sIt = std::remove_if(begin(streams), end(streams), [](const matroska_stream_c* p_s) {
return !p_s->isUsed();
@@ -275,6 +275,8 @@ void demux_sys_t::FreeUnused()
for (auto it = sgIt; it != end(opened_segments); ++it)
delete *it;
opened_segments.erase(sgIt, end(opened_segments));
+
+ return !streams.empty() && !opened_segments.empty();
}
bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, vlc_tick_t i_mk_date )
diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index 5004fc26f4..e684279071 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -99,7 +99,7 @@ public:
void PreloadFamily( const matroska_segment_c & of_segment );
bool PreloadLinked();
- void FreeUnused();
+ bool FreeUnused();
bool PreparePlayback( virtual_segment_c & new_vsegment, vlc_tick_t i_mk_date );
bool AnalyseAllSegmentsFound( demux_t *p_demux, matroska_stream_c * );
void JumpTo( virtual_segment_c & vsegment, virtual_chapter_c & vchapter );
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index c452d07668..1b055ce7f3 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -254,7 +254,11 @@ static int Open( vlc_object_t * p_this )
goto error;
}
- p_sys->FreeUnused();
+ if (!p_sys->FreeUnused())
+ {
+ msg_Err( p_demux, "no usable segment" );
+ goto error;
+ }
return VLC_SUCCESS;
More information about the vlc-commits
mailing list