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

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 1847353004: Allow applications to control audio send bitrate through RtpParameters. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More CR feedback Created 4 years, 8 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 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); 3378 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume));
3379 EXPECT_EQ(1, volume); 3379 EXPECT_EQ(1, volume);
3380 session_->SetAudioPlayout(receive_ssrc, false); 3380 session_->SetAudioPlayout(receive_ssrc, false);
3381 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); 3381 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume));
3382 EXPECT_EQ(0, volume); 3382 EXPECT_EQ(0, volume);
3383 session_->SetAudioPlayout(receive_ssrc, true); 3383 session_->SetAudioPlayout(receive_ssrc, true);
3384 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); 3384 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume));
3385 EXPECT_EQ(1, volume); 3385 EXPECT_EQ(1, volume);
3386 } 3386 }
3387 3387
3388 TEST_F(WebRtcSessionTest, AudioMaxSendBitrateNotImplemented) { 3388 TEST_F(WebRtcSessionTest, SetAudioMaxSendBitrate) {
3389 // This test verifies that RtpParameters for audio RtpSenders cannot be
3390 // changed.
3391 // TODO(skvlad): Update the test after adding support for bitrate limiting in
3392 // WebRtcAudioSendStream.
3393
3394 Init(); 3389 Init();
3395 SendAudioVideoStream1(); 3390 SendAudioVideoStream1();
3396 CreateAndSetRemoteOfferAndLocalAnswer(); 3391 CreateAndSetRemoteOfferAndLocalAnswer();
3397 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); 3392 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3398 ASSERT_TRUE(channel != NULL); 3393 ASSERT_TRUE(channel != NULL);
3399 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); 3394 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3395 EXPECT_EQ(-1, channel->max_bps());
3400 webrtc::RtpParameters params = session_->GetAudioRtpParameters(send_ssrc); 3396 webrtc::RtpParameters params = session_->GetAudioRtpParameters(send_ssrc);
3397 EXPECT_EQ(1, params.encodings.size());
pthatcher1 2016/04/12 18:04:23 This should be ASSERT_EQ since the next line may c
3398 EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps);
3399 params.encodings[0].max_bitrate_bps = 1000;
3400 EXPECT_TRUE(session_->SetAudioRtpParameters(send_ssrc, params));
3401 3401
3402 EXPECT_EQ(0, params.encodings.size()); 3402 // Read back the parameters and verify they have been changed.
3403 params.encodings.push_back(webrtc::RtpEncodingParameters()); 3403 params = session_->GetAudioRtpParameters(send_ssrc);
3404 EXPECT_FALSE(session_->SetAudioRtpParameters(send_ssrc, params)); 3404 EXPECT_EQ(1, params.encodings.size());
3405 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
3406
3407 // Verify that the audio channel received the new parameters.
3408 params = channel->GetRtpParameters(send_ssrc);
3409 EXPECT_EQ(1, params.encodings.size());
3410 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
3411
3412 // Verify that the global bitrate limit has not been changed.
3413 EXPECT_EQ(-1, channel->max_bps());
3405 } 3414 }
3406 3415
3407 TEST_F(WebRtcSessionTest, SetAudioSend) { 3416 TEST_F(WebRtcSessionTest, SetAudioSend) {
3408 Init(); 3417 Init();
3409 SendAudioVideoStream1(); 3418 SendAudioVideoStream1();
3410 CreateAndSetRemoteOfferAndLocalAnswer(); 3419 CreateAndSetRemoteOfferAndLocalAnswer();
3411 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); 3420 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3412 ASSERT_TRUE(channel != NULL); 3421 ASSERT_TRUE(channel != NULL);
3413 ASSERT_EQ(1u, channel->send_streams().size()); 3422 ASSERT_EQ(1u, channel->send_streams().size());
3414 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); 3423 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4394 } 4403 }
4395 4404
4396 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4405 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4397 // currently fails because upon disconnection and reconnection OnIceComplete is 4406 // currently fails because upon disconnection and reconnection OnIceComplete is
4398 // called more than once without returning to IceGatheringGathering. 4407 // called more than once without returning to IceGatheringGathering.
4399 4408
4400 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4409 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4401 WebRtcSessionTest, 4410 WebRtcSessionTest,
4402 testing::Values(ALREADY_GENERATED, 4411 testing::Values(ALREADY_GENERATED,
4403 DTLS_IDENTITY_STORE)); 4412 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/base/mediachannel.h » ('j') | webrtc/media/engine/webrtcvoiceengine.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698