| 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 24 matching lines...) Expand all Loading... |
| 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 int VideoFrame::CreateEmptyFrame(int width, | 39 int VideoFrame::CreateEmptyFrame(int width, |
| 40 int height, | 40 int height, |
| 41 int stride_y, | 41 int stride_y, |
| 42 int stride_u, | 42 int stride_u, |
| 43 int stride_v) { | 43 int stride_v) { |
| 44 const int half_width = (width + 1) / 2; | 44 const int half_width = (width + 1) / 2; |
| 45 DCHECK_GT(width, 0); | 45 RTC_DCHECK_GT(width, 0); |
| 46 DCHECK_GT(height, 0); | 46 RTC_DCHECK_GT(height, 0); |
| 47 DCHECK_GE(stride_y, width); | 47 RTC_DCHECK_GE(stride_y, width); |
| 48 DCHECK_GE(stride_u, half_width); | 48 RTC_DCHECK_GE(stride_u, half_width); |
| 49 DCHECK_GE(stride_v, half_width); | 49 RTC_DCHECK_GE(stride_v, half_width); |
| 50 | 50 |
| 51 // Creating empty frame - reset all values. | 51 // Creating empty frame - reset all values. |
| 52 timestamp_ = 0; | 52 timestamp_ = 0; |
| 53 ntp_time_ms_ = 0; | 53 ntp_time_ms_ = 0; |
| 54 render_time_ms_ = 0; | 54 render_time_ms_ = 0; |
| 55 rotation_ = kVideoRotation_0; | 55 rotation_ = kVideoRotation_0; |
| 56 | 56 |
| 57 // Check if it's safe to reuse allocation. | 57 // Check if it's safe to reuse allocation. |
| 58 if (video_frame_buffer_ && video_frame_buffer_->HasOneRef() && | 58 if (video_frame_buffer_ && video_frame_buffer_->HasOneRef() && |
| 59 !video_frame_buffer_->native_handle() && | 59 !video_frame_buffer_->native_handle() && |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const { | 188 rtc::scoped_refptr<VideoFrameBuffer> VideoFrame::video_frame_buffer() const { |
| 189 return video_frame_buffer_; | 189 return video_frame_buffer_; |
| 190 } | 190 } |
| 191 | 191 |
| 192 void VideoFrame::set_video_frame_buffer( | 192 void VideoFrame::set_video_frame_buffer( |
| 193 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) { | 193 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) { |
| 194 video_frame_buffer_ = buffer; | 194 video_frame_buffer_ = buffer; |
| 195 } | 195 } |
| 196 | 196 |
| 197 VideoFrame VideoFrame::ConvertNativeToI420Frame() const { | 197 VideoFrame VideoFrame::ConvertNativeToI420Frame() const { |
| 198 DCHECK(native_handle()); | 198 RTC_DCHECK(native_handle()); |
| 199 VideoFrame frame; | 199 VideoFrame frame; |
| 200 frame.ShallowCopy(*this); | 200 frame.ShallowCopy(*this); |
| 201 frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer()); | 201 frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer()); |
| 202 return frame; | 202 return frame; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace webrtc | 205 } // namespace webrtc |
| OLD | NEW |