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/codec_database.h" | 11 #include "webrtc/modules/video_coding/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/base/logging.h" | 16 #include "webrtc/base/logging.h" |
17 #include "webrtc/engine_configurations.h" | 17 #include "webrtc/engine_configurations.h" |
18 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 18 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
19 #include "webrtc/modules/video_coding/codecs/i420/include/i420.h" | |
20 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
21 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 20 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
22 #include "webrtc/modules/video_coding/internal_defines.h" | 21 #include "webrtc/modules/video_coding/internal_defines.h" |
23 | 22 |
24 namespace { | 23 namespace { |
25 const size_t kDefaultPayloadSize = 1440; | 24 const size_t kDefaultPayloadSize = 1440; |
26 const uint8_t kDefaultPayloadType = 100; | 25 const uint8_t kDefaultPayloadType = 100; |
27 } | 26 } |
28 | 27 |
29 namespace webrtc { | 28 namespace webrtc { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 settings->minBitrate = VCM_MIN_BITRATE; | 157 settings->minBitrate = VCM_MIN_BITRATE; |
159 settings->maxBitrate = 0; | 158 settings->maxBitrate = 0; |
160 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE; | 159 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE; |
161 settings->width = VCM_DEFAULT_CODEC_WIDTH; | 160 settings->width = VCM_DEFAULT_CODEC_WIDTH; |
162 settings->height = VCM_DEFAULT_CODEC_HEIGHT; | 161 settings->height = VCM_DEFAULT_CODEC_HEIGHT; |
163 settings->numberOfSimulcastStreams = 0; | 162 settings->numberOfSimulcastStreams = 0; |
164 settings->qpMax = 56; | 163 settings->qpMax = 56; |
165 settings->codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); | 164 settings->codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings(); |
166 return; | 165 return; |
167 case kVideoCodecI420: | 166 case kVideoCodecI420: |
168 strncpy(settings->plName, "I420", 5); | |
169 settings->codecType = kVideoCodecI420; | |
170 // 96 to 127 dynamic payload types for video codecs. | |
171 settings->plType = kDefaultPayloadType; | |
172 // Bitrate needed for this size and framerate. | |
173 settings->startBitrate = 3 * VCM_DEFAULT_CODEC_WIDTH * | |
174 VCM_DEFAULT_CODEC_HEIGHT * 8 * | |
175 VCM_DEFAULT_FRAME_RATE / 1000 / 2; | |
176 settings->maxBitrate = settings->startBitrate; | |
177 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE; | |
178 settings->width = VCM_DEFAULT_CODEC_WIDTH; | |
179 settings->height = VCM_DEFAULT_CODEC_HEIGHT; | |
180 settings->minBitrate = VCM_MIN_BITRATE; | |
181 settings->numberOfSimulcastStreams = 0; | |
182 return; | |
183 case kVideoCodecRED: | 167 case kVideoCodecRED: |
184 case kVideoCodecULPFEC: | 168 case kVideoCodecULPFEC: |
185 case kVideoCodecGeneric: | 169 case kVideoCodecGeneric: |
186 case kVideoCodecUnknown: | 170 case kVideoCodecUnknown: |
187 RTC_NOTREACHED(); | 171 RTC_NOTREACHED(); |
188 return; | 172 return; |
189 } | 173 } |
190 } | 174 } |
191 | 175 |
192 // Assuming only one registered encoder - since only one used, no need for more. | 176 // Assuming only one registered encoder - since only one used, no need for more. |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 ptr_encoder_->Release(); | 560 ptr_encoder_->Release(); |
577 ptr_encoder_.reset(); | 561 ptr_encoder_.reset(); |
578 } | 562 } |
579 | 563 |
580 VCMGenericDecoder* VCMCodecDataBase::CreateDecoder(VideoCodecType type) const { | 564 VCMGenericDecoder* VCMCodecDataBase::CreateDecoder(VideoCodecType type) const { |
581 switch (type) { | 565 switch (type) { |
582 case kVideoCodecVP8: | 566 case kVideoCodecVP8: |
583 return new VCMGenericDecoder(VP8Decoder::Create()); | 567 return new VCMGenericDecoder(VP8Decoder::Create()); |
584 case kVideoCodecVP9: | 568 case kVideoCodecVP9: |
585 return new VCMGenericDecoder(VP9Decoder::Create()); | 569 return new VCMGenericDecoder(VP9Decoder::Create()); |
586 case kVideoCodecI420: | |
587 return new VCMGenericDecoder(new I420Decoder()); | |
588 case kVideoCodecH264: | 570 case kVideoCodecH264: |
589 if (H264Decoder::IsSupported()) { | 571 if (H264Decoder::IsSupported()) { |
590 return new VCMGenericDecoder(H264Decoder::Create()); | 572 return new VCMGenericDecoder(H264Decoder::Create()); |
591 } | 573 } |
592 break; | 574 break; |
593 default: | 575 default: |
594 break; | 576 break; |
595 } | 577 } |
596 LOG(LS_WARNING) << "No internal decoder of this type exists."; | 578 LOG(LS_WARNING) << "No internal decoder of this type exists."; |
597 return nullptr; | 579 return nullptr; |
(...skipping 10 matching lines...) Expand all Loading... |
608 | 590 |
609 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( | 591 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( |
610 uint8_t payload_type) const { | 592 uint8_t payload_type) const { |
611 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); | 593 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); |
612 if (it != dec_external_map_.end()) { | 594 if (it != dec_external_map_.end()) { |
613 return (*it).second; | 595 return (*it).second; |
614 } | 596 } |
615 return nullptr; | 597 return nullptr; |
616 } | 598 } |
617 } // namespace webrtc | 599 } // namespace webrtc |
OLD | NEW |