Chromium Code Reviews| 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 |
| 11 #include "webrtc/modules/video_coding/main/source/codec_database.h" | 11 #include "webrtc/modules/video_coding/main/source/codec_database.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/engine_configurations.h" | 16 #include "webrtc/engine_configurations.h" |
| 17 #ifdef VIDEOCODEC_H264 | |
| 18 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | |
| 19 #endif | |
| 17 #ifdef VIDEOCODEC_I420 | 20 #ifdef VIDEOCODEC_I420 |
| 18 #include "webrtc/modules/video_coding/codecs/i420/main/interface/i420.h" | 21 #include "webrtc/modules/video_coding/codecs/i420/main/interface/i420.h" |
| 19 #endif | 22 #endif |
| 20 #ifdef VIDEOCODEC_VP8 | 23 #ifdef VIDEOCODEC_VP8 |
| 21 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 24 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 22 #endif | 25 #endif |
| 23 #ifdef VIDEOCODEC_VP9 | 26 #ifdef VIDEOCODEC_VP9 |
| 24 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 27 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
| 25 #endif | 28 #endif |
| 26 #include "webrtc/modules/video_coding/main/source/internal_defines.h" | 29 #include "webrtc/modules/video_coding/main/source/internal_defines.h" |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 #ifdef VIDEOCODEC_VP9 | 657 #ifdef VIDEOCODEC_VP9 |
| 655 case kVideoCodecVP9: | 658 case kVideoCodecVP9: |
| 656 return new VCMGenericEncoder(VP9Encoder::Create(), encoder_rate_observer_, | 659 return new VCMGenericEncoder(VP9Encoder::Create(), encoder_rate_observer_, |
| 657 false); | 660 false); |
| 658 #endif | 661 #endif |
| 659 #ifdef VIDEOCODEC_I420 | 662 #ifdef VIDEOCODEC_I420 |
| 660 case kVideoCodecI420: | 663 case kVideoCodecI420: |
| 661 return new VCMGenericEncoder(new I420Encoder(), encoder_rate_observer_, | 664 return new VCMGenericEncoder(new I420Encoder(), encoder_rate_observer_, |
| 662 false); | 665 false); |
| 663 #endif | 666 #endif |
| 667 #ifdef VIDEOCODEC_H264 | |
| 668 case kVideoCodecH264: | |
| 669 if (IsH264CodecSupported()) { | |
|
pbos-webrtc
2015/06/25 20:20:14
H264Encoder::IsSupported()
tkchin_webrtc
2015/06/25 21:37:49
Done.
| |
| 670 return new VCMGenericEncoder(H264Encoder::Create(), | |
| 671 encoder_rate_observer_, | |
| 672 false); | |
| 673 } | |
| 674 break; | |
| 675 #endif | |
| 664 default: | 676 default: |
| 665 LOG(LS_WARNING) << "No internal encoder of this type exists."; | 677 break; |
| 666 return NULL; | |
| 667 } | 678 } |
| 679 LOG(LS_WARNING) << "No internal encoder of this type exists."; | |
| 680 return NULL; | |
| 668 } | 681 } |
| 669 | 682 |
| 670 void VCMCodecDataBase::DeleteEncoder() { | 683 void VCMCodecDataBase::DeleteEncoder() { |
| 671 if (ptr_encoder_) { | 684 if (ptr_encoder_) { |
| 672 ptr_encoder_->Release(); | 685 ptr_encoder_->Release(); |
| 673 if (!current_enc_is_external_) | 686 if (!current_enc_is_external_) |
| 674 delete ptr_encoder_->encoder_; | 687 delete ptr_encoder_->encoder_; |
| 675 delete ptr_encoder_; | 688 delete ptr_encoder_; |
| 676 ptr_encoder_ = NULL; | 689 ptr_encoder_ = NULL; |
| 677 } | 690 } |
| 678 } | 691 } |
| 679 | 692 |
| 680 VCMGenericDecoder* VCMCodecDataBase::CreateDecoder(VideoCodecType type) const { | 693 VCMGenericDecoder* VCMCodecDataBase::CreateDecoder(VideoCodecType type) const { |
| 681 switch (type) { | 694 switch (type) { |
| 682 #ifdef VIDEOCODEC_VP8 | 695 #ifdef VIDEOCODEC_VP8 |
| 683 case kVideoCodecVP8: | 696 case kVideoCodecVP8: |
| 684 return new VCMGenericDecoder(*(VP8Decoder::Create())); | 697 return new VCMGenericDecoder(*(VP8Decoder::Create())); |
| 685 #endif | 698 #endif |
| 686 #ifdef VIDEOCODEC_VP9 | 699 #ifdef VIDEOCODEC_VP9 |
| 687 case kVideoCodecVP9: | 700 case kVideoCodecVP9: |
| 688 return new VCMGenericDecoder(*(VP9Decoder::Create())); | 701 return new VCMGenericDecoder(*(VP9Decoder::Create())); |
| 689 #endif | 702 #endif |
| 690 #ifdef VIDEOCODEC_I420 | 703 #ifdef VIDEOCODEC_I420 |
| 691 case kVideoCodecI420: | 704 case kVideoCodecI420: |
| 692 return new VCMGenericDecoder(*(new I420Decoder)); | 705 return new VCMGenericDecoder(*(new I420Decoder)); |
| 693 #endif | 706 #endif |
| 707 #ifdef VIDEOCODEC_H264 | |
| 708 case kVideoCodecH264: | |
| 709 if (IsH264CodecSupported()) { | |
|
pbos-webrtc
2015/06/25 20:20:14
H264Decoder::IsSupported()
tkchin_webrtc
2015/06/25 21:37:49
Done.
| |
| 710 return new VCMGenericDecoder(*(H264Decoder::Create())); | |
| 711 } | |
| 712 break; | |
| 713 #endif | |
| 694 default: | 714 default: |
| 695 LOG(LS_WARNING) << "No internal decoder of this type exists."; | 715 break; |
| 696 return NULL; | |
| 697 } | 716 } |
| 717 LOG(LS_WARNING) << "No internal decoder of this type exists."; | |
| 718 return NULL; | |
| 698 } | 719 } |
| 699 | 720 |
| 700 const VCMDecoderMapItem* VCMCodecDataBase::FindDecoderItem( | 721 const VCMDecoderMapItem* VCMCodecDataBase::FindDecoderItem( |
| 701 uint8_t payload_type) const { | 722 uint8_t payload_type) const { |
| 702 DecoderMap::const_iterator it = dec_map_.find(payload_type); | 723 DecoderMap::const_iterator it = dec_map_.find(payload_type); |
| 703 if (it != dec_map_.end()) { | 724 if (it != dec_map_.end()) { |
| 704 return (*it).second; | 725 return (*it).second; |
| 705 } | 726 } |
| 706 return NULL; | 727 return NULL; |
| 707 } | 728 } |
| 708 | 729 |
| 709 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( | 730 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( |
| 710 uint8_t payload_type) const { | 731 uint8_t payload_type) const { |
| 711 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); | 732 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); |
| 712 if (it != dec_external_map_.end()) { | 733 if (it != dec_external_map_.end()) { |
| 713 return (*it).second; | 734 return (*it).second; |
| 714 } | 735 } |
| 715 return NULL; | 736 return NULL; |
| 716 } | 737 } |
| 717 } // namespace webrtc | 738 } // namespace webrtc |
| OLD | NEW |