- Revision
- 280488
- Author
- [email protected]
- Date
- 2021-07-30 11:49:47 -0700 (Fri, 30 Jul 2021)
Log Message
[Cocoa] Remove support for AVAssetImageGenerator
https://bugs.webkit.org/show_bug.cgi?id=228560
Reviewed by Eric Carlson.
LayoutTests/imported/w3c:
The 2x2-green.mp4 file fails to decode as its natural size is too small for the system decoder to handle. Replace with
a media file of more reasonable size.
* web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html:
* web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html:
* web-platform-tests/media/16x16-green.mp4: Added.
Source/WebCore:
AVAssetImageGenerator is used when there is not yet an available image from AVPlayerItemVideoOutput.
However, AVAssetImageGenerator is a synchronous API call; if data for the current time is not available,
the generator will cause a request for that data to be issued, and if the main thread is blocked in a
synchronous call to the generator, that request can never be completed, causing a deadlock.
Instead, always block moving to a readyState >= HAVE_CURRENT_DATA until either the AVPlayerLayer or
the AVPlayerItemVideoOutput report having an available frame. This prevents clients from attempting
to paint until a frame is available, and ensures that we will always have an available frame for
painting, removing the need for the synchronous generator call.
To ensure the readyState is updated when AVPlayerItemVideoOutput has an available image, register
with the output at creation time for a notification as soon as an image is available. And in the existing
delegate object, send a message back to the MediaPlayerPrivateAVFoundationObjC when that occurs.
No tests needed; this should reduce flakiness of existing tests and cause no regression in behavior.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::hasContextRenderer const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
(-[WebCoreAVFPullDelegate setParent:]):
(-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Deleted.
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): Deleted.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (280487 => 280488)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-30 18:49:47 UTC (rev 280488)
@@ -1,3 +1,17 @@
+2021-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Remove support for AVAssetImageGenerator
+ https://bugs.webkit.org/show_bug.cgi?id=228560
+
+ Reviewed by Eric Carlson.
+
+ The 2x2-green.mp4 file fails to decode as its natural size is too small for the system decoder to handle. Replace with
+ a media file of more reasonable size.
+
+ * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html:
+ * web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html:
+ * web-platform-tests/media/16x16-green.mp4: Added.
+
2021-07-30 Chris Dumez <[email protected]>
HTMLElement.innerText setter should convert new lines to <br>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html (280487 => 280488)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html 2021-07-30 18:49:47 UTC (rev 280488)
@@ -26,7 +26,7 @@
t.step(function() {
var video = document.getElementById("contained");
- video.src = ""
+ video.src = ""
assert_ratio(video, 2.5);
}, "contain:size aspect ratio");
@@ -37,7 +37,7 @@
video = document.createElement("video");
video.setAttribute("width", "250");
video.setAttribute("height", "100");
- video.src = ""
+ video.src = ""
document.body.appendChild(video);
// Videos default to a size of 300x150px and calculate their aspect ratio
// based on that before the video is loaded. So this should be 2, ignoring
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html (280487 => 280488)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/video_loop_base.html 2021-07-30 18:49:47 UTC (rev 280488)
@@ -33,7 +33,7 @@
media.addEventListener("seeking", startTest, false);
media.loop = true;
- media.src = "" + "?" + new Date() + Math.random();
+ media.src = "" + "?" + new Date() + Math.random();
media.play();
</script>
</body>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/media/16x16-green.mp4 (0 => 280488)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/media/16x16-green.mp4 (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/media/16x16-green.mp4 2021-07-30 18:49:47 UTC (rev 280488)
@@ -0,0 +1,7 @@
+������ ftypisom������isomiso2avc1mp41������free����\xA9mdat\xFF\xFBP\xC4��\xC0��\xA4������ ����4\x80����LAME3.99.5UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUULAME3.99.5UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU����\xA0\xFF\xFF\x9C\xDCE\xE9\xBD\xE6\xD9H\xB7\x96,\xD8 \xD9#\xEE\xEFx264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69
qpstep=4 ip_ratio=1.4
0 aq=1:1.00��\x80������e\x88\x84��+\xFF\xFE\xD8\xE7\xF3,\x93\x97z\xB7\x90t\xBB\xC6\xD1\xFF\xFBR\xC4]\x83\xC0��\xA4������ ����4\x80����UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUULAME3.99.5UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xFF\xFBRġ\x83\xC0��\xA4������ ����4\x80����UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUULAME3.99.5UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xFF\xFBRġ\x83\xC0��\xA4������ ����4\x80����UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUULAME3.99.5UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xFF\xFBRġ\x83\xC0��\xA4������ ����4\x80����UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU\xFF
\xFBRġ\x83\xC0��\xA4������ ����4\x80����UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU����
+moov������lmvhd����������������������������\xE8������\x9C����������������������������������������������������������������������������������������@����������������������������������������������������������������+trak������\tkhd������������������������������������������\x9C����������������������������������������������������������������������������������������@����������������������������$edts������elst��������������������\x82����Q����������\x85mdia������ mdhd����������������������������\xACD����\xD1U\xC4����������-hdlr����������������soun������������������������SoundHandler������0minf������smhd����������������������$dinf������dref��������������������url ������������\xF4stbl������`stsd��������������������Pmp4a������������������������������������������\xACD����������,esds��������\x80\x80\x80����\x80\x80\x80+k����������\xFB\x89����\xFB\x89\x80\x80\x80������ stts������������������������\x80����������Q������(stsc��������������������������������
������������������������,stsz����������������������������\xD0������\xD1������\xD1������\xD1������\xD1������\xD1������stco��������������������0����\xBC����'trak������\tkhd������������������������������������������(��������������������������������������������������������������������������������������������@������������������������$edts������elst��������������������(������������������\x9Fmdia������ mdhd����������������������������2��������U\xC4����������-hdlr����������������vide������������������������VideoHandler������Jminf������vmhd����������������������������$dinf����
��dref��������������������url ����������
+stbl������\xA6stsd��������������������\x96avc1����������������������������������������������������H������H��������������������������������������������������������������������������������\xFF\xFF������0avcCd��
+\xFF\xE1��gd��
+\xAC\xD9^\xC0D������������\xC8<H\x96X��h\xEB\xE3\xCB"\xC0������pasp������������������stts��������������������������������stsc��������������������������������������stsz������������\xBC������������stco��������������������������budta������Zmeta��������������!hdlr����������������mdirappl������������������������-ilst������%\xA9too������data��������������Lavf57.56.100
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (280487 => 280488)
--- trunk/Source/WebCore/ChangeLog 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/Source/WebCore/ChangeLog 2021-07-30 18:49:47 UTC (rev 280488)
@@ -1,3 +1,43 @@
+2021-07-30 Jer Noble <[email protected]>
+
+ [Cocoa] Remove support for AVAssetImageGenerator
+ https://bugs.webkit.org/show_bug.cgi?id=228560
+
+ Reviewed by Eric Carlson.
+
+ AVAssetImageGenerator is used when there is not yet an available image from AVPlayerItemVideoOutput.
+ However, AVAssetImageGenerator is a synchronous API call; if data for the current time is not available,
+ the generator will cause a request for that data to be issued, and if the main thread is blocked in a
+ synchronous call to the generator, that request can never be completed, causing a deadlock.
+
+ Instead, always block moving to a readyState >= HAVE_CURRENT_DATA until either the AVPlayerLayer or
+ the AVPlayerItemVideoOutput report having an available frame. This prevents clients from attempting
+ to paint until a frame is available, and ensures that we will always have an available frame for
+ painting, removing the need for the synchronous generator call.
+
+ To ensure the readyState is updated when AVPlayerItemVideoOutput has an available image, register
+ with the output at creation time for a notification as soon as an image is available. And in the existing
+ delegate object, send a message back to the MediaPlayerPrivateAVFoundationObjC when that occurs.
+
+ No tests needed; this should reduce flakiness of existing tests and cause no regression in behavior.
+
+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::hasContextRenderer const):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::paintCurrentFrameInContext):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
+ (-[WebCoreAVFPullDelegate setParent:]):
+ (-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator): Deleted.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator): Deleted.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Deleted.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): Deleted.
+
2021-07-30 Chris Dumez <[email protected]>
HTMLElement.innerText setter should convert new lines to <br>
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (280487 => 280488)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2021-07-30 18:49:47 UTC (rev 280488)
@@ -543,11 +543,16 @@
}
}
+ if (newReadyState >= MediaPlayer::ReadyState::HaveCurrentData && m_cachedHasVideo && !hasAvailableVideoFrame()) {
+ newReadyState = MediaPlayer::ReadyState::HaveMetadata;
+ ALWAYS_LOG(LOGIDENTIFIER, "!hasAvailableVideoFrame(), lowering readyState to ", newReadyState);
+ }
+
if (isReadyForVideoSetup() && currentRenderingMode() != preferredRenderingMode())
setUpVideoRendering();
if (!m_haveReportedFirstVideoFrame && m_cachedHasVideo && hasAvailableVideoFrame()) {
- if (m_readyState < MediaPlayer::ReadyState::HaveCurrentData)
+ if (newReadyState < MediaPlayer::ReadyState::HaveCurrentData)
newReadyState = MediaPlayer::ReadyState::HaveCurrentData;
m_haveReportedFirstVideoFrame = true;
m_player->firstVideoFrameAvailable();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (280487 => 280488)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2021-07-30 18:49:47 UTC (rev 280488)
@@ -118,6 +118,8 @@
MediaTime currentMediaTime() const final;
+ void outputMediaDataWillChange();
+
private:
#if ENABLE(ENCRYPTED_MEDIA)
void cdmInstanceAttached(CDMInstance&) final;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (280487 => 280488)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-07-30 18:25:33 UTC (rev 280487)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-07-30 18:49:47 UTC (rev 280488)
@@ -67,7 +67,6 @@
#import "WebCoreCALayerExtras.h"
#import "WebCoreNSURLExtras.h"
#import "WebCoreNSURLSession.h"
-#import <AVFoundation/AVAssetImageGenerator.h>
#import <AVFoundation/AVAssetTrack.h>
#import <AVFoundation/AVMediaSelectionGroup.h>
#import <AVFoundation/AVMetadataItem.h>
@@ -196,6 +195,7 @@
@interface WebCoreAVFPullDelegate : NSObject<AVPlayerItemOutputPullDelegate> {
BinarySemaphore m_semaphore;
}
+- (void)setParent:(WebCore::MediaPlayerPrivateAVFoundationObjC&)parent;
- (void)outputMediaDataWillChange:(AVPlayerItemOutput *)sender;
- (void)outputSequenceWasFlushed:(AVPlayerItemOutput *)output;
@@ -561,7 +561,7 @@
bool MediaPlayerPrivateAVFoundationObjC::hasContextRenderer() const
{
- return m_videoOutput || m_imageGenerator;
+ return m_videoOutput;
}
void MediaPlayerPrivateAVFoundationObjC::createContextVideoRenderer()
@@ -569,37 +569,11 @@
createVideoOutput();
}
-void MediaPlayerPrivateAVFoundationObjC::createImageGenerator()
-{
- INFO_LOG(LOGIDENTIFIER);
-
- if (!m_avAsset || m_imageGenerator)
- return;
-
- m_imageGenerator = [PAL::getAVAssetImageGeneratorClass() assetImageGeneratorWithAsset:m_avAsset.get()];
-
- [m_imageGenerator.get() setApertureMode:AVAssetImageGeneratorApertureModeCleanAperture];
- [m_imageGenerator.get() setAppliesPreferredTrackTransform:YES];
- [m_imageGenerator.get() setRequestedTimeToleranceBefore:PAL::kCMTimeZero];
- [m_imageGenerator.get() setRequestedTimeToleranceAfter:PAL::kCMTimeZero];
-}
-
void MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer()
{
destroyVideoOutput();
- destroyImageGenerator();
}
-void MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator()
-{
- if (!m_imageGenerator)
- return;
-
- INFO_LOG(LOGIDENTIFIER);
-
- m_imageGenerator = 0;
-}
-
void MediaPlayerPrivateAVFoundationObjC::createVideoLayer()
{
if (!m_avPlayer || m_haveBeenAskedToCreateLayer)
@@ -1813,8 +1787,6 @@
// the video output, too.
if (videoOutputHasAvailableFrame() || (m_videoOutput && m_lastPixelBuffer))
paintWithVideoOutput(context, rect);
- else
- paintWithImageGenerator(context, rect);
END_BLOCK_OBJC_EXCEPTIONS
setDelayCallbacks(false);
@@ -1838,38 +1810,6 @@
paintCurrentFrameInContext(context, rect);
}
-void MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator(GraphicsContext& context, const FloatRect& rect)
-{
- INFO_LOG(LOGIDENTIFIER);
-
- RetainPtr<CGImageRef> image = createImageForTimeInRect(currentTime(), rect);
- if (image) {
- GraphicsContextStateSaver stateSaver(context);
- context.translate(rect.x(), rect.y() + rect.height());
- context.scale(FloatSize(1.0f, -1.0f));
- context.setImageInterpolationQuality(InterpolationQuality::Low);
- IntRect paintRect(IntPoint(0, 0), IntSize(rect.width(), rect.height()));
- CGContextDrawImage(context.platformContext(), CGRectMake(0, 0, paintRect.width(), paintRect.height()), image.get());
- }
-}
-
-RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect(float time, const FloatRect& rect)
-{
- if (!m_imageGenerator)
- createImageGenerator();
- ASSERT(m_imageGenerator);
-
- MonotonicTime start = MonotonicTime::now();
-
- [m_imageGenerator.get() setMaximumSize:CGSize(rect.size())];
- RetainPtr<CGImageRef> rawImage = adoptCF([m_imageGenerator.get() copyCGImageAtTime:PAL::CMTimeMakeWithSeconds(time, 600) actualTime:nil error:nil]);
- RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawImage.get(), sRGBColorSpaceRef()));
-
- INFO_LOG(LOGIDENTIFIER, "creating image took ", (MonotonicTime::now() - start).seconds());
-
- return image;
-}
-
void MediaPlayerPrivateAVFoundationObjC::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& supportedTypes)
{
supportedTypes = AVAssetMIMETypeCache::singleton().supportedTypes();
@@ -2440,11 +2380,18 @@
}
m_videoOutputDelegate = adoptNS([[WebCoreAVFPullDelegate alloc] init]);
+ [m_videoOutputDelegate setParent:*this];
[m_videoOutput setDelegate:m_videoOutputDelegate.get() queue:globalPullDelegateQueue()];
+ [m_videoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:0];
[m_avPlayerItem.get() addOutput:m_videoOutput.get()];
}
+void MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange()
+{
+ updateStates();
+}
+
void MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput()
{
if (!m_videoOutput)
@@ -2539,12 +2486,6 @@
FloatRect imageRect { FloatPoint::zero(), m_lastImage->size() };
context.drawNativeImage(*m_lastImage, imageRect.size(), outputRect, imageRect);
-
- // If we have created an AVAssetImageGenerator in the past due to m_videoOutput not having an available
- // video frame, destroy it now that it is no longer needed.
- if (m_imageGenerator)
- destroyImageGenerator();
-
}
RetainPtr<CVPixelBufferRef> MediaPlayerPrivateAVFoundationObjC::pixelBufferForCurrentTime()
@@ -3899,14 +3840,25 @@
@end
-@implementation WebCoreAVFPullDelegate
+@implementation WebCoreAVFPullDelegate {
+ WeakPtr<WebCore::MediaPlayerPrivateAVFoundationObjC> _parent;
+}
@synthesize semaphore = m_semaphore;
+- (void)setParent:(WebCore::MediaPlayerPrivateAVFoundationObjC&)parent
+{
+ _parent = makeWeakPtr(parent);
+}
+
- (void)outputMediaDataWillChange:(AVPlayerItemVideoOutput *)output
{
UNUSED_PARAM(output);
m_semaphore.signal();
+ RunLoop::main().dispatch([parent = _parent] {
+ if (parent)
+ parent->outputMediaDataWillChange();
+ });
}
- (void)outputSequenceWasFlushed:(AVPlayerItemVideoOutput *)output