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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 bool VideoFrame::IsZeroSize() const { | 149 bool VideoFrame::IsZeroSize() const { |
150 return !video_frame_buffer_; | 150 return !video_frame_buffer_; |
151 } | 151 } |
152 | 152 |
153 const rtc::scoped_refptr<VideoFrameBuffer>& VideoFrame::video_frame_buffer() | 153 const rtc::scoped_refptr<VideoFrameBuffer>& VideoFrame::video_frame_buffer() |
154 const { | 154 const { |
155 return video_frame_buffer_; | 155 return video_frame_buffer_; |
156 } | 156 } |
157 | 157 |
158 void VideoFrame::set_video_frame_buffer( | |
159 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer) { | |
160 RTC_DCHECK(buffer); | |
161 video_frame_buffer_ = buffer; | |
162 } | |
163 | |
164 VideoFrame VideoFrame::ConvertNativeToI420Frame() const { | |
165 RTC_DCHECK(video_frame_buffer_->native_handle()); | |
166 VideoFrame frame; | |
167 frame.ShallowCopy(*this); | |
168 frame.set_video_frame_buffer(video_frame_buffer_->NativeToI420Buffer()); | |
169 return frame; | |
170 } | |
171 | |
172 size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) { | 158 size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) { |
173 switch (codec_type) { | 159 switch (codec_type) { |
174 case kVideoCodecVP8: | 160 case kVideoCodecVP8: |
175 case kVideoCodecVP9: | 161 case kVideoCodecVP9: |
176 return 0; | 162 return 0; |
177 case kVideoCodecH264: | 163 case kVideoCodecH264: |
178 return kBufferPaddingBytesH264; | 164 return kBufferPaddingBytesH264; |
179 case kVideoCodecI420: | 165 case kVideoCodecI420: |
180 case kVideoCodecRED: | 166 case kVideoCodecRED: |
181 case kVideoCodecULPFEC: | 167 case kVideoCodecULPFEC: |
182 case kVideoCodecGeneric: | 168 case kVideoCodecGeneric: |
183 case kVideoCodecUnknown: | 169 case kVideoCodecUnknown: |
184 return 0; | 170 return 0; |
185 } | 171 } |
186 RTC_NOTREACHED(); | 172 RTC_NOTREACHED(); |
187 return 0; | 173 return 0; |
188 } | 174 } |
189 | 175 |
190 } // namespace webrtc | 176 } // namespace webrtc |
OLD | NEW |