[GStreamer] Crash when adding in-band text track with playbin3 enabled
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2018 08:54:42 +0000 (08:54 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2018 08:54:42 +0000 (08:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186654

Reviewed by Xabier Rodriguez-Calvar.

Text track indexes should be relative to the total amount of
in-band text tracks. The previous code would induce the creation
of in-band text tracks with indexes relative to the total amount
of all in-band (audio, video, text) tracks.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232925 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

index d7be2d4..f84388b 100644 (file)
@@ -1,3 +1,18 @@
+2018-06-18  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] Crash when adding in-band text track with playbin3 enabled
+        https://bugs.webkit.org/show_bug.cgi?id=186654
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Text track indexes should be relative to the total amount of
+        in-band text tracks. The previous code would induce the creation
+        of in-band text tracks with indexes relative to the total amount
+        of all in-band (audio, video, text) tracks.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
+
 2018-06-17  Zalan Bujtas  <zalan@apple.com>
 
         Anonymous block collapsing can destroy the renderer's parent.
index ab3b6ed..9a0711e 100644 (file)
@@ -700,6 +700,7 @@ void MediaPlayerPrivateGStreamer::updateTracks()
     bool oldHasVideo = m_hasVideo;
     // New stream collections override previous ones.
     clearTracks();
+    unsigned textTrackIndex = 0;
     for (unsigned i = 0; i < length; i++) {
         GRefPtr<GstStream> stream = gst_stream_collection_get_stream(m_streamCollection.get(), i);
         String streamId(gst_stream_get_stream_id(stream.get()));
@@ -712,7 +713,7 @@ void MediaPlayerPrivateGStreamer::updateTracks()
             CREATE_TRACK(video, Video)
         } else if (type & GST_STREAM_TYPE_TEXT && !useMediaSource) {
 #if ENABLE(VIDEO_TRACK)
-            RefPtr<InbandTextTrackPrivateGStreamer> track = InbandTextTrackPrivateGStreamer::create(i, stream);
+            RefPtr<InbandTextTrackPrivateGStreamer> track = InbandTextTrackPrivateGStreamer::create(textTrackIndex++, stream);
             m_textTracks.add(streamId, track);
             m_player->addTextTrack(*track);
 #endif