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