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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 ptr_decoder_ = NULL; | 430 ptr_decoder_ = NULL; |
431 } | 431 } |
432 DeregisterReceiveCodec(payload_type); | 432 DeregisterReceiveCodec(payload_type); |
433 delete (*it).second; | 433 delete (*it).second; |
434 dec_external_map_.erase(it); | 434 dec_external_map_.erase(it); |
435 return true; | 435 return true; |
436 } | 436 } |
437 | 437 |
438 // Add the external encoder object to the list of external decoders. | 438 // Add the external encoder object to the list of external decoders. |
439 // Won't be registered as a receive codec until RegisterReceiveCodec is called. | 439 // Won't be registered as a receive codec until RegisterReceiveCodec is called. |
440 bool VCMCodecDataBase::RegisterExternalDecoder( | 440 void VCMCodecDataBase::RegisterExternalDecoder( |
441 VideoDecoder* external_decoder, | 441 VideoDecoder* external_decoder, |
442 uint8_t payload_type, | 442 uint8_t payload_type, |
443 bool internal_render_timing) { | 443 bool internal_render_timing) { |
444 // Check if payload value already exists, if so - erase old and insert new. | 444 // Check if payload value already exists, if so - erase old and insert new. |
445 VCMExtDecoderMapItem* ext_decoder = new VCMExtDecoderMapItem( | 445 VCMExtDecoderMapItem* ext_decoder = new VCMExtDecoderMapItem( |
446 external_decoder, payload_type, internal_render_timing); | 446 external_decoder, payload_type, internal_render_timing); |
447 if (!ext_decoder) { | |
448 return false; | |
449 } | |
450 DeregisterExternalDecoder(payload_type); | 447 DeregisterExternalDecoder(payload_type); |
451 dec_external_map_[payload_type] = ext_decoder; | 448 dec_external_map_[payload_type] = ext_decoder; |
452 return true; | |
453 } | 449 } |
454 | 450 |
455 bool VCMCodecDataBase::DecoderRegistered() const { | 451 bool VCMCodecDataBase::DecoderRegistered() const { |
456 return !dec_map_.empty(); | 452 return !dec_map_.empty(); |
457 } | 453 } |
458 | 454 |
459 bool VCMCodecDataBase::RegisterReceiveCodec( | 455 bool VCMCodecDataBase::RegisterReceiveCodec( |
460 const VideoCodec* receive_codec, | 456 const VideoCodec* receive_codec, |
461 int number_of_cores, | 457 int number_of_cores, |
462 bool require_key_frame) { | 458 bool require_key_frame) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 624 |
629 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( | 625 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( |
630 uint8_t payload_type) const { | 626 uint8_t payload_type) const { |
631 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); | 627 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); |
632 if (it != dec_external_map_.end()) { | 628 if (it != dec_external_map_.end()) { |
633 return (*it).second; | 629 return (*it).second; |
634 } | 630 } |
635 return NULL; | 631 return NULL; |
636 } | 632 } |
637 } // namespace webrtc | 633 } // namespace webrtc |
OLD | NEW |