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