| Index: webrtc/media/engine/webrtcvideoframe.cc
|
| diff --git a/webrtc/media/engine/webrtcvideoframe.cc b/webrtc/media/engine/webrtcvideoframe.cc
|
| index 2ff4042c525b2e56394976fe176ef8897d74ee31..4f89c8b85d100562d14cb891c6b11e8f67f247d1 100644
|
| --- a/webrtc/media/engine/webrtcvideoframe.cc
|
| +++ b/webrtc/media/engine/webrtcvideoframe.cc
|
| @@ -149,8 +149,23 @@
|
| return true;
|
| }
|
|
|
| +VideoFrame* WebRtcVideoFrame::CreateEmptyFrame(int w,
|
| + int h,
|
| + int64_t timestamp_us) const {
|
| + WebRtcVideoFrame* frame = new WebRtcVideoFrame();
|
| + frame->InitToEmptyBuffer(w, h, rtc::kNumNanosecsPerMicrosec * timestamp_us);
|
| + return frame;
|
| +}
|
| +
|
| void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h) {
|
| video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h);
|
| + rotation_ = webrtc::kVideoRotation_0;
|
| +}
|
| +
|
| +void WebRtcVideoFrame::InitToEmptyBuffer(int w, int h,
|
| + int64_t time_stamp_ns) {
|
| + video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h);
|
| + SetTimeStamp(time_stamp_ns);
|
| rotation_ = webrtc::kVideoRotation_0;
|
| }
|
|
|
| @@ -170,19 +185,19 @@
|
| return rotated_frame_.get();
|
| }
|
|
|
| - int current_width = width();
|
| - int current_height = height();
|
| -
|
| - int rotated_width = current_width;
|
| - int rotated_height = current_height;
|
| + int orig_width = width();
|
| + int orig_height = height();
|
| +
|
| + int rotated_width = orig_width;
|
| + int rotated_height = orig_height;
|
| if (rotation() == webrtc::kVideoRotation_90 ||
|
| rotation() == webrtc::kVideoRotation_270) {
|
| - std::swap(rotated_width, rotated_height);
|
| - }
|
| -
|
| - rtc::scoped_refptr<webrtc::I420Buffer> buffer =
|
| - new rtc::RefCountedObject<webrtc::I420Buffer>(rotated_width,
|
| - rotated_height);
|
| + rotated_width = orig_height;
|
| + rotated_height = orig_width;
|
| + }
|
| +
|
| + rotated_frame_.reset(
|
| + CreateEmptyFrame(rotated_width, rotated_height, timestamp_us_));
|
|
|
| // TODO(guoweis): Add a function in webrtc_libyuv.cc to convert from
|
| // VideoRotation to libyuv::RotationMode.
|
| @@ -190,16 +205,18 @@
|
| video_frame_buffer_->DataY(), video_frame_buffer_->StrideY(),
|
| video_frame_buffer_->DataU(), video_frame_buffer_->StrideU(),
|
| video_frame_buffer_->DataV(), video_frame_buffer_->StrideV(),
|
| - buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(),
|
| - buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(),
|
| - current_width, current_height,
|
| + rotated_frame_->video_frame_buffer()->MutableDataY(),
|
| + rotated_frame_->video_frame_buffer()->StrideY(),
|
| + rotated_frame_->video_frame_buffer()->MutableDataU(),
|
| + rotated_frame_->video_frame_buffer()->StrideU(),
|
| + rotated_frame_->video_frame_buffer()->MutableDataV(),
|
| + rotated_frame_->video_frame_buffer()->StrideV(),
|
| + orig_width, orig_height,
|
| static_cast<libyuv::RotationMode>(rotation()));
|
| if (ret == 0) {
|
| - rotated_frame_.reset(
|
| - new WebRtcVideoFrame(buffer, webrtc::kVideoRotation_0, timestamp_us_));
|
| - }
|
| -
|
| - return rotated_frame_.get();
|
| + return rotated_frame_.get();
|
| + }
|
| + return nullptr;
|
| }
|
|
|
| } // namespace cricket
|
|
|