Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2001533003: Refactoring: Hide VideoCodec.codecSpecific as "private" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/video_receive_stream.cc ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <algorithm> // max 10 #include <algorithm> // max
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 const char* const codec_name_; 1985 const char* const codec_name_;
1986 rtc::Event init_encode_event_; 1986 rtc::Event init_encode_event_;
1987 size_t num_initializations_; 1987 size_t num_initializations_;
1988 VideoSendStream* stream_; 1988 VideoSendStream* stream_;
1989 VideoEncoderConfig encoder_config_; 1989 VideoEncoderConfig encoder_config_;
1990 }; 1990 };
1991 1991
1992 template <> 1992 template <>
1993 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics( 1993 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics(
1994 const VideoCodec& config) const { 1994 const VideoCodec& config) const {
1995 EXPECT_EQ(0, memcmp(&config.codecSpecific.H264, &encoder_settings_, 1995 EXPECT_EQ(
1996 sizeof(encoder_settings_))); 1996 0, memcmp(&config.H264(), &encoder_settings_, sizeof(encoder_settings_)));
1997 } 1997 }
1998 1998
1999 template <> 1999 template <>
2000 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings> 2000 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings>
2001 VideoCodecConfigObserver<VideoCodecH264>::GetEncoderSpecificSettings() const { 2001 VideoCodecConfigObserver<VideoCodecH264>::GetEncoderSpecificSettings() const {
2002 return new rtc::RefCountedObject< 2002 return new rtc::RefCountedObject<
2003 VideoEncoderConfig::H264EncoderSpecificSettings>(encoder_settings_); 2003 VideoEncoderConfig::H264EncoderSpecificSettings>(encoder_settings_);
2004 } 2004 }
2005 2005
2006 template <> 2006 template <>
2007 void VideoCodecConfigObserver<VideoCodecVP8>::VerifyCodecSpecifics( 2007 void VideoCodecConfigObserver<VideoCodecVP8>::VerifyCodecSpecifics(
2008 const VideoCodec& config) const { 2008 const VideoCodec& config) const {
2009 // Check that the number of temporal layers has propagated properly to 2009 // Check that the number of temporal layers has propagated properly to
2010 // VideoCodec. 2010 // VideoCodec.
2011 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, 2011 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers,
2012 config.codecSpecific.VP8.numberOfTemporalLayers); 2012 config.VP8().numberOfTemporalLayers);
2013 2013
2014 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) { 2014 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) {
2015 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, 2015 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers,
2016 config.simulcastStream[i].numberOfTemporalLayers); 2016 config.simulcastStream[i].numberOfTemporalLayers);
2017 } 2017 }
2018 2018
2019 // Set expected temporal layers as they should have been set when 2019 // Set expected temporal layers as they should have been set when
2020 // reconfiguring the encoder and not match the set config. 2020 // reconfiguring the encoder and not match the set config.
2021 VideoCodecVP8 encoder_settings = encoder_settings_; 2021 VideoCodecVP8 encoder_settings = encoder_settings_;
2022 encoder_settings.numberOfTemporalLayers = 2022 encoder_settings.numberOfTemporalLayers =
2023 kVideoCodecConfigObserverNumberOfTemporalLayers; 2023 kVideoCodecConfigObserverNumberOfTemporalLayers;
2024 EXPECT_EQ(0, memcmp(&config.codecSpecific.VP8, &encoder_settings, 2024 EXPECT_EQ(
2025 sizeof(encoder_settings_))); 2025 0, memcmp(&config.VP8(), &encoder_settings, sizeof(encoder_settings_)));
2026 } 2026 }
2027 2027
2028 template <> 2028 template <>
2029 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings> 2029 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings>
2030 VideoCodecConfigObserver<VideoCodecVP8>::GetEncoderSpecificSettings() const { 2030 VideoCodecConfigObserver<VideoCodecVP8>::GetEncoderSpecificSettings() const {
2031 return new rtc::RefCountedObject< 2031 return new rtc::RefCountedObject<
2032 VideoEncoderConfig::Vp8EncoderSpecificSettings>(encoder_settings_); 2032 VideoEncoderConfig::Vp8EncoderSpecificSettings>(encoder_settings_);
2033 } 2033 }
2034 2034
2035 template <> 2035 template <>
2036 void VideoCodecConfigObserver<VideoCodecVP9>::VerifyCodecSpecifics( 2036 void VideoCodecConfigObserver<VideoCodecVP9>::VerifyCodecSpecifics(
2037 const VideoCodec& config) const { 2037 const VideoCodec& config) const {
2038 // Check that the number of temporal layers has propagated properly to 2038 // Check that the number of temporal layers has propagated properly to
2039 // VideoCodec. 2039 // VideoCodec.
2040 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, 2040 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers,
2041 config.codecSpecific.VP9.numberOfTemporalLayers); 2041 config.VP9().numberOfTemporalLayers);
2042 2042
2043 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) { 2043 for (unsigned char i = 0; i < config.numberOfSimulcastStreams; ++i) {
2044 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers, 2044 EXPECT_EQ(kVideoCodecConfigObserverNumberOfTemporalLayers,
2045 config.simulcastStream[i].numberOfTemporalLayers); 2045 config.simulcastStream[i].numberOfTemporalLayers);
2046 } 2046 }
2047 2047
2048 // Set expected temporal layers as they should have been set when 2048 // Set expected temporal layers as they should have been set when
2049 // reconfiguring the encoder and not match the set config. 2049 // reconfiguring the encoder and not match the set config.
2050 VideoCodecVP9 encoder_settings = encoder_settings_; 2050 VideoCodecVP9 encoder_settings = encoder_settings_;
2051 encoder_settings.numberOfTemporalLayers = 2051 encoder_settings.numberOfTemporalLayers =
2052 kVideoCodecConfigObserverNumberOfTemporalLayers; 2052 kVideoCodecConfigObserverNumberOfTemporalLayers;
2053 EXPECT_EQ(0, memcmp(&config.codecSpecific.VP9, &encoder_settings, 2053 EXPECT_EQ(
2054 sizeof(encoder_settings_))); 2054 0, memcmp(&(config.VP9()), &encoder_settings, sizeof(encoder_settings_)));
2055 } 2055 }
2056 2056
2057 template <> 2057 template <>
2058 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings> 2058 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings>
2059 VideoCodecConfigObserver<VideoCodecVP9>::GetEncoderSpecificSettings() const { 2059 VideoCodecConfigObserver<VideoCodecVP9>::GetEncoderSpecificSettings() const {
2060 return new rtc::RefCountedObject< 2060 return new rtc::RefCountedObject<
2061 VideoEncoderConfig::Vp9EncoderSpecificSettings>(encoder_settings_); 2061 VideoEncoderConfig::Vp9EncoderSpecificSettings>(encoder_settings_);
2062 } 2062 }
2063 2063
2064 TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp8Config) { 2064 TEST_F(VideoSendStreamTest, EncoderSetupPropagatesVp8Config) {
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 observation_complete_.Set(); 2888 observation_complete_.Set();
2889 } 2889 }
2890 } 2890 }
2891 } test; 2891 } test;
2892 2892
2893 RunBaseTest(&test); 2893 RunBaseTest(&test);
2894 } 2894 }
2895 #endif // !defined(RTC_DISABLE_VP9) 2895 #endif // !defined(RTC_DISABLE_VP9)
2896 2896
2897 } // namespace webrtc 2897 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.cc ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698