Skip to content

Commit c4592fa

Browse files
committed
Revert "Bug 1996020 - use frame buffer pool in DesktopCaptureImpl::OnCaptureResult r=dbaker" for causing mda failures @ test_peerConnection_basicScreenshare.html
This reverts commit 803cd3c.
1 parent 418a85a commit c4592fa

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

dom/media/systemservices/video_engine/desktop_capture_impl.cc

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ DesktopCaptureImpl::DesktopCaptureImpl(const int32_t aId, const char* aUniqueId,
273273
mDeviceType(aType),
274274
mControlThread(mozilla::GetCurrentSerialEventTarget()),
275275
mNextFrameMinimumTime(Timestamp::Zero()),
276-
mCallbacks("DesktopCaptureImpl::mCallbacks"),
277-
mBufferPool(false, 2) {}
276+
mCallbacks("DesktopCaptureImpl::mCallbacks") {}
278277

279278
DesktopCaptureImpl::~DesktopCaptureImpl() {
280279
MOZ_ASSERT(!mCaptureThread);
@@ -400,8 +399,6 @@ int32_t DesktopCaptureImpl::StopCapture() {
400399
mRequestedCapability = mozilla::Nothing();
401400
}
402401

403-
mBufferPool.Release();
404-
405402
if (mCaptureThread) {
406403
// CaptureThread shutdown.
407404
mCaptureThread->AsyncShutdown();
@@ -475,24 +472,18 @@ void DesktopCaptureImpl::OnCaptureResult(DesktopCapturer::Result aResult,
475472
return;
476473
}
477474

475+
int stride_y = width;
476+
int stride_uv = (width + 1) / 2;
477+
478478
// Setting absolute height (in case it was negative).
479479
// In Windows, the image starts bottom left, instead of top left.
480480
// Setting a negative source height, inverts the image (within LibYuv).
481481

482482
mozilla::PerformanceRecorder<mozilla::CopyVideoStage> rec(
483483
"DesktopCaptureImpl::ConvertToI420"_ns, mTrackingId, width, abs(height));
484-
// The more basic I420Buffer constructor defaults stride_y to width;
485-
// and stride_u and stride_v as (width + 1) / 2, so we can use this
486-
// call to CreateI420Buffer that takes only width and height.
487-
webrtc::scoped_refptr<webrtc::I420Buffer> buffer =
488-
mBufferPool.CreateI420Buffer(width, abs(height));
489-
if (!buffer) {
490-
RTC_LOG(LS_ERROR) << "Failed to allocate I420Buffer from pool.";
491-
MOZ_ASSERT_UNREACHABLE(
492-
"We might fail to allocate a buffer, but with this "
493-
"being a recycling pool that shouldn't happen");
494-
return;
495-
}
484+
// TODO(nisse): Use a pool?
485+
webrtc::scoped_refptr<I420Buffer> buffer =
486+
I420Buffer::Create(width, abs(height), stride_y, stride_uv, stride_uv);
496487

497488
const int conversionResult = libyuv::ConvertToI420(
498489
videoFrame, videoFrameLength, buffer->MutableDataY(), buffer->StrideY(),

dom/media/systemservices/video_engine/desktop_capture_impl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "api/sequence_checker.h"
2525
#include "api/video/video_frame.h"
2626
#include "api/video/video_sink_interface.h"
27-
#include "common_video/include/video_frame_buffer_pool.h"
2827
#include "modules/desktop_capture/desktop_capturer.h"
2928
#include "modules/video_capture/video_capture.h"
3029
#include "mozilla/DataMutex.h"
@@ -136,8 +135,6 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
136135
mCallbacks;
137136
// Subscribers to this event will be notified when the capture has ended.
138137
mozilla::MediaEventProducer<void> mCaptureEndedEvent;
139-
140-
webrtc::VideoFrameBufferPool mBufferPool;
141138
};
142139

143140
} // namespace webrtc

0 commit comments

Comments
 (0)