Remove kVideoCodecUnknown from WebRTC.
There is no difference between how we handle "generic" and "unkown" codecs, so we don't need to represent both. Bug: webrtc:8136 Change-Id: I42b0dbc8a0bae67cc21742303c963c8dd5bde1f6 Reviewed-on: https://webrtc-review.googlesource.com/92086 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24316}
This commit is contained in:
committed by
Commit Bot
parent
fa2b2d62d7
commit
84ccb2de77
@ -62,7 +62,7 @@ bool SpatialLayer::operator==(const SpatialLayer& other) const {
|
||||
}
|
||||
|
||||
VideoCodec::VideoCodec()
|
||||
: codecType(kVideoCodecUnknown),
|
||||
: codecType(kVideoCodecGeneric),
|
||||
plType(0),
|
||||
width(0),
|
||||
height(0),
|
||||
@ -133,12 +133,9 @@ const char* CodecTypeToPayloadString(VideoCodecType type) {
|
||||
case kVideoCodecI420:
|
||||
return kPayloadNameI420;
|
||||
// Other codecs default to generic.
|
||||
case kVideoCodecMultiplex:
|
||||
case kVideoCodecGeneric:
|
||||
case kVideoCodecUnknown:
|
||||
default:
|
||||
return kPayloadNameGeneric;
|
||||
}
|
||||
return kPayloadNameGeneric;
|
||||
}
|
||||
|
||||
VideoCodecType PayloadStringToCodecType(const std::string& name) {
|
||||
|
||||
@ -47,7 +47,7 @@ std::string VideoStream::ToString() const {
|
||||
}
|
||||
|
||||
VideoEncoderConfig::VideoEncoderConfig()
|
||||
: codec_type(kVideoCodecUnknown),
|
||||
: codec_type(kVideoCodecGeneric),
|
||||
video_format("Unset"),
|
||||
content_type(ContentType::kRealtimeVideo),
|
||||
encoder_specific_settings(nullptr),
|
||||
|
||||
@ -333,17 +333,18 @@ enum Profile {
|
||||
// Video codec types
|
||||
enum VideoCodecType {
|
||||
// There are various memset(..., 0, ...) calls in the code that rely on
|
||||
// kVideoCodecUnknown being zero.
|
||||
kVideoCodecUnknown = 0,
|
||||
// kVideoCodecGeneric being zero.
|
||||
kVideoCodecGeneric = 0,
|
||||
kVideoCodecVP8,
|
||||
kVideoCodecVP9,
|
||||
kVideoCodecH264,
|
||||
kVideoCodecI420,
|
||||
kVideoCodecGeneric,
|
||||
kVideoCodecMultiplex,
|
||||
// DEPRECATED. Do not use.
|
||||
kVideoCodecUnknown,
|
||||
|
||||
// TODO(nisse): Deprecated aliases, for code expecting RtpVideoCodecTypes.
|
||||
kRtpVideoNone = kVideoCodecUnknown,
|
||||
kRtpVideoNone = kVideoCodecGeneric,
|
||||
kRtpVideoGeneric = kVideoCodecGeneric,
|
||||
kRtpVideoVp8 = kVideoCodecVP8,
|
||||
kRtpVideoVp9 = kVideoCodecVP9,
|
||||
|
||||
@ -25,19 +25,11 @@ const size_t EncodedImage::kBufferPaddingBytesH264 = 8;
|
||||
|
||||
size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) {
|
||||
switch (codec_type) {
|
||||
case kVideoCodecVP8:
|
||||
case kVideoCodecVP9:
|
||||
return 0;
|
||||
case kVideoCodecH264:
|
||||
return kBufferPaddingBytesH264;
|
||||
case kVideoCodecI420:
|
||||
case kVideoCodecGeneric:
|
||||
case kVideoCodecMultiplex:
|
||||
case kVideoCodecUnknown:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
EncodedImage::EncodedImage() : EncodedImage(nullptr, 0, 0) {}
|
||||
|
||||
@ -81,9 +81,6 @@ bool VCMDecoderDataBase::RegisterReceiveCodec(const VideoCodec* receive_codec,
|
||||
}
|
||||
// If payload value already exists, erase old and insert new.
|
||||
DeregisterReceiveCodec(receive_codec->plType);
|
||||
if (receive_codec->codecType == kVideoCodecUnknown) {
|
||||
return false;
|
||||
}
|
||||
VideoCodec* new_receive_codec = new VideoCodec(*receive_codec);
|
||||
dec_map_[receive_codec->plType] = new VCMDecoderMapItem(
|
||||
new_receive_codec, number_of_cores, require_key_frame);
|
||||
|
||||
@ -17,9 +17,9 @@ VCMEncodedFrame::VCMEncodedFrame()
|
||||
_renderTimeMs(-1),
|
||||
_payloadType(0),
|
||||
_missingFrame(false),
|
||||
_codec(kVideoCodecUnknown),
|
||||
_codec(kVideoCodecGeneric),
|
||||
_rotation_set(false) {
|
||||
_codecSpecificInfo.codecType = kVideoCodecUnknown;
|
||||
_codecSpecificInfo.codecType = kVideoCodecGeneric;
|
||||
}
|
||||
|
||||
VCMEncodedFrame::~VCMEncodedFrame() {
|
||||
@ -44,8 +44,8 @@ void VCMEncodedFrame::Reset() {
|
||||
_completeFrame = false;
|
||||
_missingFrame = false;
|
||||
_length = 0;
|
||||
_codecSpecificInfo.codecType = kVideoCodecUnknown;
|
||||
_codec = kVideoCodecUnknown;
|
||||
_codecSpecificInfo.codecType = kVideoCodecGeneric;
|
||||
_codec = kVideoCodecGeneric;
|
||||
rotation_ = kVideoRotation_0;
|
||||
content_type_ = VideoContentType::UNSPECIFIED;
|
||||
timing_.flags = VideoSendTiming::kInvalid;
|
||||
@ -138,7 +138,7 @@ void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
_codecSpecificInfo.codecType = kVideoCodecUnknown;
|
||||
_codecSpecificInfo.codecType = kVideoCodecGeneric;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,6 @@ bool VCMEncoderDataBase::SetSendCodec(const VideoCodec* send_codec,
|
||||
RTC_DCHECK_GE(number_of_cores, 1);
|
||||
// Make sure the start bit rate is sane...
|
||||
RTC_DCHECK_LE(send_codec->startBitrate, 1000000);
|
||||
RTC_DCHECK(send_codec->codecType != kVideoCodecUnknown);
|
||||
bool reset_required = pending_encoder_reset_;
|
||||
if (number_of_cores_ != number_of_cores) {
|
||||
number_of_cores_ = number_of_cores;
|
||||
@ -155,15 +154,8 @@ bool VCMEncoderDataBase::RequiresEncoderReset(
|
||||
}
|
||||
break;
|
||||
|
||||
case kVideoCodecGeneric:
|
||||
default:
|
||||
break;
|
||||
// Known codecs without payload-specifics
|
||||
case kVideoCodecI420:
|
||||
case kVideoCodecMultiplex:
|
||||
break;
|
||||
// Unknown codec type, reset just to be sure.
|
||||
case kVideoCodecUnknown:
|
||||
return true;
|
||||
}
|
||||
|
||||
for (unsigned char i = 0; i < new_send_codec.numberOfSimulcastStreams; ++i) {
|
||||
|
||||
@ -188,7 +188,7 @@ VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal)
|
||||
_frameInfos(),
|
||||
_nextFrameInfoIdx(0),
|
||||
decoder_(decoder),
|
||||
_codecType(kVideoCodecUnknown),
|
||||
_codecType(kVideoCodecGeneric),
|
||||
_isExternal(isExternal),
|
||||
_last_keyframe_content_type(VideoContentType::UNSPECIFIED) {
|
||||
RTC_DCHECK(decoder_);
|
||||
|
||||
@ -43,7 +43,7 @@ VCMGenericEncoder::VCMGenericEncoder(
|
||||
internal_source_(internal_source),
|
||||
encoder_params_({VideoBitrateAllocation(), 0, 0, 0}),
|
||||
streams_or_svc_num_(0),
|
||||
codec_type_(VideoCodecType::kVideoCodecUnknown) {}
|
||||
codec_type_(VideoCodecType::kVideoCodecGeneric) {}
|
||||
|
||||
VCMGenericEncoder::~VCMGenericEncoder() {}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ union CodecSpecificInfoUnion {
|
||||
// must be fitted with a copy-constructor. This is because it is copied
|
||||
// in the copy-constructor of VCMEncodedFrame.
|
||||
struct CodecSpecificInfo {
|
||||
CodecSpecificInfo() : codecType(kVideoCodecUnknown), codec_name(nullptr) {
|
||||
CodecSpecificInfo() : codecType(kVideoCodecGeneric), codec_name(nullptr) {
|
||||
memset(&codecSpecific, 0, sizeof(codecSpecific));
|
||||
}
|
||||
VideoCodecType codecType;
|
||||
|
||||
@ -26,7 +26,7 @@ VCMPacket::VCMPacket()
|
||||
markerBit(false),
|
||||
timesNacked(-1),
|
||||
frameType(kEmptyFrame),
|
||||
codec(kVideoCodecUnknown),
|
||||
codec(kVideoCodecGeneric),
|
||||
is_first_packet_in_frame(false),
|
||||
completeNALU(kNaluUnset),
|
||||
insertStartCode(false),
|
||||
|
||||
@ -88,21 +88,9 @@ RtpFrameReferenceFinder::ManageFrameInternal(RtpFrameObject* frame) {
|
||||
return ManageFrameVp8(frame);
|
||||
case kVideoCodecVP9:
|
||||
return ManageFrameVp9(frame);
|
||||
// Since the EndToEndTests use kVicdeoCodecUnknow we treat it the same as
|
||||
// kVideoCodecGeneric.
|
||||
// TODO(philipel): Take a look at the EndToEndTests and see if maybe they
|
||||
// should be changed to use kVideoCodecGeneric instead.
|
||||
case kVideoCodecUnknown:
|
||||
case kVideoCodecH264:
|
||||
case kVideoCodecI420:
|
||||
case kVideoCodecMultiplex:
|
||||
case kVideoCodecGeneric:
|
||||
default:
|
||||
return ManageFrameGeneric(frame, kNoPictureId);
|
||||
}
|
||||
|
||||
// If not all code paths return a value it makes the win compiler sad.
|
||||
RTC_NOTREACHED();
|
||||
return kDrop;
|
||||
}
|
||||
|
||||
void RtpFrameReferenceFinder::PaddingReceived(uint16_t seq_num) {
|
||||
|
||||
@ -25,7 +25,7 @@ namespace webrtc {
|
||||
const size_t kIvfHeaderSize = 32;
|
||||
|
||||
IvfFileWriter::IvfFileWriter(rtc::File file, size_t byte_limit)
|
||||
: codec_type_(kVideoCodecUnknown),
|
||||
: codec_type_(kVideoCodecGeneric),
|
||||
bytes_written_(0),
|
||||
byte_limit_(byte_limit),
|
||||
num_frames_(0),
|
||||
|
||||
@ -69,9 +69,7 @@ static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) {
|
||||
3 * kTestWidth * kTestHeight * 8 * kTestFrameRate / 1000 / 2;
|
||||
settings->maxBitrate = settings->startBitrate;
|
||||
return;
|
||||
case kVideoCodecMultiplex:
|
||||
case kVideoCodecGeneric:
|
||||
case kVideoCodecUnknown:
|
||||
default:
|
||||
RTC_NOTREACHED();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user