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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (new_send_codec.startBitrate > new_send_codec.maxBitrate) | 231 if (new_send_codec.startBitrate > new_send_codec.maxBitrate) |
232 new_send_codec.startBitrate = new_send_codec.maxBitrate; | 232 new_send_codec.startBitrate = new_send_codec.maxBitrate; |
233 | 233 |
234 if (!reset_required) { | 234 if (!reset_required) { |
235 reset_required = RequiresEncoderReset(new_send_codec); | 235 reset_required = RequiresEncoderReset(new_send_codec); |
236 } | 236 } |
237 | 237 |
238 memcpy(&send_codec_, &new_send_codec, sizeof(send_codec_)); | 238 memcpy(&send_codec_, &new_send_codec, sizeof(send_codec_)); |
239 | 239 |
240 if (!reset_required) { | 240 if (!reset_required) { |
241 encoded_frame_callback_->SetPayloadType(send_codec_.plType); | |
242 return true; | 241 return true; |
243 } | 242 } |
244 | 243 |
245 // If encoder exists, will destroy it and create new one. | 244 // If encoder exists, will destroy it and create new one. |
246 DeleteEncoder(); | 245 DeleteEncoder(); |
247 RTC_DCHECK_EQ(encoder_payload_type_, send_codec_.plType) | 246 RTC_DCHECK_EQ(encoder_payload_type_, send_codec_.plType) |
248 << "Encoder not registered for payload type " << send_codec_.plType; | 247 << "Encoder not registered for payload type " << send_codec_.plType; |
249 ptr_encoder_.reset( | 248 ptr_encoder_.reset( |
250 new VCMGenericEncoder(external_encoder_, encoder_rate_observer_, | 249 new VCMGenericEncoder(external_encoder_, encoder_rate_observer_, |
251 encoded_frame_callback_, internal_source_)); | 250 encoded_frame_callback_, internal_source_)); |
252 encoded_frame_callback_->SetPayloadType(send_codec_.plType); | |
253 encoded_frame_callback_->SetInternalSource(internal_source_); | 251 encoded_frame_callback_->SetInternalSource(internal_source_); |
254 if (ptr_encoder_->InitEncode(&send_codec_, number_of_cores_, | 252 if (ptr_encoder_->InitEncode(&send_codec_, number_of_cores_, |
255 max_payload_size_) < 0) { | 253 max_payload_size_) < 0) { |
256 LOG(LS_ERROR) << "Failed to initialize video encoder."; | 254 LOG(LS_ERROR) << "Failed to initialize video encoder."; |
257 DeleteEncoder(); | 255 DeleteEncoder(); |
258 return false; | 256 return false; |
259 } | 257 } |
260 | 258 |
261 // Intentionally don't check return value since the encoder registration | 259 // Intentionally don't check return value since the encoder registration |
262 // shouldn't fail because the codec doesn't support changing the periodic key | 260 // shouldn't fail because the codec doesn't support changing the periodic key |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 606 |
609 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( | 607 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( |
610 uint8_t payload_type) const { | 608 uint8_t payload_type) const { |
611 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); | 609 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); |
612 if (it != dec_external_map_.end()) { | 610 if (it != dec_external_map_.end()) { |
613 return (*it).second; | 611 return (*it).second; |
614 } | 612 } |
615 return nullptr; | 613 return nullptr; |
616 } | 614 } |
617 } // namespace webrtc | 615 } // namespace webrtc |
OLD | NEW |