Unify VideoCodecType to/from string functionality

BUG=None

Review-Url: https://codereview.webrtc.org/2509273002
Cr-Commit-Position: refs/heads/master@{#15200}
This commit is contained in:
magjed
2016-11-22 10:16:57 -08:00
committed by Commit bot
parent 2d60e53ad5
commit 10165ab8e7
13 changed files with 58 additions and 105 deletions

View File

@ -403,24 +403,6 @@ const char* ExcludeFrameTypesToStr(ExcludeFrameTypes e) {
}
}
const char* VideoCodecTypeToStr(webrtc::VideoCodecType e) {
switch (e) {
case kVideoCodecVP8:
return "VP8";
case kVideoCodecI420:
return "I420";
case kVideoCodecRED:
return "RED";
case kVideoCodecULPFEC:
return "ULPFEC";
case kVideoCodecUnknown:
return "Unknown";
default:
RTC_NOTREACHED();
return "Unknown";
}
}
// Callbacks
EncodedImageCallback::Result
VideoProcessorImpl::VideoProcessorEncodeCompleteCallback::OnEncodedImage(

View File

@ -108,9 +108,6 @@ struct TestConfig {
bool verbose;
};
// Returns a string representation of the enum value.
const char* VideoCodecTypeToStr(webrtc::VideoCodecType e);
// Handles encoding/decoding of video using the VideoEncoder/VideoDecoder
// interfaces. This is done in a sequential manner in order to be able to
// measure times properly.

View File

@ -412,7 +412,8 @@ void PrintPythonOutput(const webrtc::test::TestConfig& config,
ExcludeFrameTypesToStr(config.exclude_frame_types),
config.frame_length_in_bytes, config.use_single_core ? "True " : "False",
config.keyframe_interval,
webrtc::test::VideoCodecTypeToStr(config.codec_settings->codecType),
CodecTypeToPayloadName(config.codec_settings->codecType)
.value_or("Unknown"),
config.codec_settings->width, config.codec_settings->height,
config.codec_settings->startBitrate);
printf(

View File

@ -122,20 +122,8 @@ bool IvfFileWriter::InitFromFirstFrame(const EncodedImage& encoded_image,
if (!WriteHeader())
return false;
std::string codec_name;
switch (codec_type_) {
case kVideoCodecVP8:
codec_name = "VP8";
break;
case kVideoCodecVP9:
codec_name = "VP9";
break;
case kVideoCodecH264:
codec_name = "H264";
break;
default:
codec_name = "Unknown";
}
const char* codec_name =
CodecTypeToPayloadName(codec_type_).value_or("Unknown");
LOG(LS_WARNING) << "Created IVF file for codec data of type " << codec_name
<< " at resolution " << width_ << " x " << height_
<< ", using " << (using_capture_timestamps_ ? "1" : "90")