Add field VideoEncoderConfig::codec_type.
First step of the transition needed to reland cl https://webrtc-review.googlesource.com/62062, and move payload_name and payload_type out of VideoSendStream::Config::EncoderSettings. If the new field is set to something different than kVideoCodecUnkown, payload_name from EncoderSettings is ignored. Bug: webrtc:8830 Change-Id: I515a91f8291cda79017332102cc6a10736d8a648 Reviewed-on: https://webrtc-review.googlesource.com/64001 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22555}
This commit is contained in:
@ -31,13 +31,18 @@ bool VideoCodecInitializer::SetupCodec(
|
||||
bool nack_enabled,
|
||||
VideoCodec* codec,
|
||||
std::unique_ptr<VideoBitrateAllocator>* bitrate_allocator) {
|
||||
if (PayloadStringToCodecType(settings.payload_name) == kVideoCodecMultiplex) {
|
||||
VideoSendStream::Config::EncoderSettings associated_codec_settings =
|
||||
settings;
|
||||
associated_codec_settings.payload_name =
|
||||
CodecTypeToPayloadString(kVideoCodecVP9);
|
||||
if (!SetupCodec(config, associated_codec_settings, streams, nack_enabled,
|
||||
codec, bitrate_allocator)) {
|
||||
VideoCodecType codec_type = config.codec_type;
|
||||
// TODO(nisse): Transition hack, the intention is to delete the
|
||||
// |settings| argument and require configuration via
|
||||
// config.codec_type.
|
||||
if (codec_type == kVideoCodecUnknown) {
|
||||
codec_type = PayloadStringToCodecType(settings.payload_name);
|
||||
}
|
||||
if (codec_type == kVideoCodecMultiplex) {
|
||||
VideoEncoderConfig associated_config = config.Copy();
|
||||
associated_config.codec_type = kVideoCodecVP9;
|
||||
if (!SetupCodec(associated_config, settings /* ignored */, streams,
|
||||
nack_enabled, codec, bitrate_allocator)) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to create stereo encoder configuration.";
|
||||
return false;
|
||||
}
|
||||
@ -46,8 +51,7 @@ bool VideoCodecInitializer::SetupCodec(
|
||||
}
|
||||
|
||||
*codec =
|
||||
VideoEncoderConfigToVideoCodec(config, streams, settings.payload_name,
|
||||
settings.payload_type, nack_enabled);
|
||||
VideoEncoderConfigToVideoCodec(config, streams, codec_type, nack_enabled);
|
||||
*bitrate_allocator = CreateBitrateAllocator(*codec);
|
||||
|
||||
return true;
|
||||
@ -73,8 +77,7 @@ VideoCodecInitializer::CreateBitrateAllocator(const VideoCodec& codec) {
|
||||
VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
||||
const VideoEncoderConfig& config,
|
||||
const std::vector<VideoStream>& streams,
|
||||
const std::string& payload_name,
|
||||
int payload_type,
|
||||
VideoCodecType codec_type,
|
||||
bool nack_enabled) {
|
||||
static const int kEncoderMinBitrateKbps = 30;
|
||||
RTC_DCHECK(!streams.empty());
|
||||
@ -82,7 +85,7 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
||||
|
||||
VideoCodec video_codec;
|
||||
memset(&video_codec, 0, sizeof(video_codec));
|
||||
video_codec.codecType = PayloadStringToCodecType(payload_name);
|
||||
video_codec.codecType = codec_type;
|
||||
|
||||
switch (config.content_type) {
|
||||
case VideoEncoderConfig::ContentType::kRealtimeVideo:
|
||||
@ -155,7 +158,9 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
|
||||
break;
|
||||
}
|
||||
|
||||
video_codec.plType = payload_type;
|
||||
// TODO(nisse): The plType field should be deleted. Luckily, our
|
||||
// callers don't need it.
|
||||
video_codec.plType = 0;
|
||||
video_codec.numberOfSimulcastStreams =
|
||||
static_cast<unsigned char>(streams.size());
|
||||
video_codec.minBitrate = streams[0].min_bitrate_bps / 1000;
|
||||
|
Reference in New Issue
Block a user