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

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

Issue 1181653002: Base A/V synchronization on sync_labels. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 5 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 | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | webrtc/audio_receive_stream.h » ('j') | 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 * libjingle 2 * libjingle
3 * Copyright 2008 Google Inc. 3 * Copyright 2008 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 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3346 CoUninitialize(); 3346 CoUninitialize();
3347 CoUninitialize(); 3347 CoUninitialize();
3348 delete engine; 3348 delete engine;
3349 3349
3350 // Ensure refcount is 0. 3350 // Ensure refcount is 0.
3351 EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED)); 3351 EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
3352 CoUninitialize(); 3352 CoUninitialize();
3353 } 3353 }
3354 #endif 3354 #endif
3355 3355
3356 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) {
3357 cricket::FakeCall call(webrtc::Call::Config(nullptr));
3358 const uint32 kAudioSsrc = 123;
3359 const std::string kSyncLabel = "AvSyncLabel";
3360
3361 EXPECT_TRUE(SetupEngine());
3362 cricket::WebRtcVoiceMediaChannel* media_channel =
3363 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
3364 media_channel->SetCall(&call);
3365 cricket::StreamParams sp = cricket::StreamParams::CreateLegacy(kAudioSsrc);
3366 sp.sync_label = kSyncLabel;
3367 // Creating two channels to make sure that sync label is set properly for both
3368 // the default voice channel and following ones.
3369 EXPECT_TRUE(channel_->AddRecvStream(sp));
3370 sp.ssrcs[0] += 1;
3371 EXPECT_TRUE(channel_->AddRecvStream(sp));
3372
3373 ASSERT_EQ(2, call.GetAudioReceiveStreams().size());
3374 EXPECT_EQ(kSyncLabel,
3375 call.GetAudioReceiveStream(kAudioSsrc)->GetConfig().sync_group)
3376 << "SyncGroup should be set based on sync_label";
3377 EXPECT_EQ(kSyncLabel,
3378 call.GetAudioReceiveStream(kAudioSsrc + 1)->GetConfig().sync_group)
3379 << "SyncGroup should be set based on sync_label";
3380
3381 media_channel->SetCall(nullptr);
3382 }
3383
3356 TEST_F(WebRtcVoiceEngineTestFake, ChangeCombinedBweOption_Call) { 3384 TEST_F(WebRtcVoiceEngineTestFake, ChangeCombinedBweOption_Call) {
3357 // Test that changing the combined_audio_video_bwe option results in the 3385 // Test that changing the combined_audio_video_bwe option results in the
3358 // expected state changes on an associated Call. 3386 // expected state changes on an associated Call.
3359 cricket::FakeCall call(webrtc::Call::Config(nullptr)); 3387 cricket::FakeCall call(webrtc::Call::Config(nullptr));
3360 const uint32 kAudioSsrc1 = 223; 3388 const uint32 kAudioSsrc1 = 223;
3361 const uint32 kAudioSsrc2 = 224; 3389 const uint32 kAudioSsrc2 = 224;
3362 3390
3363 EXPECT_TRUE(SetupEngine()); 3391 EXPECT_TRUE(SetupEngine());
3364 cricket::WebRtcVoiceMediaChannel* media_channel = 3392 cricket::WebRtcVoiceMediaChannel* media_channel =
3365 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); 3393 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_);
3394 const auto& rtp_extensions = engine_.rtp_header_extensions();
3395 media_channel->SetRecvRtpHeaderExtensions(rtp_extensions);
3366 media_channel->SetCall(&call); 3396 media_channel->SetCall(&call);
3367 EXPECT_TRUE(media_channel->AddRecvStream( 3397 EXPECT_TRUE(media_channel->AddRecvStream(
3368 cricket::StreamParams::CreateLegacy(kAudioSsrc1))); 3398 cricket::StreamParams::CreateLegacy(kAudioSsrc1)));
3369 EXPECT_TRUE(media_channel->AddRecvStream( 3399 EXPECT_TRUE(media_channel->AddRecvStream(
3370 cricket::StreamParams::CreateLegacy(kAudioSsrc2))); 3400 cricket::StreamParams::CreateLegacy(kAudioSsrc2)));
3371 3401
3372 // Combined BWE should not be set up yet. 3402 // Combined BWE should not be set up yet (no RTP extensions).
3373 EXPECT_EQ(0, call.GetAudioReceiveStreams().size()); 3403 EXPECT_EQ(2, call.GetAudioReceiveStreams().size());
3404 EXPECT_TRUE(call.GetAudioReceiveStream(kAudioSsrc1)
3405 ->GetConfig()
3406 .rtp.extensions.empty());
3407 EXPECT_TRUE(call.GetAudioReceiveStream(kAudioSsrc2)
3408 ->GetConfig()
3409 .rtp.extensions.empty());
3374 3410
3375 // Enable combined BWE option - now it should be set up. 3411 // Enable combined BWE option - now it should be set up.
3376 cricket::AudioOptions options; 3412 cricket::AudioOptions options;
3377 options.combined_audio_video_bwe.Set(true); 3413 options.combined_audio_video_bwe.Set(true);
3378 EXPECT_TRUE(media_channel->SetOptions(options)); 3414 EXPECT_TRUE(media_channel->SetOptions(options));
3379 EXPECT_EQ(2, call.GetAudioReceiveStreams().size()); 3415 EXPECT_EQ(2, call.GetAudioReceiveStreams().size());
3380 EXPECT_NE(nullptr, call.GetAudioReceiveStream(kAudioSsrc1)); 3416 EXPECT_FALSE(call.GetAudioReceiveStream(kAudioSsrc1)
3381 EXPECT_NE(nullptr, call.GetAudioReceiveStream(kAudioSsrc2)); 3417 ->GetConfig()
3418 .rtp.extensions.empty());
3419 EXPECT_FALSE(call.GetAudioReceiveStream(kAudioSsrc2)
3420 ->GetConfig()
3421 .rtp.extensions.empty());
3382 3422
3383 // Disable combined BWE option - should be disabled again. 3423 // Disable combined BWE option - should be disabled again.
3384 options.combined_audio_video_bwe.Set(false); 3424 options.combined_audio_video_bwe.Set(false);
3385 EXPECT_TRUE(media_channel->SetOptions(options)); 3425 EXPECT_TRUE(media_channel->SetOptions(options));
3386 EXPECT_EQ(0, call.GetAudioReceiveStreams().size()); 3426 EXPECT_EQ(2, call.GetAudioReceiveStreams().size());
3427 EXPECT_TRUE(call.GetAudioReceiveStream(kAudioSsrc1)
3428 ->GetConfig()
3429 .rtp.extensions.empty());
3430 EXPECT_TRUE(call.GetAudioReceiveStream(kAudioSsrc2)
3431 ->GetConfig()
3432 .rtp.extensions.empty());
3387 3433
3388 media_channel->SetCall(nullptr); 3434 media_channel->SetCall(nullptr);
3389 } 3435 }
3390 3436
3391 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBwe_Call) { 3437 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBwe_Call) {
3392 // Test that calling SetCall() on the voice media channel results in the 3438 // Test that calling SetCall() on the voice media channel results in the
3393 // expected state changes in Call. 3439 // expected state changes in Call.
3394 cricket::FakeCall call(webrtc::Call::Config(nullptr)); 3440 cricket::FakeCall call(webrtc::Call::Config(nullptr));
3395 cricket::FakeCall call2(webrtc::Call::Config(nullptr)); 3441 cricket::FakeCall call2(webrtc::Call::Config(nullptr));
3396 const uint32 kAudioSsrc1 = 223; 3442 const uint32 kAudioSsrc1 = 223;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
3613 // deleting logic, i.e., deleting |send_ch| will reset the associate send 3659 // deleting logic, i.e., deleting |send_ch| will reset the associate send
3614 // channel of |recv_ch|.This is not a common case, since, normally, only the 3660 // channel of |recv_ch|.This is not a common case, since, normally, only the
3615 // default channel can be associated. However, the default is not deletable. 3661 // default channel can be associated. However, the default is not deletable.
3616 // So we force the |recv_ch| to associate with a non-default channel. 3662 // So we force the |recv_ch| to associate with a non-default channel.
3617 EXPECT_EQ(0, voe_.AssociateSendChannel(recv_ch, send_ch)); 3663 EXPECT_EQ(0, voe_.AssociateSendChannel(recv_ch, send_ch));
3618 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), send_ch); 3664 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), send_ch);
3619 3665
3620 EXPECT_TRUE(channel_->RemoveSendStream(2)); 3666 EXPECT_TRUE(channel_->RemoveSendStream(2));
3621 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), -1); 3667 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), -1);
3622 } 3668 }
3623
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.cc ('k') | webrtc/audio_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698