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

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

Issue 1757853002: Make sure rotation is not applied by the capturer if the CVO exenstion is set before the send strea… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 10
11 #ifdef HAVE_WEBRTC_VIDEO
12
13 #include <algorithm> 11 #include <algorithm>
14 #include <map> 12 #include <map>
15 #include <memory> 13 #include <memory>
16 #include <vector> 14 #include <vector>
17 15
18 #include "webrtc/base/arraysize.h" 16 #include "webrtc/base/arraysize.h"
19 #include "webrtc/base/gunit.h" 17 #include "webrtc/base/gunit.h"
20 #include "webrtc/base/stringutils.h" 18 #include "webrtc/base/stringutils.h"
21 #include "webrtc/media/base/testutils.h" 19 #include "webrtc/media/base/testutils.h"
22 #include "webrtc/media/base/videoengine_unittest.h" 20 #include "webrtc/media/base/videoengine_unittest.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 244
247 // Verify capturer has turned off applying rotation. 245 // Verify capturer has turned off applying rotation.
248 EXPECT_FALSE(capturer.GetApplyRotation()); 246 EXPECT_FALSE(capturer.GetApplyRotation());
249 247
250 // Verify removing header extension turns on applying rotation. 248 // Verify removing header extension turns on applying rotation.
251 parameters.extensions.clear(); 249 parameters.extensions.clear();
252 EXPECT_TRUE(channel->SetSendParameters(parameters)); 250 EXPECT_TRUE(channel->SetSendParameters(parameters));
253 EXPECT_TRUE(capturer.GetApplyRotation()); 251 EXPECT_TRUE(capturer.GetApplyRotation());
254 } 252 }
255 253
254 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) {
255 // Allocate the capturer first to prevent early destruction before channel's
256 // dtor is called.
257 cricket::FakeVideoCapturer capturer;
258
259 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
260 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8");
261 cricket::VideoSendParameters parameters;
262 parameters.codecs.push_back(kVp8Codec);
263
264 std::unique_ptr<VideoMediaChannel> channel(
265 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs));
266 // Add CVO extension.
267 const int id = 1;
268 parameters.extensions.push_back(
269 cricket::RtpHeaderExtension(kRtpVideoRotationHeaderExtension, id));
270 EXPECT_TRUE(channel->SetSendParameters(parameters));
271 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
272
273 // Set capturer.
274 EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer));
275
276 // Verify capturer has turned off applying rotation.
277 EXPECT_FALSE(capturer.GetApplyRotation());
278 }
279
256 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) { 280 TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) {
257 cricket::FakeVideoCapturer capturer; 281 cricket::FakeVideoCapturer capturer;
258 282
259 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 283 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
260 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); 284 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8");
261 cricket::VideoSendParameters parameters; 285 cricket::VideoSendParameters parameters;
262 parameters.codecs.push_back(kVp8Codec); 286 parameters.codecs.push_back(kVp8Codec);
263 287
264 std::unique_ptr<VideoMediaChannel> channel( 288 std::unique_ptr<VideoMediaChannel> channel(
265 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); 289 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs));
(...skipping 2915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 3205
3182 // Test that we normalize send codec format size in simulcast. 3206 // Test that we normalize send codec format size in simulcast.
3183 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3207 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3184 cricket::VideoCodec codec(kVp8Codec270p); 3208 cricket::VideoCodec codec(kVp8Codec270p);
3185 codec.width += 1; 3209 codec.width += 1;
3186 codec.height += 1; 3210 codec.height += 1;
3187 VerifySimulcastSettings(codec, 2, 2); 3211 VerifySimulcastSettings(codec, 2, 2);
3188 } 3212 }
3189 } // namespace cricket 3213 } // namespace cricket
3190 3214
3191 #endif // HAVE_WEBRTC_VIDEO
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698