| OLD | NEW |
| 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 Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, | 60 bool WebRtcVideoFrame::Init(const CapturedFrame* frame, int dw, int dh, |
| 61 bool apply_rotation) { | 61 bool apply_rotation) { |
| 62 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, | 62 return Reset(frame->fourcc, frame->width, frame->height, dw, dh, |
| 63 static_cast<uint8_t*>(frame->data), frame->data_size, | 63 static_cast<uint8_t*>(frame->data), frame->data_size, |
| 64 frame->time_stamp / rtc::kNumNanosecsPerMicrosec, | 64 frame->time_stamp / rtc::kNumNanosecsPerMicrosec, |
| 65 frame->rotation, apply_rotation); | 65 frame->rotation, apply_rotation); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // TODO(nisse): Deprecated, delete as soon as Chrome is updated. | |
| 69 bool WebRtcVideoFrame::InitToBlack(int w, int h, | |
| 70 int64_t time_stamp_ns) { | |
| 71 rtc::scoped_refptr<webrtc::I420Buffer> buffer( | |
| 72 new rtc::RefCountedObject<webrtc::I420Buffer>(w, h)); | |
| 73 buffer->SetToBlack(); | |
| 74 | |
| 75 video_frame_buffer_ = new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); | |
| 76 SetTimeStamp(time_stamp_ns); | |
| 77 rotation_ = webrtc::kVideoRotation_0; | |
| 78 | |
| 79 return true; | |
| 80 } | |
| 81 | |
| 82 int WebRtcVideoFrame::width() const { | 68 int WebRtcVideoFrame::width() const { |
| 83 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; | 69 return video_frame_buffer_ ? video_frame_buffer_->width() : 0; |
| 84 } | 70 } |
| 85 | 71 |
| 86 int WebRtcVideoFrame::height() const { | 72 int WebRtcVideoFrame::height() const { |
| 87 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; | 73 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; |
| 88 } | 74 } |
| 89 | 75 |
| 90 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& | 76 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& |
| 91 WebRtcVideoFrame::video_frame_buffer() const { | 77 WebRtcVideoFrame::video_frame_buffer() const { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 rotated_frame_->video_frame_buffer()->StrideV(), | 213 rotated_frame_->video_frame_buffer()->StrideV(), |
| 228 orig_width, orig_height, | 214 orig_width, orig_height, |
| 229 static_cast<libyuv::RotationMode>(rotation())); | 215 static_cast<libyuv::RotationMode>(rotation())); |
| 230 if (ret == 0) { | 216 if (ret == 0) { |
| 231 return rotated_frame_.get(); | 217 return rotated_frame_.get(); |
| 232 } | 218 } |
| 233 return nullptr; | 219 return nullptr; |
| 234 } | 220 } |
| 235 | 221 |
| 236 } // namespace cricket | 222 } // namespace cricket |
| OLD | NEW |