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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 int WebRtcVideoFrame::height() const { | 78 int WebRtcVideoFrame::height() const { |
79 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; | 79 return video_frame_buffer_ ? video_frame_buffer_->height() : 0; |
80 } | 80 } |
81 | 81 |
82 bool WebRtcVideoFrame::IsExclusive() const { | 82 bool WebRtcVideoFrame::IsExclusive() const { |
83 return video_frame_buffer_->IsMutable(); | 83 return video_frame_buffer_->IsMutable(); |
84 } | 84 } |
85 | 85 |
86 void* WebRtcVideoFrame::GetNativeHandle() const { | |
87 return video_frame_buffer_ ? video_frame_buffer_->native_handle() : nullptr; | |
88 } | |
89 | |
90 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& | 86 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& |
91 WebRtcVideoFrame::video_frame_buffer() const { | 87 WebRtcVideoFrame::video_frame_buffer() const { |
92 return video_frame_buffer_; | 88 return video_frame_buffer_; |
93 } | 89 } |
94 | 90 |
95 VideoFrame* WebRtcVideoFrame::Copy() const { | 91 VideoFrame* WebRtcVideoFrame::Copy() const { |
96 return new WebRtcVideoFrame(video_frame_buffer_, rotation_, timestamp_us_); | 92 return new WebRtcVideoFrame(video_frame_buffer_, rotation_, timestamp_us_); |
97 } | 93 } |
98 | 94 |
99 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc, | 95 size_t WebRtcVideoFrame::ConvertToRgbBuffer(uint32_t to_fourcc, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const { | 182 const VideoFrame* WebRtcVideoFrame::GetCopyWithRotationApplied() const { |
187 // If the frame is not rotated, the caller should reuse this frame instead of | 183 // If the frame is not rotated, the caller should reuse this frame instead of |
188 // making a redundant copy. | 184 // making a redundant copy. |
189 if (rotation() == webrtc::kVideoRotation_0) { | 185 if (rotation() == webrtc::kVideoRotation_0) { |
190 return this; | 186 return this; |
191 } | 187 } |
192 | 188 |
193 // If the video frame is backed up by a native handle, it resides in the GPU | 189 // If the video frame is backed up by a native handle, it resides in the GPU |
194 // memory which we can't rotate here. The assumption is that the renderers | 190 // memory which we can't rotate here. The assumption is that the renderers |
195 // which uses GPU to render should be able to rotate themselves. | 191 // which uses GPU to render should be able to rotate themselves. |
196 RTC_DCHECK(!GetNativeHandle()); | 192 RTC_DCHECK(!video_frame_buffer()->native_handle()); |
197 | 193 |
198 if (rotated_frame_) { | 194 if (rotated_frame_) { |
199 return rotated_frame_.get(); | 195 return rotated_frame_.get(); |
200 } | 196 } |
201 | 197 |
202 int orig_width = width(); | 198 int orig_width = width(); |
203 int orig_height = height(); | 199 int orig_height = height(); |
204 | 200 |
205 int rotated_width = orig_width; | 201 int rotated_width = orig_width; |
206 int rotated_height = orig_height; | 202 int rotated_height = orig_height; |
(...skipping 20 matching lines...) Expand all Loading... |
227 rotated_frame_->video_frame_buffer()->StrideV(), | 223 rotated_frame_->video_frame_buffer()->StrideV(), |
228 orig_width, orig_height, | 224 orig_width, orig_height, |
229 static_cast<libyuv::RotationMode>(rotation())); | 225 static_cast<libyuv::RotationMode>(rotation())); |
230 if (ret == 0) { | 226 if (ret == 0) { |
231 return rotated_frame_.get(); | 227 return rotated_frame_.get(); |
232 } | 228 } |
233 return nullptr; | 229 return nullptr; |
234 } | 230 } |
235 | 231 |
236 } // namespace cricket | 232 } // namespace cricket |
OLD | NEW |