commit c4592fa362053fd59e3d307c65ce8cd597640d62
parent 418a85a5c7ac71751dace10df2a1573b5525e607
Author: Alexandru Marc <amarc@mozilla.com>
Date: Wed, 29 Oct 2025 02:46:30 +0200
Revert "Bug 1996020 - use frame buffer pool in DesktopCaptureImpl::OnCaptureResult r=dbaker" for causing mda failures @ test_peerConnection_basicScreenshare.html
This reverts commit 803cd3c7617fd38eba1b454b55d308d9609ee164.
Diffstat:
2 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.cc b/dom/media/systemservices/video_engine/desktop_capture_impl.cc
@@ -273,8 +273,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t aId, const char* aUniqueId,
mDeviceType(aType),
mControlThread(mozilla::GetCurrentSerialEventTarget()),
mNextFrameMinimumTime(Timestamp::Zero()),
- mCallbacks("DesktopCaptureImpl::mCallbacks"),
- mBufferPool(false, 2) {}
+ mCallbacks("DesktopCaptureImpl::mCallbacks") {}
DesktopCaptureImpl::~DesktopCaptureImpl() {
MOZ_ASSERT(!mCaptureThread);
@@ -400,8 +399,6 @@ int32_t DesktopCaptureImpl::StopCapture() {
mRequestedCapability = mozilla::Nothing();
}
- mBufferPool.Release();
-
if (mCaptureThread) {
// CaptureThread shutdown.
mCaptureThread->AsyncShutdown();
@@ -475,24 +472,18 @@ void DesktopCaptureImpl::OnCaptureResult(DesktopCapturer::Result aResult,
return;
}
+ int stride_y = width;
+ int stride_uv = (width + 1) / 2;
+
// Setting absolute height (in case it was negative).
// In Windows, the image starts bottom left, instead of top left.
// Setting a negative source height, inverts the image (within LibYuv).
mozilla::PerformanceRecorder<mozilla::CopyVideoStage> rec(
"DesktopCaptureImpl::ConvertToI420"_ns, mTrackingId, width, abs(height));
- // The more basic I420Buffer constructor defaults stride_y to width;
- // and stride_u and stride_v as (width + 1) / 2, so we can use this
- // call to CreateI420Buffer that takes only width and height.
- webrtc::scoped_refptr<webrtc::I420Buffer> buffer =
- mBufferPool.CreateI420Buffer(width, abs(height));
- if (!buffer) {
- RTC_LOG(LS_ERROR) << "Failed to allocate I420Buffer from pool.";
- MOZ_ASSERT_UNREACHABLE(
- "We might fail to allocate a buffer, but with this "
- "being a recycling pool that shouldn't happen");
- return;
- }
+ // TODO(nisse): Use a pool?
+ webrtc::scoped_refptr<I420Buffer> buffer =
+ I420Buffer::Create(width, abs(height), stride_y, stride_uv, stride_uv);
const int conversionResult = libyuv::ConvertToI420(
videoFrame, videoFrameLength, buffer->MutableDataY(), buffer->StrideY(),
diff --git a/dom/media/systemservices/video_engine/desktop_capture_impl.h b/dom/media/systemservices/video_engine/desktop_capture_impl.h
@@ -24,7 +24,6 @@
#include "api/sequence_checker.h"
#include "api/video/video_frame.h"
#include "api/video/video_sink_interface.h"
-#include "common_video/include/video_frame_buffer_pool.h"
#include "modules/desktop_capture/desktop_capturer.h"
#include "modules/video_capture/video_capture.h"
#include "mozilla/DataMutex.h"
@@ -136,8 +135,6 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
mCallbacks;
// Subscribers to this event will be notified when the capture has ended.
mozilla::MediaEventProducer<void> mCaptureEndedEvent;
-
- webrtc::VideoFrameBufferPool mBufferPool;
};
} // namespace webrtc