Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1073)

Side by Side Diff: webrtc/modules/video_coding/codec_database.cc

Issue 2993923002: Removing VCMCodecDataBase::Codec and VideoCodingModule::Codec. (Closed)
Patch Set: Remove deprate - let sprang handle when method is removed Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "webrtc/modules/video_coding/codecs/h264/include/h264.h" 13 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
14 #include "webrtc/modules/video_coding/codecs/i420/include/i420.h" 14 #include "webrtc/modules/video_coding/codecs/i420/include/i420.h"
15 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 15 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
16 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" 16 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
17 #include "webrtc/modules/video_coding/internal_defines.h" 17 #include "webrtc/modules/video_coding/internal_defines.h"
18 #include "webrtc/rtc_base/checks.h" 18 #include "webrtc/rtc_base/checks.h"
19 #include "webrtc/rtc_base/logging.h" 19 #include "webrtc/rtc_base/logging.h"
20 20
21 namespace { 21 namespace {
22 const size_t kDefaultPayloadSize = 1440; 22 const size_t kDefaultPayloadSize = 1440;
23 const uint8_t kDefaultPayloadType = 100;
24 } 23 }
25 24
26 namespace webrtc { 25 namespace webrtc {
27 26
28 VideoCodecVP8 VideoEncoder::GetDefaultVp8Settings() {
29 VideoCodecVP8 vp8_settings;
30 memset(&vp8_settings, 0, sizeof(vp8_settings));
31
32 vp8_settings.resilience = kResilientStream;
33 vp8_settings.numberOfTemporalLayers = 1;
34 vp8_settings.denoisingOn = true;
35 vp8_settings.errorConcealmentOn = false;
36 vp8_settings.automaticResizeOn = false;
37 vp8_settings.frameDroppingOn = true;
38 vp8_settings.keyFrameInterval = 3000;
39
40 return vp8_settings;
41 }
42
43 VideoCodecVP9 VideoEncoder::GetDefaultVp9Settings() {
44 VideoCodecVP9 vp9_settings;
45 memset(&vp9_settings, 0, sizeof(vp9_settings));
46
47 vp9_settings.resilienceOn = true;
48 vp9_settings.numberOfTemporalLayers = 1;
49 vp9_settings.denoisingOn = true;
50 vp9_settings.frameDroppingOn = true;
51 vp9_settings.keyFrameInterval = 3000;
52 vp9_settings.adaptiveQpMode = true;
53 vp9_settings.automaticResizeOn = true;
54 vp9_settings.numberOfSpatialLayers = 1;
55 vp9_settings.flexibleMode = false;
56 return vp9_settings;
57 }
58
59 VideoCodecH264 VideoEncoder::GetDefaultH264Settings() {
60 VideoCodecH264 h264_settings;
61 memset(&h264_settings, 0, sizeof(h264_settings));
62
63 h264_settings.frameDroppingOn = true;
64 h264_settings.keyFrameInterval = 3000;
65 h264_settings.spsData = nullptr;
66 h264_settings.spsLen = 0;
67 h264_settings.ppsData = nullptr;
68 h264_settings.ppsLen = 0;
69 h264_settings.profile = H264::kProfileConstrainedBaseline;
70
71 return h264_settings;
72 }
73
74 // Create an internal Decoder given a codec type 27 // Create an internal Decoder given a codec type
75 static std::unique_ptr<VCMGenericDecoder> CreateDecoder(VideoCodecType type) { 28 static std::unique_ptr<VCMGenericDecoder> CreateDecoder(VideoCodecType type) {
76 switch (type) { 29 switch (type) {
77 case kVideoCodecVP8: 30 case kVideoCodecVP8:
78 return std::unique_ptr<VCMGenericDecoder>( 31 return std::unique_ptr<VCMGenericDecoder>(
79 new VCMGenericDecoder(VP8Decoder::Create())); 32 new VCMGenericDecoder(VP8Decoder::Create()));
80 case kVideoCodecVP9: 33 case kVideoCodecVP9:
81 return std::unique_ptr<VCMGenericDecoder>( 34 return std::unique_ptr<VCMGenericDecoder>(
82 new VCMGenericDecoder(VP9Decoder::Create())); 35 new VCMGenericDecoder(VP9Decoder::Create()));
83 case kVideoCodecI420: 36 case kVideoCodecI420:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 81
129 VCMCodecDataBase::~VCMCodecDataBase() { 82 VCMCodecDataBase::~VCMCodecDataBase() {
130 DeleteEncoder(); 83 DeleteEncoder();
131 ptr_decoder_.reset(); 84 ptr_decoder_.reset();
132 for (auto& kv : dec_map_) 85 for (auto& kv : dec_map_)
133 delete kv.second; 86 delete kv.second;
134 for (auto& kv : dec_external_map_) 87 for (auto& kv : dec_external_map_)
135 delete kv.second; 88 delete kv.second;
136 } 89 }
137 90
138 void VCMCodecDataBase::Codec(VideoCodecType codec_type, VideoCodec* settings) {
139 memset(settings, 0, sizeof(VideoCodec));
140 switch (codec_type) {
141 case kVideoCodecVP8:
142 strncpy(settings->plName, "VP8", 4);
143 settings->codecType = kVideoCodecVP8;
144 // 96 to 127 dynamic payload types for video codecs.
145 settings->plType = kDefaultPayloadType;
146 settings->startBitrate = kDefaultStartBitrateKbps;
147 settings->minBitrate = VCM_MIN_BITRATE;
148 settings->maxBitrate = 0;
149 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE;
150 settings->width = VCM_DEFAULT_CODEC_WIDTH;
151 settings->height = VCM_DEFAULT_CODEC_HEIGHT;
152 settings->numberOfSimulcastStreams = 0;
153 settings->qpMax = 56;
154 settings->timing_frame_thresholds = {
155 kDefaultTimingFramesDelayMs, kDefaultOutlierFrameSizePercent,
156 };
157 *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings();
158 return;
159 case kVideoCodecVP9:
160 strncpy(settings->plName, "VP9", 4);
161 settings->codecType = kVideoCodecVP9;
162 // 96 to 127 dynamic payload types for video codecs.
163 settings->plType = kDefaultPayloadType;
164 settings->startBitrate = 100;
165 settings->minBitrate = VCM_MIN_BITRATE;
166 settings->maxBitrate = 0;
167 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE;
168 settings->width = VCM_DEFAULT_CODEC_WIDTH;
169 settings->height = VCM_DEFAULT_CODEC_HEIGHT;
170 settings->numberOfSimulcastStreams = 0;
171 settings->qpMax = 56;
172 settings->timing_frame_thresholds = {
173 kDefaultTimingFramesDelayMs, kDefaultOutlierFrameSizePercent,
174 };
175 *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings();
176 return;
177 case kVideoCodecH264:
178 strncpy(settings->plName, "H264", 5);
179 settings->codecType = kVideoCodecH264;
180 // 96 to 127 dynamic payload types for video codecs.
181 settings->plType = kDefaultPayloadType;
182 settings->startBitrate = kDefaultStartBitrateKbps;
183 settings->minBitrate = VCM_MIN_BITRATE;
184 settings->maxBitrate = 0;
185 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE;
186 settings->width = VCM_DEFAULT_CODEC_WIDTH;
187 settings->height = VCM_DEFAULT_CODEC_HEIGHT;
188 settings->numberOfSimulcastStreams = 0;
189 settings->qpMax = 56;
190 settings->timing_frame_thresholds = {
191 kDefaultTimingFramesDelayMs, kDefaultOutlierFrameSizePercent,
192 };
193 *(settings->H264()) = VideoEncoder::GetDefaultH264Settings();
194 return;
195 case kVideoCodecI420:
196 strncpy(settings->plName, "I420", 5);
197 settings->codecType = kVideoCodecI420;
198 // 96 to 127 dynamic payload types for video codecs.
199 settings->plType = kDefaultPayloadType;
200 // Bitrate needed for this size and framerate.
201 settings->startBitrate = 3 * VCM_DEFAULT_CODEC_WIDTH *
202 VCM_DEFAULT_CODEC_HEIGHT * 8 *
203 VCM_DEFAULT_FRAME_RATE / 1000 / 2;
204 settings->maxBitrate = settings->startBitrate;
205 settings->maxFramerate = VCM_DEFAULT_FRAME_RATE;
206 settings->width = VCM_DEFAULT_CODEC_WIDTH;
207 settings->height = VCM_DEFAULT_CODEC_HEIGHT;
208 settings->minBitrate = VCM_MIN_BITRATE;
209 settings->numberOfSimulcastStreams = 0;
210 return;
211 case kVideoCodecRED:
212 case kVideoCodecULPFEC:
213 case kVideoCodecFlexfec:
214 case kVideoCodecGeneric:
215 case kVideoCodecUnknown:
216 RTC_NOTREACHED();
217 return;
218 }
219 }
220
221 // Assuming only one registered encoder - since only one used, no need for more. 91 // Assuming only one registered encoder - since only one used, no need for more.
222 bool VCMCodecDataBase::SetSendCodec(const VideoCodec* send_codec, 92 bool VCMCodecDataBase::SetSendCodec(const VideoCodec* send_codec,
223 int number_of_cores, 93 int number_of_cores,
224 size_t max_payload_size) { 94 size_t max_payload_size) {
225 RTC_DCHECK(send_codec); 95 RTC_DCHECK(send_codec);
226 if (max_payload_size == 0) { 96 if (max_payload_size == 0) {
227 max_payload_size = kDefaultPayloadSize; 97 max_payload_size = kDefaultPayloadSize;
228 } 98 }
229 RTC_DCHECK_GE(number_of_cores, 1); 99 RTC_DCHECK_GE(number_of_cores, 1);
230 RTC_DCHECK_GE(send_codec->plType, 1); 100 RTC_DCHECK_GE(send_codec->plType, 1);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 453
584 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem( 454 const VCMExtDecoderMapItem* VCMCodecDataBase::FindExternalDecoderItem(
585 uint8_t payload_type) const { 455 uint8_t payload_type) const {
586 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type); 456 ExternalDecoderMap::const_iterator it = dec_external_map_.find(payload_type);
587 if (it != dec_external_map_.end()) { 457 if (it != dec_external_map_.end()) {
588 return (*it).second; 458 return (*it).second;
589 } 459 }
590 return nullptr; 460 return nullptr;
591 } 461 }
592 } // namespace webrtc 462 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codec_database.h ('k') | webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698