@@ -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
279278DesktopCaptureImpl::~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 (),
0 commit comments