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 |
158 size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) { | 172 size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) { |
159 switch (codec_type) { | 173 switch (codec_type) { |
160 case kVideoCodecVP8: | 174 case kVideoCodecVP8: |
161 case kVideoCodecVP9: | 175 case kVideoCodecVP9: |
162 return 0; | 176 return 0; |
163 case kVideoCodecH264: | 177 case kVideoCodecH264: |
164 return kBufferPaddingBytesH264; | 178 return kBufferPaddingBytesH264; |
165 case kVideoCodecI420: | 179 case kVideoCodecI420: |
166 case kVideoCodecRED: | 180 case kVideoCodecRED: |
167 case kVideoCodecULPFEC: | 181 case kVideoCodecULPFEC: |
168 case kVideoCodecGeneric: | 182 case kVideoCodecGeneric: |
169 case kVideoCodecUnknown: | 183 case kVideoCodecUnknown: |
170 return 0; | 184 return 0; |
171 } | 185 } |
172 RTC_NOTREACHED(); | 186 RTC_NOTREACHED(); |
173 return 0; | 187 return 0; |
174 } | 188 } |
175 | 189 |
176 } // namespace webrtc | 190 } // namespace webrtc |
OLD | NEW |