Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
100c97be by Martin Finkel at 2021-09-11T08:14:45+00:00
libvlc: warn and assert against selecting media tracks retrieved from the media

- - - - -


2 changed files:

- include/vlc/libvlc_media_player.h
- lib/media_player.c


Changes:

=====================================
include/vlc/libvlc_media_player.h
=====================================
@@ -1374,6 +1374,8 @@ libvlc_media_player_get_track_from_id( 
libvlc_media_player_t *p_mi,
  *
  * \note Use libvlc_media_player_select_tracks() for multiple selection
  *
+ * \warning Only use a \ref libvlc_media_track_t retrieved with \ref 
libvlc_media_player_get_tracklist
+ *
  * \param p_mi the media player
  * \param track track to select, can't be NULL
  */
@@ -1405,6 +1407,8 @@ libvlc_media_player_unselect_track_type( 
libvlc_media_player_t *p_mi,
  *
  * \note selecting multiple audio tracks is currently not supported.
  *
+ * \warning Only use a \ref libvlc_media_track_t retrieved with \ref 
libvlc_media_player_get_tracklist
+ *
  * \param p_mi the media player
  * \param type type of the selected track
  * \param tracks pointer to the track array, or NULL if track_count is 0
@@ -1442,6 +1446,8 @@ libvlc_media_player_select_tracks( libvlc_media_player_t 
*p_mi,
  *
  * \note selecting multiple audio tracks is currently not supported.
  *
+ * \warning Only use a \ref libvlc_media_track_t id retrieved with \ref 
libvlc_media_player_get_tracklist
+ *
  * \param p_mi the media player
  * \param type type to select
  * \param psz_ids list of string identifier or NULL


=====================================
lib/media_player.c
=====================================
@@ -1857,6 +1857,10 @@ libvlc_media_player_select_track(libvlc_media_player_t 
*p_mi,
 
     const libvlc_media_trackpriv_t *trackpriv =
         libvlc_media_track_to_priv(track);
+    
+    // It must be a player track
+    assert(trackpriv->es_id);
+
     vlc_player_SelectEsId(player, trackpriv->es_id,
                           VLC_PLAYER_SELECT_EXCLUSIVE);
 
@@ -1899,6 +1903,9 @@ libvlc_media_player_select_tracks(libvlc_media_player_t 
*p_mi,
         const libvlc_media_trackpriv_t *trackpriv =
             libvlc_media_track_to_priv(track);
 
+        // It must be a player track
+        assert(trackpriv->es_id);
+
         es_id_list[es_id_idx++] = trackpriv->es_id;
     }
     es_id_list[es_id_idx++] = NULL;



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/100c97be1e82b749f6d3f165c89e7628272fbe18

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/100c97be1e82b749f6d3f165c89e7628272fbe18
You're receiving this email because of your account on code.videolan.org.


_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to