| OLD | NEW |
| 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 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 VideoCodecConfigObserver(VideoCodecType video_codec_type, | 1963 VideoCodecConfigObserver(VideoCodecType video_codec_type, |
| 1964 const char* codec_name) | 1964 const char* codec_name) |
| 1965 : SendTest(VideoSendStreamTest::kDefaultTimeoutMs), | 1965 : SendTest(VideoSendStreamTest::kDefaultTimeoutMs), |
| 1966 FakeEncoder(Clock::GetRealTimeClock()), | 1966 FakeEncoder(Clock::GetRealTimeClock()), |
| 1967 video_codec_type_(video_codec_type), | 1967 video_codec_type_(video_codec_type), |
| 1968 codec_name_(codec_name), | 1968 codec_name_(codec_name), |
| 1969 init_encode_event_(false, false), | 1969 init_encode_event_(false, false), |
| 1970 num_initializations_(0), | 1970 num_initializations_(0), |
| 1971 stream_(nullptr) { | 1971 stream_(nullptr) { |
| 1972 memset(&encoder_settings_, 0, sizeof(encoder_settings_)); | 1972 memset(&encoder_settings_, 0, sizeof(encoder_settings_)); |
| 1973 InitCodecSpecifics(); |
| 1973 } | 1974 } |
| 1974 | 1975 |
| 1975 private: | 1976 private: |
| 1976 class VideoStreamFactory | 1977 class VideoStreamFactory |
| 1977 : public VideoEncoderConfig::VideoStreamFactoryInterface { | 1978 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 1978 public: | 1979 public: |
| 1979 VideoStreamFactory() {} | 1980 VideoStreamFactory() {} |
| 1980 | 1981 |
| 1981 private: | 1982 private: |
| 1982 std::vector<VideoStream> CreateEncoderStreams( | 1983 std::vector<VideoStream> CreateEncoderStreams( |
| 1983 int width, | 1984 int width, |
| 1984 int height, | 1985 int height, |
| 1985 const VideoEncoderConfig& encoder_config) override { | 1986 const VideoEncoderConfig& encoder_config) override { |
| 1986 std::vector<VideoStream> streams = | 1987 std::vector<VideoStream> streams = |
| 1987 test::CreateVideoStreams(width, height, encoder_config); | 1988 test::CreateVideoStreams(width, height, encoder_config); |
| 1988 for (size_t i = 0; i < streams.size(); ++i) { | 1989 for (size_t i = 0; i < streams.size(); ++i) { |
| 1989 streams[i].temporal_layer_thresholds_bps.resize( | 1990 streams[i].temporal_layer_thresholds_bps.resize( |
| 1990 kVideoCodecConfigObserverNumberOfTemporalLayers - 1); | 1991 kVideoCodecConfigObserverNumberOfTemporalLayers - 1); |
| 1991 } | 1992 } |
| 1992 return streams; | 1993 return streams; |
| 1993 } | 1994 } |
| 1994 }; | 1995 }; |
| 1995 | 1996 |
| 1997 void InitCodecSpecifics(); |
| 1998 |
| 1996 void ModifyVideoConfigs( | 1999 void ModifyVideoConfigs( |
| 1997 VideoSendStream::Config* send_config, | 2000 VideoSendStream::Config* send_config, |
| 1998 std::vector<VideoReceiveStream::Config>* receive_configs, | 2001 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 1999 VideoEncoderConfig* encoder_config) override { | 2002 VideoEncoderConfig* encoder_config) override { |
| 2000 send_config->encoder_settings.encoder = this; | 2003 send_config->encoder_settings.encoder = this; |
| 2001 send_config->encoder_settings.payload_name = codec_name_; | 2004 send_config->encoder_settings.payload_name = codec_name_; |
| 2002 | 2005 |
| 2003 encoder_config->encoder_specific_settings = GetEncoderSpecificSettings(); | 2006 encoder_config->encoder_specific_settings = GetEncoderSpecificSettings(); |
| 2004 encoder_config->video_stream_factory = | 2007 encoder_config->video_stream_factory = |
| 2005 new rtc::RefCountedObject<VideoStreamFactory>(); | 2008 new rtc::RefCountedObject<VideoStreamFactory>(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 | 2053 |
| 2051 T encoder_settings_; | 2054 T encoder_settings_; |
| 2052 const VideoCodecType video_codec_type_; | 2055 const VideoCodecType video_codec_type_; |
| 2053 const char* const codec_name_; | 2056 const char* const codec_name_; |
| 2054 rtc::Event init_encode_event_; | 2057 rtc::Event init_encode_event_; |
| 2055 size_t num_initializations_; | 2058 size_t num_initializations_; |
| 2056 VideoSendStream* stream_; | 2059 VideoSendStream* stream_; |
| 2057 VideoEncoderConfig encoder_config_; | 2060 VideoEncoderConfig encoder_config_; |
| 2058 }; | 2061 }; |
| 2059 | 2062 |
| 2063 template <typename T> |
| 2064 void VideoCodecConfigObserver<T>::InitCodecSpecifics() {} |
| 2065 |
| 2066 template <> |
| 2067 void VideoCodecConfigObserver<VideoCodecH264>::InitCodecSpecifics() { |
| 2068 encoder_settings_.packetization_mode = kH264PacketizationMode1; |
| 2069 } |
| 2060 template <> | 2070 template <> |
| 2061 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics( | 2071 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics( |
| 2062 const VideoCodec& config) const { | 2072 const VideoCodec& config) const { |
| 2063 EXPECT_EQ( | 2073 EXPECT_EQ( |
| 2064 0, memcmp(&config.H264(), &encoder_settings_, sizeof(encoder_settings_))); | 2074 0, memcmp(&config.H264(), &encoder_settings_, sizeof(encoder_settings_))); |
| 2075 // Check that packetization mode has propagated. |
| 2076 EXPECT_EQ(kH264PacketizationMode1, |
| 2077 config.codecSpecific.H264.packetization_mode); |
| 2065 } | 2078 } |
| 2066 | 2079 |
| 2067 template <> | 2080 template <> |
| 2068 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings> | 2081 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings> |
| 2069 VideoCodecConfigObserver<VideoCodecH264>::GetEncoderSpecificSettings() const { | 2082 VideoCodecConfigObserver<VideoCodecH264>::GetEncoderSpecificSettings() const { |
| 2070 return new rtc::RefCountedObject< | 2083 return new rtc::RefCountedObject< |
| 2071 VideoEncoderConfig::H264EncoderSpecificSettings>(encoder_settings_); | 2084 VideoEncoderConfig::H264EncoderSpecificSettings>(encoder_settings_); |
| 2072 } | 2085 } |
| 2073 | 2086 |
| 2074 template <> | 2087 template <> |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2987 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { | 3000 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { |
| 2988 TestRequestSourceRotateVideo(false); | 3001 TestRequestSourceRotateVideo(false); |
| 2989 } | 3002 } |
| 2990 | 3003 |
| 2991 TEST_F(VideoSendStreamTest, | 3004 TEST_F(VideoSendStreamTest, |
| 2992 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { | 3005 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { |
| 2993 TestRequestSourceRotateVideo(true); | 3006 TestRequestSourceRotateVideo(true); |
| 2994 } | 3007 } |
| 2995 | 3008 |
| 2996 } // namespace webrtc | 3009 } // namespace webrtc |
| OLD | NEW |