| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 18 matching lines...) Expand all Loading... |
| 29 uint32_t timestamp, | 29 uint32_t timestamp, |
| 30 int64_t render_time_ms, | 30 int64_t render_time_ms, |
| 31 VideoRotation rotation) | 31 VideoRotation rotation) |
| 32 : video_frame_buffer_(buffer), | 32 : video_frame_buffer_(buffer), |
| 33 timestamp_(timestamp), | 33 timestamp_(timestamp), |
| 34 ntp_time_ms_(0), | 34 ntp_time_ms_(0), |
| 35 render_time_ms_(render_time_ms), | 35 render_time_ms_(render_time_ms), |
| 36 rotation_(rotation) { | 36 rotation_(rotation) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 VideoFrame::VideoFrame(void* native_handle, | |
| 40 int width, | |
| 41 int height, | |
| 42 uint32_t timestamp, | |
| 43 int64_t render_time_ms, | |
| 44 VideoRotation rotation, | |
| 45 const rtc::Callback0<void>& no_longer_used) | |
| 46 : VideoFrame(new rtc::RefCountedObject<TextureBuffer>(native_handle, | |
| 47 width, | |
| 48 height, | |
| 49 no_longer_used), | |
| 50 timestamp, | |
| 51 render_time_ms, | |
| 52 rotation) { | |
| 53 } | |
| 54 | |
| 55 int VideoFrame::CreateEmptyFrame(int width, | 39 int VideoFrame::CreateEmptyFrame(int width, |
| 56 int height, | 40 int height, |
| 57 int stride_y, | 41 int stride_y, |
| 58 int stride_u, | 42 int stride_u, |
| 59 int stride_v) { | 43 int stride_v) { |
| 60 const int half_width = (width + 1) / 2; | 44 const int half_width = (width + 1) / 2; |
| 61 DCHECK_GT(width, 0); | 45 DCHECK_GT(width, 0); |
| 62 DCHECK_GT(height, 0); | 46 DCHECK_GT(height, 0); |
| 63 DCHECK_GE(stride_y, width); | 47 DCHECK_GE(stride_y, width); |
| 64 DCHECK_GE(stride_u, half_width); | 48 DCHECK_GE(stride_u, half_width); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 188 |
| 205 rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const { | 189 rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const { |
| 206 return video_frame_buffer_; | 190 return video_frame_buffer_; |
| 207 } | 191 } |
| 208 | 192 |
| 209 void VideoFrame::set_video_frame_buffer( | 193 void VideoFrame::set_video_frame_buffer( |
| 210 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) { | 194 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) { |
| 211 video_frame_buffer_ = buffer; | 195 video_frame_buffer_ = buffer; |
| 212 } | 196 } |
| 213 | 197 |
| 198 VideoFrame VideoFrame::ConvertNativeToI420Frame() const { |
| 199 DCHECK(native_handle()); |
| 200 VideoFrame frame; |
| 201 frame.ShallowCopy(*this); |
| 202 frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer()); |
| 203 return frame; |
| 204 } |
| 205 |
| 214 } // namespace webrtc | 206 } // namespace webrtc |
| OLD | NEW |