Index: webrtc/media/engine/webrtcvideoframe.cc |
diff --git a/webrtc/media/engine/webrtcvideoframe.cc b/webrtc/media/engine/webrtcvideoframe.cc |
index f35a45ac6c3a767f2d8b7a0c3c6cbeda5dfcdad5..7b5a68064f4277989cf339fac54554d2ad9350eb 100644 |
--- a/webrtc/media/engine/webrtcvideoframe.cc |
+++ b/webrtc/media/engine/webrtcvideoframe.cc |
@@ -129,7 +129,9 @@ bool WebRtcVideoFrame::Reset(uint32_t format, |
new_height = dw; |
} |
- InitToEmptyBuffer(new_width, new_height); |
+ rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
+ webrtc::I420Buffer::Create(new_width, new_height); |
+ video_frame_buffer_ = buffer; |
rotation_ = apply_rotation ? webrtc::kVideoRotation_0 : rotation; |
int horiz_crop = ((w - dw) / 2) & ~1; |
@@ -140,15 +142,10 @@ bool WebRtcVideoFrame::Reset(uint32_t format, |
int idh = (h < 0) ? -dh : dh; |
int r = libyuv::ConvertToI420( |
sample, sample_size, |
- video_frame_buffer_->MutableDataY(), |
- video_frame_buffer_->StrideY(), |
- video_frame_buffer_->MutableDataU(), |
- video_frame_buffer_->StrideU(), |
- video_frame_buffer_->MutableDataV(), |
- video_frame_buffer_->StrideV(), |
- horiz_crop, vert_crop, |
- w, h, |
- dw, idh, |
+ buffer->MutableDataY(), buffer->StrideY(), |
+ buffer->MutableDataU(), buffer->StrideU(), |
+ buffer->MutableDataV(), buffer->StrideV(), |
+ horiz_crop, vert_crop, w, h, dw, idh, |
static_cast<libyuv::RotationMode>( |
apply_rotation ? rotation : webrtc::kVideoRotation_0), |
format); |
@@ -162,7 +159,7 @@ bool WebRtcVideoFrame::Reset(uint32_t format, |
} |
void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h) { |
- video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); |
+ video_frame_buffer_ = webrtc::I420Buffer::Create(w, h); |
rotation_ = webrtc::kVideoRotation_0; |
} |