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

Side by Side Diff: talk/media/webrtc/webrtcvideoengine2_unittest.cc

Issue 1363573002: Wire up transport sequence number / send time callbacks to webrtc via libjingle. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing updated_options Created 5 years, 2 months 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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 22 matching lines...) Expand all
33 #include "talk/media/base/videoengine_unittest.h" 33 #include "talk/media/base/videoengine_unittest.h"
34 #include "talk/media/webrtc/fakewebrtccall.h" 34 #include "talk/media/webrtc/fakewebrtccall.h"
35 #include "talk/media/webrtc/fakewebrtcvideoengine.h" 35 #include "talk/media/webrtc/fakewebrtcvideoengine.h"
36 #include "talk/media/webrtc/simulcast.h" 36 #include "talk/media/webrtc/simulcast.h"
37 #include "talk/media/webrtc/webrtcvideochannelfactory.h" 37 #include "talk/media/webrtc/webrtcvideochannelfactory.h"
38 #include "talk/media/webrtc/webrtcvideoengine2.h" 38 #include "talk/media/webrtc/webrtcvideoengine2.h"
39 #include "talk/media/webrtc/webrtcvoiceengine.h" 39 #include "talk/media/webrtc/webrtcvoiceengine.h"
40 #include "webrtc/base/arraysize.h" 40 #include "webrtc/base/arraysize.h"
41 #include "webrtc/base/gunit.h" 41 #include "webrtc/base/gunit.h"
42 #include "webrtc/base/stringutils.h" 42 #include "webrtc/base/stringutils.h"
43 #include "webrtc/test/field_trial.h"
43 #include "webrtc/video_encoder.h" 44 #include "webrtc/video_encoder.h"
44 45
45 namespace { 46 namespace {
46 static const int kDefaultQpMax = 56; 47 static const int kDefaultQpMax = 56;
47 static const int kDefaultFramerate = 30; 48 static const int kDefaultFramerate = 30;
48 49
49 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0); 50 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0);
50 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); 51 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0);
51 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); 52 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0);
52 53
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 it = rtx_types.find(config.rtp.fec.red_payload_type); 102 it = rtx_types.find(config.rtp.fec.red_payload_type);
102 EXPECT_TRUE(it != rtx_types.end() && 103 EXPECT_TRUE(it != rtx_types.end() &&
103 it->second == config.rtp.fec.red_rtx_payload_type); 104 it->second == config.rtp.fec.red_rtx_payload_type);
104 } 105 }
105 } 106 }
106 } // namespace 107 } // namespace
107 108
108 namespace cricket { 109 namespace cricket {
109 class WebRtcVideoEngine2Test : public ::testing::Test { 110 class WebRtcVideoEngine2Test : public ::testing::Test {
110 public: 111 public:
111 WebRtcVideoEngine2Test() : WebRtcVideoEngine2Test(nullptr) {} 112 WebRtcVideoEngine2Test() : WebRtcVideoEngine2Test("") {}
112 WebRtcVideoEngine2Test(WebRtcVoiceEngine* voice_engine) 113 explicit WebRtcVideoEngine2Test(const char* field_trials)
113 : call_(webrtc::Call::Create(webrtc::Call::Config())), 114 : WebRtcVideoEngine2Test(nullptr, field_trials) {}
115 WebRtcVideoEngine2Test(WebRtcVoiceEngine* voice_engine,
116 const char* field_trials)
117 : override_field_trials_(field_trials),
118 call_(webrtc::Call::Create(webrtc::Call::Config())),
114 engine_() { 119 engine_() {
115 std::vector<VideoCodec> engine_codecs = engine_.codecs(); 120 std::vector<VideoCodec> engine_codecs = engine_.codecs();
116 RTC_DCHECK(!engine_codecs.empty()); 121 RTC_DCHECK(!engine_codecs.empty());
117 bool codec_set = false; 122 bool codec_set = false;
118 for (size_t i = 0; i < engine_codecs.size(); ++i) { 123 for (size_t i = 0; i < engine_codecs.size(); ++i) {
119 if (engine_codecs[i].name == "red") { 124 if (engine_codecs[i].name == "red") {
120 default_red_codec_ = engine_codecs[i]; 125 default_red_codec_ = engine_codecs[i];
121 } else if (engine_codecs[i].name == "ulpfec") { 126 } else if (engine_codecs[i].name == "ulpfec") {
122 default_ulpfec_codec_ = engine_codecs[i]; 127 default_ulpfec_codec_ = engine_codecs[i];
123 } else if (engine_codecs[i].name == "rtx") { 128 } else if (engine_codecs[i].name == "rtx") {
(...skipping 13 matching lines...) Expand all
137 142
138 protected: 143 protected:
139 VideoMediaChannel* SetUpForExternalEncoderFactory( 144 VideoMediaChannel* SetUpForExternalEncoderFactory(
140 cricket::WebRtcVideoEncoderFactory* encoder_factory, 145 cricket::WebRtcVideoEncoderFactory* encoder_factory,
141 const std::vector<VideoCodec>& codecs); 146 const std::vector<VideoCodec>& codecs);
142 147
143 VideoMediaChannel* SetUpForExternalDecoderFactory( 148 VideoMediaChannel* SetUpForExternalDecoderFactory(
144 cricket::WebRtcVideoDecoderFactory* decoder_factory, 149 cricket::WebRtcVideoDecoderFactory* decoder_factory,
145 const std::vector<VideoCodec>& codecs); 150 const std::vector<VideoCodec>& codecs);
146 151
152 webrtc::test::ScopedFieldTrials override_field_trials_;
147 // Used in WebRtcVideoEngine2VoiceTest, but defined here so it's properly 153 // Used in WebRtcVideoEngine2VoiceTest, but defined here so it's properly
148 // initialized when the constructor is called. 154 // initialized when the constructor is called.
149 rtc::scoped_ptr<webrtc::Call> call_; 155 rtc::scoped_ptr<webrtc::Call> call_;
150 WebRtcVoiceEngine voice_engine_; 156 WebRtcVoiceEngine voice_engine_;
151 WebRtcVideoEngine2 engine_; 157 WebRtcVideoEngine2 engine_;
152 VideoCodec default_codec_; 158 VideoCodec default_codec_;
153 VideoCodec default_red_codec_; 159 VideoCodec default_red_codec_;
154 VideoCodec default_ulpfec_codec_; 160 VideoCodec default_ulpfec_codec_;
155 std::map<int, int> default_apt_rtx_types_; 161 std::map<int, int> default_apt_rtx_types_;
156 }; 162 };
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 for (size_t i = 0; i < extensions.size(); ++i) { 257 for (size_t i = 0; i < extensions.size(); ++i) {
252 if (extensions[i].uri == kRtpAbsoluteSenderTimeHeaderExtension) { 258 if (extensions[i].uri == kRtpAbsoluteSenderTimeHeaderExtension) {
253 EXPECT_EQ(kRtpAbsoluteSenderTimeHeaderExtensionDefaultId, 259 EXPECT_EQ(kRtpAbsoluteSenderTimeHeaderExtensionDefaultId,
254 extensions[i].id); 260 extensions[i].id);
255 return; 261 return;
256 } 262 }
257 } 263 }
258 FAIL() << "Absolute Sender Time extension not in header-extension list."; 264 FAIL() << "Absolute Sender Time extension not in header-extension list.";
259 } 265 }
260 266
267 class WebRtcVideoEngine2WithSendSideBweTest : public WebRtcVideoEngine2Test {
268 public:
269 WebRtcVideoEngine2WithSendSideBweTest()
270 : WebRtcVideoEngine2Test("WebRTC-SendSideBwe/Enabled/") {}
271 };
272
273 TEST_F(WebRtcVideoEngine2WithSendSideBweTest,
274 SupportsTransportSequenceNumberHeaderExtension) {
275 std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions();
276 ASSERT_FALSE(extensions.empty());
277 for (size_t i = 0; i < extensions.size(); ++i) {
278 if (extensions[i].uri == kRtpTransportSequenceNumberHeaderExtension) {
279 EXPECT_EQ(kRtpTransportSequenceNumberHeaderExtensionDefaultId,
280 extensions[i].id);
281 return;
282 }
283 }
284 FAIL() << "Transport sequence number extension not in header-extension list.";
285 }
286
261 TEST_F(WebRtcVideoEngine2Test, SupportsVideoRotationHeaderExtension) { 287 TEST_F(WebRtcVideoEngine2Test, SupportsVideoRotationHeaderExtension) {
262 std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions(); 288 std::vector<RtpHeaderExtension> extensions = engine_.rtp_header_extensions();
263 ASSERT_FALSE(extensions.empty()); 289 ASSERT_FALSE(extensions.empty());
264 for (size_t i = 0; i < extensions.size(); ++i) { 290 for (size_t i = 0; i < extensions.size(); ++i) {
265 if (extensions[i].uri == kRtpVideoRotationHeaderExtension) { 291 if (extensions[i].uri == kRtpVideoRotationHeaderExtension) {
266 EXPECT_EQ(kRtpVideoRotationHeaderExtensionDefaultId, extensions[i].id); 292 EXPECT_EQ(kRtpVideoRotationHeaderExtensionDefaultId, extensions[i].id);
267 return; 293 return;
268 } 294 }
269 } 295 }
270 FAIL() << "Video Rotation extension not in header-extension list."; 296 FAIL() << "Video Rotation extension not in header-extension list.";
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 codec.width /= 2; 914 codec.width /= 2;
889 codec.height /= 2; 915 codec.height /= 2;
890 EXPECT_TRUE(SetSend(true)); 916 EXPECT_TRUE(SetSend(true));
891 EXPECT_EQ(0, renderer_.num_rendered_frames()); 917 EXPECT_EQ(0, renderer_.num_rendered_frames());
892 EXPECT_TRUE(SendFrame()); 918 EXPECT_TRUE(SendFrame());
893 EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); 919 EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout);
894 } 920 }
895 921
896 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { 922 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
897 public: 923 public:
898 WebRtcVideoChannel2Test() : last_ssrc_(0) {} 924 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {}
925 explicit WebRtcVideoChannel2Test(const char* field_trials)
926 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {}
899 void SetUp() override { 927 void SetUp() override {
900 fake_call_.reset(new FakeCall(webrtc::Call::Config())); 928 fake_call_.reset(new FakeCall(webrtc::Call::Config()));
901 engine_.Init(); 929 engine_.Init();
902 channel_.reset( 930 channel_.reset(
903 engine_.CreateChannel(fake_call_.get(), cricket::VideoOptions())); 931 engine_.CreateChannel(fake_call_.get(), cricket::VideoOptions()));
904 last_ssrc_ = 123; 932 last_ssrc_ = 123;
905 send_parameters_.codecs = engine_.codecs(); 933 send_parameters_.codecs = engine_.codecs();
906 recv_parameters_.codecs = engine_.codecs(); 934 recv_parameters_.codecs = engine_.codecs();
907 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); 935 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_));
908 } 936 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 // Test support for absolute send time header extension. 1192 // Test support for absolute send time header extension.
1165 TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) { 1193 TEST_F(WebRtcVideoChannel2Test, SendAbsoluteSendTimeHeaderExtensions) {
1166 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, 1194 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension,
1167 webrtc::RtpExtension::kAbsSendTime); 1195 webrtc::RtpExtension::kAbsSendTime);
1168 } 1196 }
1169 TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) { 1197 TEST_F(WebRtcVideoChannel2Test, RecvAbsoluteSendTimeHeaderExtensions) {
1170 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension, 1198 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension,
1171 webrtc::RtpExtension::kAbsSendTime); 1199 webrtc::RtpExtension::kAbsSendTime);
1172 } 1200 }
1173 1201
1202 class WebRtcVideoChannel2WithSendSideBweTest : public WebRtcVideoChannel2Test {
1203 public:
1204 WebRtcVideoChannel2WithSendSideBweTest()
1205 : WebRtcVideoChannel2Test("WebRTC-SendSideBwe/Enabled/") {}
1206 };
1207
1208 // Test support for transport sequence number header extension.
1209 TEST_F(WebRtcVideoChannel2WithSendSideBweTest,
1210 SendTransportSequenceNumberHeaderExtensions) {
1211 TestSetSendRtpHeaderExtensions(
1212 kRtpTransportSequenceNumberHeaderExtension,
1213 webrtc::RtpExtension::kTransportSequenceNumber);
1214 }
1215 TEST_F(WebRtcVideoChannel2WithSendSideBweTest,
1216 RecvTransportSequenceNumberHeaderExtensions) {
1217 TestSetRecvRtpHeaderExtensions(
1218 kRtpTransportSequenceNumberHeaderExtension,
1219 webrtc::RtpExtension::kTransportSequenceNumber);
1220 }
1221
1174 // Test support for video rotation header extension. 1222 // Test support for video rotation header extension.
1175 TEST_F(WebRtcVideoChannel2Test, SendVideoRotationHeaderExtensions) { 1223 TEST_F(WebRtcVideoChannel2Test, SendVideoRotationHeaderExtensions) {
1176 TestSetSendRtpHeaderExtensions(kRtpVideoRotationHeaderExtension, 1224 TestSetSendRtpHeaderExtensions(kRtpVideoRotationHeaderExtension,
1177 webrtc::RtpExtension::kVideoRotation); 1225 webrtc::RtpExtension::kVideoRotation);
1178 } 1226 }
1179 TEST_F(WebRtcVideoChannel2Test, RecvVideoRotationHeaderExtensions) { 1227 TEST_F(WebRtcVideoChannel2Test, RecvVideoRotationHeaderExtensions) {
1180 TestSetRecvRtpHeaderExtensions(kRtpVideoRotationHeaderExtension, 1228 TestSetRecvRtpHeaderExtensions(kRtpVideoRotationHeaderExtension,
1181 webrtc::RtpExtension::kVideoRotation); 1229 webrtc::RtpExtension::kVideoRotation);
1182 } 1230 }
1183 1231
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 // Ensures that the correct settings are applied to the codec when two temporal 3241 // Ensures that the correct settings are applied to the codec when two temporal
3194 // layer screencasting is enabled, and that the correct simulcast settings are 3242 // layer screencasting is enabled, and that the correct simulcast settings are
3195 // reapplied when disabling screencasting. 3243 // reapplied when disabling screencasting.
3196 TEST_F(WebRtcVideoChannel2SimulcastTest, 3244 TEST_F(WebRtcVideoChannel2SimulcastTest,
3197 DISABLED_TwoTemporalLayerScreencastSettings) { 3245 DISABLED_TwoTemporalLayerScreencastSettings) {
3198 // TODO(pbos): Implement. 3246 // TODO(pbos): Implement.
3199 FAIL() << "Not implemented."; 3247 FAIL() << "Not implemented.";
3200 } 3248 }
3201 3249
3202 } // namespace cricket 3250 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698