From 527d3474adaae38a62e6991958952a8929b0ef23 Mon Sep 17 00:00:00 2001 From: hta Date: Wed, 16 Nov 2016 23:23:04 -0800 Subject: [PATCH] Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491613005/ ) Reason for revert: More downstream issues fixed again. Original issue's description: > Revert of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2494683006/ ) > > Reason for revert: > Another downstream error. > > Original issue's description: > > Reland of Declare VideoCodec.codec_specific_info private (patchset #1 id:1 of https://codereview.webrtc.org/2491933002/ ) > > > > Reason for revert: > > Relanding, now that downstream issues have been fixed. > > > > Original issue's description: > > > 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 > > > > > > Committed: https://crrev.com/7fe6db91d99cf6d43874651bcca56092cf869e2f > > > Cr-Commit-Position: refs/heads/master@{#15027} > > > > 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 > > > > Committed: https://crrev.com/c63fb3a0d3b9b2081a6a5e6e238d8ee595dca2a2 > > Cr-Commit-Position: refs/heads/master@{#15041} > > 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 > > Committed: https://crrev.com/281459896124685d355d37388ee2290b55015594 > Cr-Commit-Position: refs/heads/master@{#15042} TBR=tommi@chromium.org,magjed@chromium.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6603 Review-Url: https://codereview.webrtc.org/2508853002 Cr-Commit-Position: refs/heads/master@{#15117} --- .../android/jni/androidmediaencoder_jni.cc | 2 +- webrtc/common_types.cc | 14 ++++++------- webrtc/common_types.h | 5 ++--- webrtc/config.cc | 6 +++--- webrtc/video/vie_encoder.cc | 20 ++++++++----------- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/webrtc/api/android/jni/androidmediaencoder_jni.cc b/webrtc/api/android/jni/androidmediaencoder_jni.cc index 177cd9bfb9..6fcb0fbe36 100644 --- a/webrtc/api/android/jni/androidmediaencoder_jni.cc +++ b/webrtc/api/android/jni/androidmediaencoder_jni.cc @@ -405,7 +405,7 @@ int32_t MediaCodecVideoEncoder::InitEncode( // TODO(pbos): Extract automaticResizeOn out of VP8 settings. scale_ = false; if (codecType_ == kVideoCodecVP8) { - scale_ = codec_settings->codecSpecific.VP8.automaticResizeOn; + scale_ = codec_settings->VP8().automaticResizeOn; } else if (codecType_ != kVideoCodecVP9) { scale_ = true; } diff --git a/webrtc/common_types.cc b/webrtc/common_types.cc index 3f8d877fd2..89f3eab8cb 100644 --- a/webrtc/common_types.cc +++ b/webrtc/common_types.cc @@ -61,36 +61,36 @@ VideoCodec::VideoCodec() spatialLayers(), mode(kRealtimeVideo), expect_encode_from_texture(false), - codecSpecific() {} + codec_specific_() {} VideoCodecVP8* VideoCodec::VP8() { RTC_DCHECK_EQ(codecType, kVideoCodecVP8); - return &codecSpecific.VP8; + return &codec_specific_.VP8; } const VideoCodecVP8& VideoCodec::VP8() const { RTC_DCHECK_EQ(codecType, kVideoCodecVP8); - return codecSpecific.VP8; + return codec_specific_.VP8; } VideoCodecVP9* VideoCodec::VP9() { RTC_DCHECK_EQ(codecType, kVideoCodecVP9); - return &codecSpecific.VP9; + return &codec_specific_.VP9; } const VideoCodecVP9& VideoCodec::VP9() const { RTC_DCHECK_EQ(codecType, kVideoCodecVP9); - return codecSpecific.VP9; + return codec_specific_.VP9; } VideoCodecH264* VideoCodec::H264() { RTC_DCHECK_EQ(codecType, kVideoCodecH264); - return &codecSpecific.H264; + return &codec_specific_.H264; } const VideoCodecH264& VideoCodec::H264() const { RTC_DCHECK_EQ(codecType, kVideoCodecH264); - return codecSpecific.H264; + return codec_specific_.H264; } static const char* kPayloadNameVp8 = "VP8"; diff --git a/webrtc/common_types.h b/webrtc/common_types.h index 77c009cd9d..803f2c2632 100644 --- a/webrtc/common_types.h +++ b/webrtc/common_types.h @@ -637,11 +637,10 @@ class VideoCodec { VideoCodecH264* H264(); const VideoCodecH264& H264() const; - // This variable will be declared private and renamed to codec_specific_ - // once Chromium is not accessing it. + private: // TODO(hta): Consider replacing the union with a pointer type. // This will allow removing the VideoCodec* types from this file. - VideoCodecUnion codecSpecific; + VideoCodecUnion codec_specific_; }; class BitrateAllocation { diff --git a/webrtc/config.cc b/webrtc/config.cc index 281b89f46e..4b437e264d 100644 --- a/webrtc/config.cc +++ b/webrtc/config.cc @@ -167,11 +167,11 @@ VideoEncoderConfig::VideoEncoderConfig(const VideoEncoderConfig&) = default; void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings( VideoCodec* codec) const { if (codec->codecType == kVideoCodecH264) { - FillVideoCodecH264(&codec->codecSpecific.H264); + FillVideoCodecH264(codec->H264()); } else if (codec->codecType == kVideoCodecVP8) { - FillVideoCodecVp8(&codec->codecSpecific.VP8); + FillVideoCodecVp8(codec->VP8()); } else if (codec->codecType == kVideoCodecVP9) { - FillVideoCodecVp9(&codec->codecSpecific.VP9); + FillVideoCodecVp9(codec->VP9()); } else { RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type."; } diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc index aa93886bc3..2c9c6799e8 100644 --- a/webrtc/video/vie_encoder.cc +++ b/webrtc/video/vie_encoder.cc @@ -528,19 +528,15 @@ 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); }