[GStreamer] Crash in Debug build when purging invalid tracks
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Feb 2018 13:26:51 +0000 (13:26 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Feb 2018 13:26:51 +0000 (13:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182997

Reviewed by Xabier Rodriguez-Calvar.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left.
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
(WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2.
(WebCore::TrackPrivateBaseGStreamer::getTag): Ditto.

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

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

index 667a753..e6fc6ae 100644 (file)
@@ -1,5 +1,20 @@
 2018-02-21  Philippe Normand  <pnormand@igalia.com>
 
+        [GStreamer] Crash in Debug build when purging invalid tracks
+        https://bugs.webkit.org/show_bug.cgi?id=182997
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left.
+        (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
+        (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
+        * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
+        (WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2.
+        (WebCore::TrackPrivateBaseGStreamer::getTag): Ditto.
+
+2018-02-21  Philippe Normand  <pnormand@igalia.com>
+
         [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
         https://bugs.webkit.org/show_bug.cgi?id=182996
 
index 2db6f6e..e868e26 100644 (file)
@@ -1455,6 +1455,10 @@ void MediaPlayerPrivateGStreamer::processTableOfContentsEntry(GstTocEntry* entry
 
 void MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks(Vector<String> validTrackIds)
 {
+    if (validTrackIds.isEmpty()) {
+        m_audioTracks.clear();
+        return;
+    }
     for (auto audioTrackId : m_audioTracks.keys()) {
         if (validTrackIds.contains(audioTrackId))
             continue;
@@ -1467,6 +1471,10 @@ void MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks(Vector<String> validTr
 
 void MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks(Vector<String> validTrackIds)
 {
+    if (validTrackIds.isEmpty()) {
+        m_videoTracks.clear();
+        return;
+    }
     for (auto videoTrackId : m_videoTracks.keys()) {
         if (validTrackIds.contains(videoTrackId))
             continue;
@@ -1479,6 +1487,10 @@ void MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks(Vector<String> validTr
 
 void MediaPlayerPrivateGStreamer::purgeInvalidTextTracks(Vector<String> validTrackIds)
 {
+    if (validTrackIds.isEmpty()) {
+        m_textTracks.clear();
+        return;
+    }
     for (auto textTrackId : m_textTracks.keys()) {
         if (validTrackIds.contains(textTrackId))
             continue;
index b0d2957..ff4eb96 100644 (file)
@@ -148,7 +148,7 @@ bool TrackPrivateBaseGStreamer::getLanguageCode(GstTagList* tags, AtomicString&
     String language;
     if (getTag(tags, GST_TAG_LANGUAGE_CODE, language)) {
         language = gst_tag_get_language_code_iso_639_1(language.utf8().data());
-        GST_INFO("Converted track %d's language code to %s.", m_index, language.utf8().data());
+        GST_DEBUG("Converted track %d's language code to %s.", m_index, language.utf8().data());
         if (language != value) {
             value = language;
             return true;
@@ -162,7 +162,7 @@ bool TrackPrivateBaseGStreamer::getTag(GstTagList* tags, const gchar* tagName, S
 {
     GUniqueOutPtr<gchar> tagValue;
     if (gst_tag_list_get_string(tags, tagName, &tagValue.outPtr())) {
-        GST_INFO("Track %d got %s %s.", m_index, tagName, tagValue.get());
+        GST_DEBUG("Track %d got %s %s.", m_index, tagName, tagValue.get());
         value = tagValue.get();
         return true;
     }