OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 encoder->RegisterEncodeCompleteCallback(callback); | 226 encoder->RegisterEncodeCompleteCallback(callback); |
227 streaminfos_.push_back(StreamInfo(encoder, callback, stream_codec.width, | 227 streaminfos_.push_back(StreamInfo(encoder, callback, stream_codec.width, |
228 stream_codec.height, send_stream)); | 228 stream_codec.height, send_stream)); |
229 } | 229 } |
230 return WEBRTC_VIDEO_CODEC_OK; | 230 return WEBRTC_VIDEO_CODEC_OK; |
231 } | 231 } |
232 | 232 |
233 int SimulcastEncoderAdapter::Encode( | 233 int SimulcastEncoderAdapter::Encode( |
234 const VideoFrame& input_image, | 234 const VideoFrame& input_image, |
235 const CodecSpecificInfo* codec_specific_info, | 235 const CodecSpecificInfo* codec_specific_info, |
236 const std::vector<VideoFrameType>* frame_types) { | 236 const std::vector<FrameType>* frame_types) { |
237 if (!Initialized()) { | 237 if (!Initialized()) { |
238 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 238 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
239 } | 239 } |
240 if (encoded_complete_callback_ == NULL) { | 240 if (encoded_complete_callback_ == NULL) { |
241 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 241 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
242 } | 242 } |
243 | 243 |
244 // All active streams should generate a key frame if | 244 // All active streams should generate a key frame if |
245 // a key frame is requested by any stream. | 245 // a key frame is requested by any stream. |
246 bool send_key_frame = false; | 246 bool send_key_frame = false; |
(...skipping 13 matching lines...) Expand all Loading... |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 int src_width = input_image.width(); | 263 int src_width = input_image.width(); |
264 int src_height = input_image.height(); | 264 int src_height = input_image.height(); |
265 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { | 265 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { |
266 // Don't encode frames in resolutions that we don't intend to send. | 266 // Don't encode frames in resolutions that we don't intend to send. |
267 if (!streaminfos_[stream_idx].send_stream) | 267 if (!streaminfos_[stream_idx].send_stream) |
268 continue; | 268 continue; |
269 | 269 |
270 std::vector<VideoFrameType> stream_frame_types; | 270 std::vector<FrameType> stream_frame_types; |
271 if (send_key_frame) { | 271 if (send_key_frame) { |
272 stream_frame_types.push_back(kKeyFrame); | 272 stream_frame_types.push_back(kKeyFrame); |
273 streaminfos_[stream_idx].key_frame_request = false; | 273 streaminfos_[stream_idx].key_frame_request = false; |
274 } else { | 274 } else { |
275 stream_frame_types.push_back(kDeltaFrame); | 275 stream_frame_types.push_back(kDeltaFrame); |
276 } | 276 } |
277 | 277 |
278 int dst_width = streaminfos_[stream_idx].width; | 278 int dst_width = streaminfos_[stream_idx].width; |
279 int dst_height = streaminfos_[stream_idx].height; | 279 int dst_height = streaminfos_[stream_idx].height; |
280 // If scaling isn't required, because the input resolution | 280 // If scaling isn't required, because the input resolution |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 bool SimulcastEncoderAdapter::SupportsNativeHandle() const { | 501 bool SimulcastEncoderAdapter::SupportsNativeHandle() const { |
502 // We should not be calling this method before streaminfos_ are configured. | 502 // We should not be calling this method before streaminfos_ are configured. |
503 RTC_DCHECK(!streaminfos_.empty()); | 503 RTC_DCHECK(!streaminfos_.empty()); |
504 // TODO(pbos): Support textures when using more than one encoder. | 504 // TODO(pbos): Support textures when using more than one encoder. |
505 if (streaminfos_.size() != 1) | 505 if (streaminfos_.size() != 1) |
506 return false; | 506 return false; |
507 return streaminfos_[0].encoder->SupportsNativeHandle(); | 507 return streaminfos_[0].encoder->SupportsNativeHandle(); |
508 } | 508 } |
509 | 509 |
510 } // namespace webrtc | 510 } // namespace webrtc |
OLD | NEW |