[vlc-commits] demux: mkv: have mouse events registration non fatal

Francois Cartegnie git at videolan.org
Mon Sep 14 19:19:44 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 10 17:59:56 2020 +0200| [7766f8aa23945d22d08059ba7c0ea31667ac79c9] | committer: Francois Cartegnie

demux: mkv: have mouse events registration non fatal

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7766f8aa23945d22d08059ba7c0ea31667ac79c9
---

 modules/demux/mkv/events.cpp           | 7 ++++++-
 modules/demux/mkv/matroska_segment.cpp | 9 +++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/demux/mkv/events.cpp b/modules/demux/mkv/events.cpp
index 8526545f2c..cd7b57f1e9 100644
--- a/modules/demux/mkv/events.cpp
+++ b/modules/demux/mkv/events.cpp
@@ -48,6 +48,9 @@ void event_thread_t::SetPci(const pci_t *data)
 {
     vlc_mutex_locker l(&lock);
 
+    if(es_list.empty())
+        return;
+
     memcpy(&pci_packet, data, sizeof(pci_packet));
 
 #ifndef WORDS_BIGENDIAN
@@ -356,7 +359,9 @@ bool event_thread_t::AddES( es_out_id_t* es, int category )
 void event_thread_t::DelES( es_out_id_t* es )
 {
     vlc_mutex_locker lock_guard( &lock );
-    es_list.erase( std::find( es_list.begin(), es_list.end(), es ) );
+    es_list_t::iterator info = std::find( es_list.begin(), es_list.end(), es );
+    if( info != es_list.end() )
+        es_list.erase( info );
 }
 
 } // namespace
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 8fba12df9c..57cc84c816 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1123,13 +1123,10 @@ bool matroska_segment_c::ESCreate()
         {
             track.p_es = es_out_Add( sys.demuxer.out, &track.fmt );
 
-            if( track.p_es )
+            if( track.p_es &&
+                !sys.ev.AddES( track.p_es, track.fmt.i_cat ) )
             {
-                if (!sys.ev.AddES( track.p_es, track.fmt.i_cat ))
-                {
-                    es_out_Del( sys.demuxer.out, track.p_es );
-                    track.p_es = NULL;
-                }
+                msg_Warn( &sys.demuxer, "Could not register events, interactive menus will not work");
             }
         }
 



More information about the vlc-commits mailing list