Skip to content

Commit 39e7e73

Browse files
author
Peter Boström
committed
Remove VIDEOCODEC_* from engine_configurations.h.
Removes index-based codec fetching from the VCM and overall cleans up the code. BUG=webrtc:1695 [email protected] Review URL: https://codereview.webrtc.org/1425613004 . Cr-Original-Commit-Position: refs/heads/master@{#10770} Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc Cr-Mirrored-Commit: 92f8dbde77f859449a2b9ac107bca6c9b4329897
1 parent 5025faa commit 39e7e73

File tree

8 files changed

+19
-158
lines changed

8 files changed

+19
-158
lines changed

engine_configurations.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@
1313

1414
#include "webrtc/typedefs.h"
1515

16-
// ============================================================================
17-
// Voice and Video
18-
// ============================================================================
19-
20-
// ----------------------------------------------------------------------------
21-
// [Video] Codec settings
22-
// ----------------------------------------------------------------------------
23-
24-
#define VIDEOCODEC_I420
25-
#define VIDEOCODEC_VP8
26-
#define VIDEOCODEC_VP9
27-
#define VIDEOCODEC_H264
28-
2916
// ============================================================================
3017
// VoiceEngine
3118
// ============================================================================

modules/video_coding/codec_database.cc

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,10 @@
1515
#include "webrtc/base/checks.h"
1616
#include "webrtc/base/logging.h"
1717
#include "webrtc/engine_configurations.h"
18-
#ifdef VIDEOCODEC_H264
1918
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
20-
#endif
21-
#ifdef VIDEOCODEC_I420
2219
#include "webrtc/modules/video_coding/codecs/i420/include/i420.h"
23-
#endif
24-
#ifdef VIDEOCODEC_VP8
2520
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
26-
#endif
27-
#ifdef VIDEOCODEC_VP9
2821
#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
29-
#endif
3022
#include "webrtc/modules/video_coding/internal_defines.h"
3123

3224
namespace {
@@ -123,22 +115,10 @@ VCMCodecDataBase::~VCMCodecDataBase() {
123115
ResetReceiver();
124116
}
125117

126-
int VCMCodecDataBase::NumberOfCodecs() {
127-
return VCM_NUM_VIDEO_CODECS_AVAILABLE;
128-
}
129-
130-
bool VCMCodecDataBase::Codec(int list_id,
131-
VideoCodec* settings) {
132-
if (!settings) {
133-
return false;
134-
}
135-
if (list_id >= VCM_NUM_VIDEO_CODECS_AVAILABLE) {
136-
return false;
137-
}
118+
void VCMCodecDataBase::Codec(VideoCodecType codec_type, VideoCodec* settings) {
138119
memset(settings, 0, sizeof(VideoCodec));
139-
switch (list_id) {
140-
#ifdef VIDEOCODEC_VP8
141-
case VCM_VP8_IDX: {
120+
switch (codec_type) {
121+
case kVideoCodecVP8:
142122
strncpy(settings->plName, "VP8", 4);
143123
settings->codecType = kVideoCodecVP8;
144124
// 96 to 127 dynamic payload types for video codecs.
@@ -152,11 +132,8 @@ bool VCMCodecDataBase::Codec(int list_id,
152132
settings->numberOfSimulcastStreams = 0;
153133
settings->qpMax = 56;
154134
settings->codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings();
155-
return true;
156-
}
157-
#endif
158-
#ifdef VIDEOCODEC_VP9
159-
case VCM_VP9_IDX: {
135+
return;
136+
case kVideoCodecVP9:
160137
strncpy(settings->plName, "VP9", 4);
161138
settings->codecType = kVideoCodecVP9;
162139
// 96 to 127 dynamic payload types for video codecs.
@@ -170,11 +147,8 @@ bool VCMCodecDataBase::Codec(int list_id,
170147
settings->numberOfSimulcastStreams = 0;
171148
settings->qpMax = 56;
172149
settings->codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings();
173-
return true;
174-
}
175-
#endif
176-
#ifdef VIDEOCODEC_H264
177-
case VCM_H264_IDX: {
150+
return;
151+
case kVideoCodecH264:
178152
strncpy(settings->plName, "H264", 5);
179153
settings->codecType = kVideoCodecH264;
180154
// 96 to 127 dynamic payload types for video codecs.
@@ -188,11 +162,8 @@ bool VCMCodecDataBase::Codec(int list_id,
188162
settings->numberOfSimulcastStreams = 0;
189163
settings->qpMax = 56;
190164
settings->codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings();
191-
return true;
192-
}
193-
#endif
194-
#ifdef VIDEOCODEC_I420
195-
case VCM_I420_IDX: {
165+
return;
166+
case kVideoCodecI420:
196167
strncpy(settings->plName, "I420", 5);
197168
settings->codecType = kVideoCodecI420;
198169
// 96 to 127 dynamic payload types for video codecs.
@@ -207,27 +178,14 @@ bool VCMCodecDataBase::Codec(int list_id,
207178
settings->height = VCM_DEFAULT_CODEC_HEIGHT;
208179
settings->minBitrate = VCM_MIN_BITRATE;
209180
settings->numberOfSimulcastStreams = 0;
210-
return true;
211-
}
212-
#endif
213-
default: {
214-
return false;
215-
}
216-
}
217-
}
218-
219-
bool VCMCodecDataBase::Codec(VideoCodecType codec_type,
220-
VideoCodec* settings) {
221-
for (int i = 0; i < VCMCodecDataBase::NumberOfCodecs(); i++) {
222-
const bool ret = VCMCodecDataBase::Codec(i, settings);
223-
if (!ret) {
224-
return false;
225-
}
226-
if (codec_type == settings->codecType) {
227-
return true;
228-
}
181+
return;
182+
case kVideoCodecRED:
183+
case kVideoCodecULPFEC:
184+
case kVideoCodecGeneric:
185+
case kVideoCodecUnknown:
186+
RTC_NOTREACHED();
187+
return;
229188
}
230-
return false;
231189
}
232190

233191
void VCMCodecDataBase::ResetSender() {
@@ -641,25 +599,17 @@ void VCMCodecDataBase::DeleteEncoder() {
641599

642600
VCMGenericDecoder* VCMCodecDataBase::CreateDecoder(VideoCodecType type) const {
643601
switch (type) {
644-
#ifdef VIDEOCODEC_VP8
645602
case kVideoCodecVP8:
646603
return new VCMGenericDecoder(*(VP8Decoder::Create()));
647-
#endif
648-
#ifdef VIDEOCODEC_VP9
649604
case kVideoCodecVP9:
650605
return new VCMGenericDecoder(*(VP9Decoder::Create()));
651-
#endif
652-
#ifdef VIDEOCODEC_I420
653606
case kVideoCodecI420:
654607
return new VCMGenericDecoder(*(new I420Decoder));
655-
#endif
656-
#ifdef VIDEOCODEC_H264
657608
case kVideoCodecH264:
658609
if (H264Decoder::IsSupported()) {
659610
return new VCMGenericDecoder(*(H264Decoder::Create()));
660611
}
661612
break;
662-
#endif
663613
default:
664614
break;
665615
}

modules/video_coding/codec_database.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,8 @@ class VCMCodecDataBase {
5151
~VCMCodecDataBase();
5252

5353
// Sender Side
54-
// Returns the number of supported codecs (or -1 in case of error).
55-
static int NumberOfCodecs();
56-
57-
// Returns the default settings for the codec with id |list_id|.
58-
static bool Codec(int list_id, VideoCodec* settings);
59-
6054
// Returns the default settings for the codec with type |codec_type|.
61-
static bool Codec(VideoCodecType codec_type, VideoCodec* settings);
55+
static void Codec(VideoCodecType codec_type, VideoCodec* settings);
6256

6357
void ResetSender();
6458

modules/video_coding/internal_defines.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,6 @@ inline uint32_t MaskWord64ToUWord32(int64_t w64)
3232
#define VCM_MIN_BITRATE 30
3333
#define VCM_FLUSH_INDICATOR 4
3434

35-
// Helper macros for creating the static codec list
36-
#define VCM_NO_CODEC_IDX -1
37-
#ifdef VIDEOCODEC_VP8
38-
#define VCM_VP8_IDX (VCM_NO_CODEC_IDX + 1)
39-
#else
40-
#define VCM_VP8_IDX VCM_NO_CODEC_IDX
41-
#endif
42-
#ifdef VIDEOCODEC_VP9
43-
#define VCM_VP9_IDX (VCM_VP8_IDX + 1)
44-
#else
45-
#define VCM_VP9_IDX VCM_VP8_IDX
46-
#endif
47-
#ifdef VIDEOCODEC_H264
48-
#define VCM_H264_IDX (VCM_VP9_IDX + 1)
49-
#else
50-
#define VCM_H264_IDX VCM_VP9_IDX
51-
#endif
52-
#ifdef VIDEOCODEC_I420
53-
#define VCM_I420_IDX (VCM_H264_IDX + 1)
54-
#else
55-
#define VCM_I420_IDX VCM_H264_IDX
56-
#endif
57-
#define VCM_NUM_VIDEO_CODECS_AVAILABLE (VCM_I420_IDX + 1)
58-
5935
#define VCM_NO_RECEIVER_ID 0
6036

6137
inline int32_t VCMId(const int32_t vcmId, const int32_t receiverId = 0)

modules/video_coding/main/interface/video_coding.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,6 @@ class VideoCodingModule : public Module
9292

9393
static void Destroy(VideoCodingModule* module);
9494

95-
// Get number of supported codecs
96-
//
97-
// Return value : Number of supported codecs
98-
static uint8_t NumberOfCodecs();
99-
100-
// Get supported codec settings with using id
101-
//
102-
// Input:
103-
// - listId : Id or index of the codec to look up
104-
// - codec : Memory where the codec settings will be stored
105-
//
106-
// Return value : VCM_OK, on success
107-
// VCM_PARAMETER_ERROR if codec not supported or id too high
108-
static int32_t Codec(const uint8_t listId, VideoCodec* codec);
109-
11095
// Get supported codec settings using codec type
11196
//
11297
// Input:

modules/video_coding/video_coding_impl.cc

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -309,22 +309,9 @@ class VideoCodingModuleImpl : public VideoCodingModule {
309309
};
310310
} // namespace
311311

312-
uint8_t VideoCodingModule::NumberOfCodecs() {
313-
return VCMCodecDataBase::NumberOfCodecs();
314-
}
315-
316-
int32_t VideoCodingModule::Codec(uint8_t listId, VideoCodec* codec) {
317-
if (codec == NULL) {
318-
return VCM_PARAMETER_ERROR;
319-
}
320-
return VCMCodecDataBase::Codec(listId, codec) ? 0 : -1;
321-
}
322-
323312
int32_t VideoCodingModule::Codec(VideoCodecType codecType, VideoCodec* codec) {
324-
if (codec == NULL) {
325-
return VCM_PARAMETER_ERROR;
326-
}
327-
return VCMCodecDataBase::Codec(codecType, codec) ? 0 : -1;
313+
VCMCodecDataBase::Codec(codecType, codec);
314+
return 0;
328315
}
329316

330317
VideoCodingModule* VideoCodingModule::Create(

video_engine/vie_encoder.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,9 @@ void ViEEncoder::Restart() {
191191
encoder_paused_ = false;
192192
}
193193

194-
uint8_t ViEEncoder::NumberOfCodecs() {
195-
return vcm_->NumberOfCodecs();
196-
}
197-
198-
int32_t ViEEncoder::GetCodec(uint8_t list_index, VideoCodec* video_codec) {
199-
if (vcm_->Codec(list_index, video_codec) != 0) {
200-
return -1;
201-
}
202-
return 0;
203-
}
204-
205194
int32_t ViEEncoder::RegisterExternalEncoder(webrtc::VideoEncoder* encoder,
206195
uint8_t pl_type,
207196
bool internal_source) {
208-
if (encoder == NULL)
209-
return -1;
210-
211197
if (vcm_->RegisterExternalEncoder(encoder, pl_type, internal_source) !=
212198
VCM_OK) {
213199
return -1;
@@ -403,7 +389,6 @@ void ViEEncoder::DeliverFrame(VideoFrame video_frame) {
403389
const VideoFrame* output_frame =
404390
(decimated_frame != NULL) ? decimated_frame : &video_frame;
405391

406-
#ifdef VIDEOCODEC_VP8
407392
if (codec_type == webrtc::kVideoCodecVP8) {
408393
webrtc::CodecSpecificInfo codec_specific_info;
409394
codec_specific_info.codecType = webrtc::kVideoCodecVP8;
@@ -425,7 +410,6 @@ void ViEEncoder::DeliverFrame(VideoFrame video_frame) {
425410
&codec_specific_info);
426411
return;
427412
}
428-
#endif
429413
vcm_->AddVideoFrame(*output_frame);
430414
}
431415

video_engine/vie_encoder.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ class ViEEncoder : public RtcpIntraFrameObserver,
8282
void Restart();
8383

8484
// Codec settings.
85-
uint8_t NumberOfCodecs();
86-
int32_t GetCodec(uint8_t list_index, VideoCodec* video_codec);
8785
int32_t RegisterExternalEncoder(VideoEncoder* encoder,
8886
uint8_t pl_type,
8987
bool internal_source);

0 commit comments

Comments
 (0)