[vlc-devel] [PATCH 2/2] lib: send media_list end event after

Thomas Guillem thomas at gllm.fr
Mon Nov 9 15:13:06 CET 2020


That way, users receive the media end status before receiving the
media_list end event.
---
 lib/media.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/media.c b/lib/media.c
index 7881e18f2b..7ab98de7c1 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -357,21 +357,21 @@ static void send_parsed_changed( libvlc_media_t *p_md,
 
     vlc_mutex_unlock( &p_md->parsed_lock );
 
-        libvlc_media_list_t *p_subitems = media_get_subitems( p_md, false );
-        if( p_subitems != NULL )
-        {
-            /* notify the media list */
-            libvlc_media_list_lock( p_subitems );
-            libvlc_media_list_internal_end_reached( p_subitems );
-            libvlc_media_list_unlock( p_subitems );
-        }
-
     /* Construct the event */
     event.type = libvlc_MediaParsedChanged;
     event.u.media_parsed_changed.new_status = new_status;
 
     /* Send the event */
     libvlc_event_send( &p_md->event_manager, &event );
+
+    libvlc_media_list_t *p_subitems = media_get_subitems( p_md, false );
+    if( p_subitems != NULL )
+    {
+        /* notify the media list */
+        libvlc_media_list_lock( p_subitems );
+        libvlc_media_list_internal_end_reached( p_subitems );
+        libvlc_media_list_unlock( p_subitems );
+    }
 }
 
 /**
-- 
2.28.0



More information about the vlc-devel mailing list