Diff
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282997 => 282998)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-09-23 20:14:11 UTC (rev 282997)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-09-23 20:14:14 UTC (rev 282998)
@@ -1,5 +1,71 @@
2021-09-23 Russell Epstein <[email protected]>
+ Cherry-pick r281984. rdar://problem/83460908
+
+ RemoteVideoSample needs CVPixelBufferRef to be kept alive, but relies on caller to retain it
+ <https://webkit.org/b/229806>
+ <rdar://problem/82684479>
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore:
+
+ Covered by tests:
+ webrtc/video-mute.html
+ webrtc/video-unmute.html
+
+ * platform/graphics/RemoteVideoSample.cpp:
+ (WebCore::RemoteVideoSample::create):
+ - Pass CVPixelBufferRef to RemoteVideoSample
+ constructor.
+ (WebCore::RemoteVideoSample::RemoteVideoSample):
+ - Change constructor to accept CVPixelBufferRef
+ argument.
+ * platform/graphics/RemoteVideoSample.h:
+ (WebCore::RemoteVideoSample::RemoteVideoSample):
+ - Change constructor to accept CVPixelBufferRef
+ argument.
+ - Add m_imageBuffer instance variable to hold on to the
+ CVPixelBufferRef.
+
+ Source/WebKit:
+
+ * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
+ (WebKit::LibWebRTCCodecs::encodeFrame):
+ - Pass converted CVPixelBufferRef to
+ RemoteVideoSample::create(). A similar change in an earlier
+ patch for Bug 229661 caused test failures.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-03 David Kilzer <[email protected]>
+
+ RemoteVideoSample needs CVPixelBufferRef to be kept alive, but relies on caller to retain it
+ <https://webkit.org/b/229806>
+ <rdar://problem/82684479>
+
+ Reviewed by Darin Adler.
+
+ Covered by tests:
+ webrtc/video-mute.html
+ webrtc/video-unmute.html
+
+ * platform/graphics/RemoteVideoSample.cpp:
+ (WebCore::RemoteVideoSample::create):
+ - Pass CVPixelBufferRef to RemoteVideoSample
+ constructor.
+ (WebCore::RemoteVideoSample::RemoteVideoSample):
+ - Change constructor to accept CVPixelBufferRef
+ argument.
+ * platform/graphics/RemoteVideoSample.h:
+ (WebCore::RemoteVideoSample::RemoteVideoSample):
+ - Change constructor to accept CVPixelBufferRef
+ argument.
+ - Add m_imageBuffer instance variable to hold on to the
+ CVPixelBufferRef.
+
+2021-09-23 Russell Epstein <[email protected]>
+
Cherry-pick r281950. rdar://problem/83460946
Leak of VTImageRotationSessionRef (176 bytes) in com.apple.WebKit.GPU.Development process
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/RemoteVideoSample.cpp (282997 => 282998)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/RemoteVideoSample.cpp 2021-09-23 20:14:11 UTC (rev 282997)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/RemoteVideoSample.cpp 2021-09-23 20:14:14 UTC (rev 282998)
@@ -89,7 +89,7 @@
{
ASSERT(sample.platformSample().type == PlatformSample::CMSampleBufferType);
- auto imageBuffer = PAL::CMSampleBufferGetImageBuffer(sample.platformSample().sample.cmSampleBuffer);
+ RetainPtr imageBuffer = PAL::CMSampleBufferGetImageBuffer(sample.platformSample().sample.cmSampleBuffer);
if (!imageBuffer) {
RELEASE_LOG_ERROR(Media, "RemoteVideoSample::create: CMSampleBufferGetImageBuffer returned nullptr");
return nullptr;
@@ -96,16 +96,16 @@
}
std::unique_ptr<IOSurface> ioSurface;
- auto surface = CVPixelBufferGetIOSurface(imageBuffer);
+ auto surface = CVPixelBufferGetIOSurface(imageBuffer.get());
if (!surface) {
// Special case for canvas data that is RGBA, not IOSurface backed.
- auto pixelFormatType = CVPixelBufferGetPixelFormatType(imageBuffer);
+ auto pixelFormatType = CVPixelBufferGetPixelFormatType(imageBuffer.get());
if (pixelFormatType != kCVPixelFormatType_32BGRA) {
RELEASE_LOG_ERROR(Media, "RemoteVideoSample::create does not support non IOSurface backed samples that are not BGRA");
return nullptr;
}
- ioSurface = transferBGRAPixelBufferToIOSurface(imageBuffer);
+ ioSurface = transferBGRAPixelBufferToIOSurface(imageBuffer.get());
if (!ioSurface)
return nullptr;
@@ -112,22 +112,23 @@
surface = ioSurface->surface();
}
- return std::unique_ptr<RemoteVideoSample>(new RemoteVideoSample(surface, DestinationColorSpace::SRGB(), sample.presentationTime(), sample.videoRotation(), sample.videoMirrored()));
+ return std::unique_ptr<RemoteVideoSample>(new RemoteVideoSample(surface, WTFMove(imageBuffer), DestinationColorSpace::SRGB(), sample.presentationTime(), sample.videoRotation(), sample.videoMirrored()));
}
-std::unique_ptr<RemoteVideoSample> RemoteVideoSample::create(CVPixelBufferRef imageBuffer, MediaTime&& presentationTime, MediaSample::VideoRotation rotation)
+std::unique_ptr<RemoteVideoSample> RemoteVideoSample::create(RetainPtr<CVPixelBufferRef>&& imageBuffer, MediaTime&& presentationTime, MediaSample::VideoRotation rotation)
{
- auto surface = CVPixelBufferGetIOSurface(imageBuffer);
+ auto surface = CVPixelBufferGetIOSurface(imageBuffer.get());
if (!surface) {
RELEASE_LOG_ERROR(Media, "RemoteVideoSample::create: CVPixelBufferGetIOSurface returned nullptr");
return nullptr;
}
- return std::unique_ptr<RemoteVideoSample>(new RemoteVideoSample(surface, DestinationColorSpace::SRGB(), WTFMove(presentationTime), rotation, false));
+ return std::unique_ptr<RemoteVideoSample>(new RemoteVideoSample(surface, WTFMove(imageBuffer), DestinationColorSpace::SRGB(), WTFMove(presentationTime), rotation, false));
}
-RemoteVideoSample::RemoteVideoSample(IOSurfaceRef surface, const DestinationColorSpace& colorSpace, MediaTime&& time, MediaSample::VideoRotation rotation, bool mirrored)
+RemoteVideoSample::RemoteVideoSample(IOSurfaceRef surface, RetainPtr<CVPixelBufferRef>&& imageBuffer, const DestinationColorSpace& colorSpace, MediaTime&& time, MediaSample::VideoRotation rotation, bool mirrored)
: m_ioSurface(WebCore::IOSurface::createFromSurface(surface, colorSpace))
+ , m_imageBuffer(WTFMove(imageBuffer))
, m_rotation(rotation)
, m_time(WTFMove(time))
, m_videoFormat(IOSurfaceGetPixelFormat(surface))
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/RemoteVideoSample.h (282997 => 282998)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/RemoteVideoSample.h 2021-09-23 20:14:11 UTC (rev 282997)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/RemoteVideoSample.h 2021-09-23 20:14:14 UTC (rev 282998)
@@ -45,7 +45,7 @@
~RemoteVideoSample() = default;
WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(MediaSample&);
- WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(CVPixelBufferRef, MediaTime&& presentationTime, MediaSample::VideoRotation = MediaSample::VideoRotation::None);
+ WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(RetainPtr<CVPixelBufferRef>&&, MediaTime&& presentationTime, MediaSample::VideoRotation = MediaSample::VideoRotation::None);
WEBCORE_EXPORT IOSurfaceRef surface() const;
const MediaTime& time() const { return m_time; }
@@ -103,9 +103,10 @@
}
private:
- RemoteVideoSample(IOSurfaceRef, const DestinationColorSpace&, MediaTime&&, MediaSample::VideoRotation, bool);
+ RemoteVideoSample(IOSurfaceRef, RetainPtr<CVPixelBufferRef>&&, const DestinationColorSpace&, MediaTime&&, MediaSample::VideoRotation, bool);
std::unique_ptr<WebCore::IOSurface> m_ioSurface;
+ RetainPtr<CVPixelBufferRef> m_imageBuffer;
WTF::MachSendRight m_sendRight;
MediaSample::VideoRotation m_rotation { MediaSample::VideoRotation::None };
MediaTime m_time;
Modified: branches/safari-612-branch/Source/WebKit/ChangeLog (282997 => 282998)
--- branches/safari-612-branch/Source/WebKit/ChangeLog 2021-09-23 20:14:11 UTC (rev 282997)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog 2021-09-23 20:14:14 UTC (rev 282998)
@@ -1,5 +1,59 @@
2021-09-23 Russell Epstein <[email protected]>
+ Cherry-pick r281984. rdar://problem/83460908
+
+ RemoteVideoSample needs CVPixelBufferRef to be kept alive, but relies on caller to retain it
+ <https://webkit.org/b/229806>
+ <rdar://problem/82684479>
+
+ Reviewed by Darin Adler.
+
+ Source/WebCore:
+
+ Covered by tests:
+ webrtc/video-mute.html
+ webrtc/video-unmute.html
+
+ * platform/graphics/RemoteVideoSample.cpp:
+ (WebCore::RemoteVideoSample::create):
+ - Pass CVPixelBufferRef to RemoteVideoSample
+ constructor.
+ (WebCore::RemoteVideoSample::RemoteVideoSample):
+ - Change constructor to accept CVPixelBufferRef
+ argument.
+ * platform/graphics/RemoteVideoSample.h:
+ (WebCore::RemoteVideoSample::RemoteVideoSample):
+ - Change constructor to accept CVPixelBufferRef
+ argument.
+ - Add m_imageBuffer instance variable to hold on to the
+ CVPixelBufferRef.
+
+ Source/WebKit:
+
+ * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
+ (WebKit::LibWebRTCCodecs::encodeFrame):
+ - Pass converted CVPixelBufferRef to
+ RemoteVideoSample::create(). A similar change in an earlier
+ patch for Bug 229661 caused test failures.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-03 David Kilzer <[email protected]>
+
+ RemoteVideoSample needs CVPixelBufferRef to be kept alive, but relies on caller to retain it
+ <https://webkit.org/b/229806>
+ <rdar://problem/82684479>
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
+ (WebKit::LibWebRTCCodecs::encodeFrame):
+ - Pass converted CVPixelBufferRef to
+ RemoteVideoSample::create(). A similar change in an earlier
+ patch for Bug 229661 caused test failures.
+
+2021-09-23 Russell Epstein <[email protected]>
+
Cherry-pick r281597. rdar://problem/83460725
[GPUP] RemoteAudioSession doesn't implement begin/endInterruption
Modified: branches/safari-612-branch/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp (282997 => 282998)
--- branches/safari-612-branch/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp 2021-09-23 20:14:11 UTC (rev 282997)
+++ branches/safari-612-branch/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp 2021-09-23 20:14:14 UTC (rev 282998)
@@ -455,8 +455,7 @@
auto sample = RemoteVideoSample::create(pixelBuffer, MediaTime(frame.timestamp_us() * 1000, 1000000), toMediaSampleVideoRotation(frame.rotation()));
if (!sample) {
// FIXME: Optimize this code path, currently we have non BGRA for muted frames at least.
- newPixelBuffer = convertToBGRA(pixelBuffer);
- sample = RemoteVideoSample::create(newPixelBuffer.get(), MediaTime(frame.timestamp_us() * 1000, 1000000), toMediaSampleVideoRotation(frame.rotation()));
+ sample = RemoteVideoSample::create(convertToBGRA(newPixelBuffer.get()), MediaTime(frame.timestamp_us() * 1000, 1000000), toMediaSampleVideoRotation(frame.rotation()));
}
encoder.connection->send(Messages::LibWebRTCCodecsProxy::EncodeFrame { encoder.identifier, *sample, frame.timestamp(), shouldEncodeAsKeyFrame }, 0);