From 744494f451e98680895f62e85388367dd73102a2 Mon Sep 17 00:00:00 2001 From: nisse Date: Mon, 16 May 2016 23:51:04 -0700 Subject: [PATCH] Make the FakeWebRtcVideoCaptureModule class initialize frame data. Needed to avoid DrMemory warnings, if the frame is passed to libyuv AVX assembly functions. BUG=libyuv:377 Review-Url: https://codereview.webrtc.org/1985693002 Cr-Commit-Position: refs/heads/master@{#12765} --- webrtc/media/engine/fakewebrtcvideocapturemodule.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webrtc/media/engine/fakewebrtcvideocapturemodule.h b/webrtc/media/engine/fakewebrtcvideocapturemodule.h index 3202502e6c..2bc715b1e1 100644 --- a/webrtc/media/engine/fakewebrtcvideocapturemodule.h +++ b/webrtc/media/engine/fakewebrtcvideocapturemodule.h @@ -87,11 +87,16 @@ class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { void SendFrame(int w, int h) { if (!running_) return; - webrtc::VideoFrame sample; - // Setting stride based on width. - sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2); + + rtc::scoped_refptr buffer = + new rtc::RefCountedObject(w, h); + // Initialize memory to satisfy DrMemory tests. See + // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 + buffer->InitializeData(); if (callback_) { - callback_->OnIncomingCapturedFrame(id_, sample); + callback_->OnIncomingCapturedFrame( + id_, + webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); } }