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

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

Issue 1788583004: Enable setting the maximum bitrate limit in RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased on top of the latest master branch 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/api/webrtcsession.cc ('k') | webrtc/media/base/fakemediaengine.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 * 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) {
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();
3395 SendAudioVideoStream1();
3396 CreateAndSetRemoteOfferAndLocalAnswer();
3397 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3398 ASSERT_TRUE(channel != NULL);
3399 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3400 webrtc::RtpParameters params = session_->GetAudioRtpParameters(send_ssrc);
3401
3402 EXPECT_EQ(0, params.encodings.size());
3403 params.encodings.push_back(webrtc::RtpEncodingParameters());
3404 EXPECT_FALSE(session_->SetAudioRtpParameters(send_ssrc, params));
3405 }
3406
3388 TEST_F(WebRtcSessionTest, SetAudioSend) { 3407 TEST_F(WebRtcSessionTest, SetAudioSend) {
3389 Init(); 3408 Init();
3390 SendAudioVideoStream1(); 3409 SendAudioVideoStream1();
3391 CreateAndSetRemoteOfferAndLocalAnswer(); 3410 CreateAndSetRemoteOfferAndLocalAnswer();
3392 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); 3411 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0);
3393 ASSERT_TRUE(channel != NULL); 3412 ASSERT_TRUE(channel != NULL);
3394 ASSERT_EQ(1u, channel->send_streams().size()); 3413 ASSERT_EQ(1u, channel->send_streams().size());
3395 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); 3414 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3396 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); 3415 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
3397 3416
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 EXPECT_TRUE(channel->sinks().begin()->second == NULL); 3463 EXPECT_TRUE(channel->sinks().begin()->second == NULL);
3445 ASSERT_EQ(1u, channel->recv_streams().size()); 3464 ASSERT_EQ(1u, channel->recv_streams().size());
3446 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); 3465 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc();
3447 cricket::FakeVideoRenderer renderer; 3466 cricket::FakeVideoRenderer renderer;
3448 session_->SetVideoPlayout(receive_ssrc, true, &renderer); 3467 session_->SetVideoPlayout(receive_ssrc, true, &renderer);
3449 EXPECT_TRUE(channel->sinks().begin()->second == &renderer); 3468 EXPECT_TRUE(channel->sinks().begin()->second == &renderer);
3450 session_->SetVideoPlayout(receive_ssrc, false, &renderer); 3469 session_->SetVideoPlayout(receive_ssrc, false, &renderer);
3451 EXPECT_TRUE(channel->sinks().begin()->second == NULL); 3470 EXPECT_TRUE(channel->sinks().begin()->second == NULL);
3452 } 3471 }
3453 3472
3473 TEST_F(WebRtcSessionTest, SetVideoMaxSendBitrate) {
3474 Init();
3475 SendAudioVideoStream1();
3476 CreateAndSetRemoteOfferAndLocalAnswer();
3477 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
3478 ASSERT_TRUE(channel != NULL);
3479 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3480 EXPECT_EQ(-1, channel->max_bps());
3481 webrtc::RtpParameters params = session_->GetVideoRtpParameters(send_ssrc);
3482 EXPECT_EQ(1, params.encodings.size());
3483 EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps);
3484 params.encodings[0].max_bitrate_bps = 1000;
3485 EXPECT_TRUE(session_->SetVideoRtpParameters(send_ssrc, params));
3486
3487 // Read back the parameters and verify they have been changed.
3488 params = session_->GetVideoRtpParameters(send_ssrc);
3489 EXPECT_EQ(1, params.encodings.size());
3490 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
3491
3492 // Verify that the video channel received the new parameters.
3493 params = channel->GetRtpParameters(send_ssrc);
3494 EXPECT_EQ(1, params.encodings.size());
3495 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
3496
3497 // Verify that the global bitrate limit has not been changed.
3498 EXPECT_EQ(-1, channel->max_bps());
3499 }
3500
3454 TEST_F(WebRtcSessionTest, SetVideoSend) { 3501 TEST_F(WebRtcSessionTest, SetVideoSend) {
3455 Init(); 3502 Init();
3456 SendAudioVideoStream1(); 3503 SendAudioVideoStream1();
3457 CreateAndSetRemoteOfferAndLocalAnswer(); 3504 CreateAndSetRemoteOfferAndLocalAnswer();
3458 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); 3505 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0);
3459 ASSERT_TRUE(channel != NULL); 3506 ASSERT_TRUE(channel != NULL);
3460 ASSERT_EQ(1u, channel->send_streams().size()); 3507 ASSERT_EQ(1u, channel->send_streams().size());
3461 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); 3508 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc();
3462 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); 3509 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc));
3463 cricket::VideoOptions* options = NULL; 3510 cricket::VideoOptions* options = NULL;
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
4347 } 4394 }
4348 4395
4349 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4396 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4350 // currently fails because upon disconnection and reconnection OnIceComplete is 4397 // currently fails because upon disconnection and reconnection OnIceComplete is
4351 // called more than once without returning to IceGatheringGathering. 4398 // called more than once without returning to IceGatheringGathering.
4352 4399
4353 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4400 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4354 WebRtcSessionTest, 4401 WebRtcSessionTest,
4355 testing::Values(ALREADY_GENERATED, 4402 testing::Values(ALREADY_GENERATED,
4356 DTLS_IDENTITY_STORE)); 4403 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/media/base/fakemediaengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698