Title: [276827] trunk/Source/WebCore
Revision
276827
Author
[email protected]
Date
2021-04-29 18:42:20 -0700 (Thu, 29 Apr 2021)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=225183
rdar://77251937

Reviewed by Eric Carlson.

Under some circumstances, the decoded image may end up being empty. We need to handle this case.

* Modules/mediasession/MediaMetadata.cpp:
(WebCore::MediaMetadata::refreshArtworkImage): Exit early if image is empty.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::nowPlayingInfo const): Add assert to clarify code

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276826 => 276827)


--- trunk/Source/WebCore/ChangeLog	2021-04-30 01:17:59 UTC (rev 276826)
+++ trunk/Source/WebCore/ChangeLog	2021-04-30 01:42:20 UTC (rev 276827)
@@ -1,3 +1,16 @@
+2021-04-29  Jean-Yves Avenard  <[email protected]>
+        https://bugs.webkit.org/show_bug.cgi?id=225183
+        rdar://77251937
+
+        Reviewed by Eric Carlson.
+
+        Under some circumstances, the decoded image may end up being empty. We need to handle this case.
+
+        * Modules/mediasession/MediaMetadata.cpp:
+        (WebCore::MediaMetadata::refreshArtworkImage): Exit early if image is empty.
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::nowPlayingInfo const): Add assert to clarify code
+
 2021-04-29  Zalan Bujtas  <[email protected]>
 
         Floating object are not removed from the initial containing block

Modified: trunk/Source/WebCore/Modules/mediasession/MediaMetadata.cpp (276826 => 276827)


--- trunk/Source/WebCore/Modules/mediasession/MediaMetadata.cpp	2021-04-30 01:17:59 UTC (rev 276826)
+++ trunk/Source/WebCore/Modules/mediasession/MediaMetadata.cpp	2021-04-30 01:42:20 UTC (rev 276827)
@@ -180,6 +180,8 @@
     // FIXME: Implement a heuristic to retrieve the "best" image.
     m_artworkImageSrc = mediaImages[0].src;
     m_artworkLoader = makeUnique<ArtworkImageLoader>(*m_session->document(), m_artworkImageSrc, [this](Image* image) {
+        if (!image->data())
+            return;
         setArtworkImage(image);
         metadataUpdated();
     });

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (276826 => 276827)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2021-04-30 01:17:59 UTC (rev 276826)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2021-04-30 01:42:20 UTC (rev 276827)
@@ -1156,6 +1156,7 @@
     if (sessionMetadata) {
         Optional<NowPlayingInfoArtwork> artwork;
         if (sessionMetadata->artworkImage()) {
+            ASSERT(sessionMetadata->artworkImage()->data(), "An image must always have associated data");
             artwork = NowPlayingInfoArtwork { sessionMetadata->artworkSrc(), sessionMetadata->artworkImage()->mimeType(), sessionMetadata->artworkImage()->data() };
         }
         return NowPlayingInfo { sessionMetadata->title(), sessionMetadata->artist(), sessionMetadata->album(), m_element.sourceApplicationIdentifier(), duration, currentTime, supportsSeeking, m_element.mediaUniqueIdentifier(), isPlaying, allowsNowPlayingControlsVisibility, WTFMove(artwork) };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to