Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: webrtc/media/engine/webrtcvideoframe.cc

Issue 1838353004: cricket::VideoFrame cleanup. New width() and height(). Deleted GetChroma* methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: TODO comments. Formatting tweak. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 frame->time_stamp, 58 frame->time_stamp,
59 frame->rotation, apply_rotation); 59 frame->rotation, apply_rotation);
60 } 60 }
61 61
62 bool WebRtcVideoFrame::InitToBlack(int w, int h, 62 bool WebRtcVideoFrame::InitToBlack(int w, int h,
63 int64_t time_stamp_ns) { 63 int64_t time_stamp_ns) {
64 InitToEmptyBuffer(w, h, time_stamp_ns); 64 InitToEmptyBuffer(w, h, time_stamp_ns);
65 return SetToBlack(); 65 return SetToBlack();
66 } 66 }
67 67
68 size_t WebRtcVideoFrame::GetWidth() const { 68 int WebRtcVideoFrame::width() const {
69 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; 69 return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
70 } 70 }
71 71
72 size_t WebRtcVideoFrame::GetHeight() const { 72 int WebRtcVideoFrame::height() const {
73 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; 73 return video_frame_buffer_ ? video_frame_buffer_->height() : 0;
74 } 74 }
75 75
76 const uint8_t* WebRtcVideoFrame::GetYPlane() const { 76 const uint8_t* WebRtcVideoFrame::GetYPlane() const {
77 return video_frame_buffer_ ? video_frame_buffer_->data(kYPlane) : nullptr; 77 return video_frame_buffer_ ? video_frame_buffer_->data(kYPlane) : nullptr;
78 } 78 }
79 79
80 const uint8_t* WebRtcVideoFrame::GetUPlane() const { 80 const uint8_t* WebRtcVideoFrame::GetUPlane() const {
81 return video_frame_buffer_ ? video_frame_buffer_->data(kUPlane) : nullptr; 81 return video_frame_buffer_ ? video_frame_buffer_->data(kUPlane) : nullptr;
82 } 82 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 // If the video frame is backed up by a native handle, it resides in the GPU 244 // If the video frame is backed up by a native handle, it resides in the GPU
245 // memory which we can't rotate here. The assumption is that the renderers 245 // memory which we can't rotate here. The assumption is that the renderers
246 // which uses GPU to render should be able to rotate themselves. 246 // which uses GPU to render should be able to rotate themselves.
247 RTC_DCHECK(!GetNativeHandle()); 247 RTC_DCHECK(!GetNativeHandle());
248 248
249 if (rotated_frame_) { 249 if (rotated_frame_) {
250 return rotated_frame_.get(); 250 return rotated_frame_.get();
251 } 251 }
252 252
253 int width = static_cast<int>(GetWidth()); 253 int orig_width = width();
254 int height = static_cast<int>(GetHeight()); 254 int orig_height = height();
255 255
256 int rotated_width = width; 256 int rotated_width = orig_width;
257 int rotated_height = height; 257 int rotated_height = orig_height;
258 if (GetVideoRotation() == webrtc::kVideoRotation_90 || 258 if (GetVideoRotation() == webrtc::kVideoRotation_90 ||
259 GetVideoRotation() == webrtc::kVideoRotation_270) { 259 GetVideoRotation() == webrtc::kVideoRotation_270) {
260 rotated_width = height; 260 rotated_width = orig_height;
261 rotated_height = width; 261 rotated_height = orig_width;
262 } 262 }
263 263
264 rotated_frame_.reset(CreateEmptyFrame(rotated_width, rotated_height, 264 rotated_frame_.reset(CreateEmptyFrame(rotated_width, rotated_height,
265 GetTimeStamp())); 265 GetTimeStamp()));
266 266
267 // TODO(guoweis): Add a function in webrtc_libyuv.cc to convert from 267 // TODO(guoweis): Add a function in webrtc_libyuv.cc to convert from
268 // VideoRotation to libyuv::RotationMode. 268 // VideoRotation to libyuv::RotationMode.
269 int ret = libyuv::I420Rotate( 269 int ret = libyuv::I420Rotate(
270 GetYPlane(), GetYPitch(), GetUPlane(), GetUPitch(), GetVPlane(), 270 GetYPlane(), GetYPitch(), GetUPlane(), GetUPitch(), GetVPlane(),
271 GetVPitch(), rotated_frame_->GetYPlane(), rotated_frame_->GetYPitch(), 271 GetVPitch(), rotated_frame_->GetYPlane(), rotated_frame_->GetYPitch(),
272 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(), 272 rotated_frame_->GetUPlane(), rotated_frame_->GetUPitch(),
273 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(), width, height, 273 rotated_frame_->GetVPlane(), rotated_frame_->GetVPitch(),
274 orig_width, orig_height,
274 static_cast<libyuv::RotationMode>(GetVideoRotation())); 275 static_cast<libyuv::RotationMode>(GetVideoRotation()));
275 if (ret == 0) { 276 if (ret == 0) {
276 return rotated_frame_.get(); 277 return rotated_frame_.get();
277 } 278 }
278 return nullptr; 279 return nullptr;
279 } 280 }
280 281
281 } // namespace cricket 282 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoframe.h ('k') | webrtc/media/engine/webrtcvideoframe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698