Revert of Declare VideoCodec.codec_specific_info private (patchset #5 id:80001 of https://codereview.webrtc.org/2452963002/ )
Reason for revert: Broke a google3 build Original issue's description: > Declare VideoCodec.codec_specific_info private > > This completes the privatization of the codec specific > information in VideoCodec. > > BUG=webrtc:6603 > > Committed: https://crrev.com/792738640234d81c916ac4458ac72286cb2548a4 > Cr-Commit-Position: refs/heads/master@{#15013} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2491933002 Cr-Commit-Position: refs/heads/master@{#15027}
This commit is contained in:
parent
1369c83b42
commit
7fe6db91d9
@ -404,7 +404,7 @@ int32_t MediaCodecVideoEncoder::InitEncode(
|
||||
// TODO(pbos): Extract automaticResizeOn out of VP8 settings.
|
||||
scale_ = false;
|
||||
if (codecType_ == kVideoCodecVP8) {
|
||||
scale_ = codec_settings->VP8().automaticResizeOn;
|
||||
scale_ = codec_settings->codecSpecific.VP8.automaticResizeOn;
|
||||
} else if (codecType_ != kVideoCodecVP9) {
|
||||
scale_ = true;
|
||||
}
|
||||
|
||||
@ -59,36 +59,36 @@ VideoCodec::VideoCodec()
|
||||
simulcastStream(),
|
||||
spatialLayers(),
|
||||
mode(kRealtimeVideo),
|
||||
codec_specific_() {}
|
||||
codecSpecific() {}
|
||||
|
||||
VideoCodecVP8* VideoCodec::VP8() {
|
||||
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
|
||||
return &codec_specific_.VP8;
|
||||
return &codecSpecific.VP8;
|
||||
}
|
||||
|
||||
const VideoCodecVP8& VideoCodec::VP8() const {
|
||||
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
|
||||
return codec_specific_.VP8;
|
||||
return codecSpecific.VP8;
|
||||
}
|
||||
|
||||
VideoCodecVP9* VideoCodec::VP9() {
|
||||
RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
|
||||
return &codec_specific_.VP9;
|
||||
return &codecSpecific.VP9;
|
||||
}
|
||||
|
||||
const VideoCodecVP9& VideoCodec::VP9() const {
|
||||
RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
|
||||
return codec_specific_.VP9;
|
||||
return codecSpecific.VP9;
|
||||
}
|
||||
|
||||
VideoCodecH264* VideoCodec::H264() {
|
||||
RTC_DCHECK_EQ(codecType, kVideoCodecH264);
|
||||
return &codec_specific_.H264;
|
||||
return &codecSpecific.H264;
|
||||
}
|
||||
|
||||
const VideoCodecH264& VideoCodec::H264() const {
|
||||
RTC_DCHECK_EQ(codecType, kVideoCodecH264);
|
||||
return codec_specific_.H264;
|
||||
return codecSpecific.H264;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -632,10 +632,11 @@ class VideoCodec {
|
||||
VideoCodecH264* H264();
|
||||
const VideoCodecH264& H264() const;
|
||||
|
||||
private:
|
||||
// This variable will be declared private and renamed to codec_specific_
|
||||
// once Chromium is not accessing it.
|
||||
// TODO(hta): Consider replacing the union with a pointer type.
|
||||
// This will allow removing the VideoCodec* types from this file.
|
||||
VideoCodecUnion codec_specific_;
|
||||
VideoCodecUnion codecSpecific;
|
||||
};
|
||||
|
||||
// Bandwidth over-use detector options. These are used to drive
|
||||
|
||||
@ -167,11 +167,11 @@ VideoEncoderConfig::VideoEncoderConfig(const VideoEncoderConfig&) = default;
|
||||
void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
|
||||
VideoCodec* codec) const {
|
||||
if (codec->codecType == kVideoCodecH264) {
|
||||
FillVideoCodecH264(codec->H264());
|
||||
FillVideoCodecH264(&codec->codecSpecific.H264);
|
||||
} else if (codec->codecType == kVideoCodecVP8) {
|
||||
FillVideoCodecVp8(codec->VP8());
|
||||
FillVideoCodecVp8(&codec->codecSpecific.VP8);
|
||||
} else if (codec->codecType == kVideoCodecVP9) {
|
||||
FillVideoCodecVp9(codec->VP9());
|
||||
FillVideoCodecVp9(&codec->codecSpecific.VP9);
|
||||
} else {
|
||||
RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
|
||||
}
|
||||
|
||||
@ -74,28 +74,30 @@ VideoCodec VideoEncoderConfigToVideoCodec(
|
||||
switch (video_codec.codecType) {
|
||||
case kVideoCodecVP8: {
|
||||
if (!config.encoder_specific_settings)
|
||||
*video_codec.VP8() = VideoEncoder::GetDefaultVp8Settings();
|
||||
video_codec.VP8()->numberOfTemporalLayers = static_cast<unsigned char>(
|
||||
streams.back().temporal_layer_thresholds_bps.size() + 1);
|
||||
video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings();
|
||||
video_codec.codecSpecific.VP8.numberOfTemporalLayers =
|
||||
static_cast<unsigned char>(
|
||||
streams.back().temporal_layer_thresholds_bps.size() + 1);
|
||||
break;
|
||||
}
|
||||
case kVideoCodecVP9: {
|
||||
if (!config.encoder_specific_settings)
|
||||
*video_codec.VP9() = VideoEncoder::GetDefaultVp9Settings();
|
||||
video_codec.codecSpecific.VP9 = VideoEncoder::GetDefaultVp9Settings();
|
||||
if (video_codec.mode == kScreensharing &&
|
||||
config.encoder_specific_settings) {
|
||||
video_codec.VP9()->flexibleMode = true;
|
||||
video_codec.codecSpecific.VP9.flexibleMode = true;
|
||||
// For now VP9 screensharing use 1 temporal and 2 spatial layers.
|
||||
RTC_DCHECK_EQ(1, video_codec.VP9()->numberOfTemporalLayers);
|
||||
RTC_DCHECK_EQ(2, video_codec.VP9()->numberOfSpatialLayers);
|
||||
RTC_DCHECK_EQ(1, video_codec.codecSpecific.VP9.numberOfTemporalLayers);
|
||||
RTC_DCHECK_EQ(2, video_codec.codecSpecific.VP9.numberOfSpatialLayers);
|
||||
}
|
||||
video_codec.VP9()->numberOfTemporalLayers = static_cast<unsigned char>(
|
||||
streams.back().temporal_layer_thresholds_bps.size() + 1);
|
||||
video_codec.codecSpecific.VP9.numberOfTemporalLayers =
|
||||
static_cast<unsigned char>(
|
||||
streams.back().temporal_layer_thresholds_bps.size() + 1);
|
||||
break;
|
||||
}
|
||||
case kVideoCodecH264: {
|
||||
if (!config.encoder_specific_settings)
|
||||
*video_codec.H264() = VideoEncoder::GetDefaultH264Settings();
|
||||
video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -118,8 +120,8 @@ VideoCodec VideoEncoderConfigToVideoCodec(
|
||||
// If the vector is empty, bitrates will be configured automatically.
|
||||
RTC_DCHECK(config.spatial_layers.empty() ||
|
||||
config.spatial_layers.size() ==
|
||||
video_codec.VP9()->numberOfSpatialLayers);
|
||||
RTC_DCHECK_LE(video_codec.VP9()->numberOfSpatialLayers,
|
||||
video_codec.codecSpecific.VP9.numberOfSpatialLayers);
|
||||
RTC_DCHECK_LE(video_codec.codecSpecific.VP9.numberOfSpatialLayers,
|
||||
kMaxSimulcastStreams);
|
||||
for (size_t i = 0; i < config.spatial_layers.size(); ++i)
|
||||
video_codec.spatialLayers[i] = config.spatial_layers[i];
|
||||
@ -661,15 +663,19 @@ void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame,
|
||||
webrtc::CodecSpecificInfo codec_specific_info;
|
||||
codec_specific_info.codecType = webrtc::kVideoCodecVP8;
|
||||
|
||||
codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = has_received_rpsi_;
|
||||
codec_specific_info.codecSpecific.VP8.hasReceivedSLI = has_received_sli_;
|
||||
codec_specific_info.codecSpecific.VP8.pictureIdRPSI = picture_id_rpsi_;
|
||||
codec_specific_info.codecSpecific.VP8.pictureIdSLI = picture_id_sli_;
|
||||
has_received_sli_ = false;
|
||||
has_received_rpsi_ = false;
|
||||
codec_specific_info.codecSpecific.VP8.hasReceivedRPSI =
|
||||
has_received_rpsi_;
|
||||
codec_specific_info.codecSpecific.VP8.hasReceivedSLI =
|
||||
has_received_sli_;
|
||||
codec_specific_info.codecSpecific.VP8.pictureIdRPSI =
|
||||
picture_id_rpsi_;
|
||||
codec_specific_info.codecSpecific.VP8.pictureIdSLI =
|
||||
picture_id_sli_;
|
||||
has_received_sli_ = false;
|
||||
has_received_rpsi_ = false;
|
||||
|
||||
video_sender_.AddVideoFrame(video_frame, &codec_specific_info);
|
||||
return;
|
||||
video_sender_.AddVideoFrame(video_frame, &codec_specific_info);
|
||||
return;
|
||||
}
|
||||
video_sender_.AddVideoFrame(video_frame, nullptr);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user