Skip to content

Commit

Permalink
Some AVSampleBufferDisplayLayer methods are deprecated
Browse files Browse the repository at this point in the history
rdar://125340931
https://bugs.webkit.org/show_bug.cgi?id=271633

Reviewed by Jonathan Bedard.

Add deprecation blocks to AVSampleBufferDisplayLayer flush, flushAndRemoveImage, isReadyForMoreMediaData, requestMediaDataWhenReadyOnQueue, stopRequestingMediaData and status.

* Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
(WebCore::LocalSampleBufferDisplayLayer::~LocalSampleBufferDisplayLayer):
(WebCore::LocalSampleBufferDisplayLayer::didFail const):
(WebCore::LocalSampleBufferDisplayLayer::flush):
(WebCore::LocalSampleBufferDisplayLayer::flushAndRemoveImage):
(WebCore::LocalSampleBufferDisplayLayer::requestNotificationWhenReadyForVideoData):

Canonical link: https://commits.webkit.org/276628@main
  • Loading branch information
youennf committed Mar 25, 2024
1 parent d87f5d6 commit 533a598
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)

m_pendingVideoFrameQueue.clear();

ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[m_sampleBufferDisplayLayer stopRequestingMediaData];
[m_sampleBufferDisplayLayer flush];
ALLOW_DEPRECATED_DECLARATIONS_END
m_sampleBufferDisplayLayer = nullptr;

m_rootLayer = nullptr;
Expand All @@ -219,7 +221,9 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
void LocalSampleBufferDisplayLayer::layerStatusDidChange()
{
ASSERT(isMainThread());
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
if (m_client && m_sampleBufferDisplayLayer.get().status == AVQueuedSampleBufferRenderingStatusFailed) {
ALLOW_DEPRECATED_DECLARATIONS_END
RELEASE_LOG_ERROR(WebRTC, "LocalSampleBufferDisplayLayer::layerStatusDidChange going to failed status (%{public}s) ", m_logIdentifier.utf8().data());
if (!m_didFail) {
m_didFail = true;
Expand Down Expand Up @@ -250,7 +254,9 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)

bool LocalSampleBufferDisplayLayer::didFail() const
{
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
return m_didFail || [m_sampleBufferDisplayLayer status] == AVQueuedSampleBufferRenderingStatusFailed;
ALLOW_DEPRECATED_DECLARATIONS_END
}

void LocalSampleBufferDisplayLayer::updateDisplayMode(bool hideDisplayLayer, bool hideRootLayer)
Expand Down Expand Up @@ -308,7 +314,9 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
if (!protectedThis)
return;

ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[m_sampleBufferDisplayLayer flush];
ALLOW_DEPRECATED_DECLARATIONS_END
});
}

Expand All @@ -320,7 +328,9 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
return;

@try {
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[m_sampleBufferDisplayLayer flushAndRemoveImage];
ALLOW_DEPRECATED_DECLARATIONS_END
} @catch(id exception) {
RELEASE_LOG_ERROR(WebRTC, "LocalSampleBufferDisplayLayer::flushAndRemoveImage failed");
layerErrorDidChange();
Expand Down Expand Up @@ -389,7 +399,9 @@ static inline CGAffineTransform transformationMatrixForVideoFrame(VideoFrame& vi
if (m_renderPolicy == RenderPolicy::Immediately || now >= presentationTime)
setSampleBufferAsDisplayImmediately(sampleBuffer.get());

ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[m_sampleBufferDisplayLayer enqueueSampleBuffer:sampleBuffer.get()];
ALLOW_DEPRECATED_DECLARATIONS_END

#if !RELEASE_LOG_DISABLED
constexpr size_t frameCountPerLog = 1800; // log every minute at 30 fps
Expand Down Expand Up @@ -463,6 +475,7 @@ static inline CGAffineTransform transformationMatrixForVideoFrame(VideoFrame& vi
assertIsCurrent(workQueue());

ThreadSafeWeakPtr weakThis { *this };
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[m_sampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{
auto protectedThis = weakThis.get();
if (!protectedThis)
Expand All @@ -485,6 +498,7 @@ static inline CGAffineTransform transformationMatrixForVideoFrame(VideoFrame& vi
}
});
}];
ALLOW_DEPRECATED_DECLARATIONS_END
}

}
Expand Down

0 comments on commit 533a598

Please sign in to comment.