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

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

Issue 2337453002: H.264 packetization mode 0 (try 2) (Closed)
Patch Set: Working H.264 test where packetization mode 0 is set 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
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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 VideoCodecConfigObserver(VideoCodecType video_codec_type, 1890 VideoCodecConfigObserver(VideoCodecType video_codec_type,
1891 const char* codec_name) 1891 const char* codec_name)
1892 : SendTest(VideoSendStreamTest::kDefaultTimeoutMs), 1892 : SendTest(VideoSendStreamTest::kDefaultTimeoutMs),
1893 FakeEncoder(Clock::GetRealTimeClock()), 1893 FakeEncoder(Clock::GetRealTimeClock()),
1894 video_codec_type_(video_codec_type), 1894 video_codec_type_(video_codec_type),
1895 codec_name_(codec_name), 1895 codec_name_(codec_name),
1896 init_encode_event_(false, false), 1896 init_encode_event_(false, false),
1897 num_initializations_(0), 1897 num_initializations_(0),
1898 stream_(nullptr) { 1898 stream_(nullptr) {
1899 memset(&encoder_settings_, 0, sizeof(encoder_settings_)); 1899 memset(&encoder_settings_, 0, sizeof(encoder_settings_));
1900 InitCodecSpecifics();
1900 } 1901 }
1901 1902
1902 private: 1903 private:
1903 class VideoStreamFactory 1904 class VideoStreamFactory
1904 : public VideoEncoderConfig::VideoStreamFactoryInterface { 1905 : public VideoEncoderConfig::VideoStreamFactoryInterface {
1905 public: 1906 public:
1906 VideoStreamFactory() {} 1907 VideoStreamFactory() {}
1907 1908
1908 private: 1909 private:
1909 std::vector<VideoStream> CreateEncoderStreams( 1910 std::vector<VideoStream> CreateEncoderStreams(
1910 int width, 1911 int width,
1911 int height, 1912 int height,
1912 const VideoEncoderConfig& encoder_config) override { 1913 const VideoEncoderConfig& encoder_config) override {
1913 std::vector<VideoStream> streams = 1914 std::vector<VideoStream> streams =
1914 test::CreateVideoStreams(width, height, encoder_config); 1915 test::CreateVideoStreams(width, height, encoder_config);
1915 for (size_t i = 0; i < streams.size(); ++i) { 1916 for (size_t i = 0; i < streams.size(); ++i) {
1916 streams[i].temporal_layer_thresholds_bps.resize( 1917 streams[i].temporal_layer_thresholds_bps.resize(
1917 kVideoCodecConfigObserverNumberOfTemporalLayers - 1); 1918 kVideoCodecConfigObserverNumberOfTemporalLayers - 1);
1918 } 1919 }
1919 return streams; 1920 return streams;
1920 } 1921 }
1921 }; 1922 };
1922 1923
1924 void InitCodecSpecifics();
1925
1923 void ModifyVideoConfigs( 1926 void ModifyVideoConfigs(
1924 VideoSendStream::Config* send_config, 1927 VideoSendStream::Config* send_config,
1925 std::vector<VideoReceiveStream::Config>* receive_configs, 1928 std::vector<VideoReceiveStream::Config>* receive_configs,
1926 VideoEncoderConfig* encoder_config) override { 1929 VideoEncoderConfig* encoder_config) override {
1927 send_config->encoder_settings.encoder = this; 1930 send_config->encoder_settings.encoder = this;
1928 send_config->encoder_settings.payload_name = codec_name_; 1931 send_config->encoder_settings.payload_name = codec_name_;
1929 1932
1930 encoder_config->encoder_specific_settings = GetEncoderSpecificSettings(); 1933 encoder_config->encoder_specific_settings = GetEncoderSpecificSettings();
1931 encoder_config->video_stream_factory = 1934 encoder_config->video_stream_factory =
1932 new rtc::RefCountedObject<VideoStreamFactory>(); 1935 new rtc::RefCountedObject<VideoStreamFactory>();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 1985
1983 T encoder_settings_; 1986 T encoder_settings_;
1984 const VideoCodecType video_codec_type_; 1987 const VideoCodecType video_codec_type_;
1985 const char* const codec_name_; 1988 const char* const codec_name_;
1986 rtc::Event init_encode_event_; 1989 rtc::Event init_encode_event_;
1987 size_t num_initializations_; 1990 size_t num_initializations_;
1988 VideoSendStream* stream_; 1991 VideoSendStream* stream_;
1989 VideoEncoderConfig encoder_config_; 1992 VideoEncoderConfig encoder_config_;
1990 }; 1993 };
1991 1994
1995 template <typename T>
1996 void VideoCodecConfigObserver<T>::InitCodecSpecifics() {}
1997
1998 template <>
1999 void VideoCodecConfigObserver<VideoCodecH264>::InitCodecSpecifics() {
2000 encoder_settings_.packetization_mode = kH264PacketizationMode1;
2001 }
1992 template <> 2002 template <>
1993 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics( 2003 void VideoCodecConfigObserver<VideoCodecH264>::VerifyCodecSpecifics(
1994 const VideoCodec& config) const { 2004 const VideoCodec& config) const {
1995 EXPECT_EQ( 2005 EXPECT_EQ(
1996 0, memcmp(&config.H264(), &encoder_settings_, sizeof(encoder_settings_))); 2006 0, memcmp(&config.H264(), &encoder_settings_, sizeof(encoder_settings_)));
2007 // Check that packetization mode has propagated.
2008 EXPECT_EQ(kH264PacketizationMode1,
2009 config.codecSpecific.H264.packetization_mode);
1997 } 2010 }
1998 2011
1999 template <> 2012 template <>
2000 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings> 2013 rtc::scoped_refptr<VideoEncoderConfig::EncoderSpecificSettings>
2001 VideoCodecConfigObserver<VideoCodecH264>::GetEncoderSpecificSettings() const { 2014 VideoCodecConfigObserver<VideoCodecH264>::GetEncoderSpecificSettings() const {
2002 return new rtc::RefCountedObject< 2015 return new rtc::RefCountedObject<
2003 VideoEncoderConfig::H264EncoderSpecificSettings>(encoder_settings_); 2016 VideoEncoderConfig::H264EncoderSpecificSettings>(encoder_settings_);
2004 } 2017 }
2005 2018
2006 template <> 2019 template <>
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 observation_complete_.Set(); 2901 observation_complete_.Set();
2889 } 2902 }
2890 } 2903 }
2891 } test; 2904 } test;
2892 2905
2893 RunBaseTest(&test); 2906 RunBaseTest(&test);
2894 } 2907 }
2895 #endif // !defined(RTC_DISABLE_VP9) 2908 #endif // !defined(RTC_DISABLE_VP9)
2896 2909
2897 } // namespace webrtc 2910 } // namespace webrtc
OLDNEW
« webrtc/video/end_to_end_tests.cc ('K') | « webrtc/video/payload_router.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698