Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3326 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); | 3326 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); |
| 3327 EXPECT_EQ(1, volume); | 3327 EXPECT_EQ(1, volume); |
| 3328 session_->SetAudioPlayout(receive_ssrc, false); | 3328 session_->SetAudioPlayout(receive_ssrc, false); |
| 3329 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); | 3329 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); |
| 3330 EXPECT_EQ(0, volume); | 3330 EXPECT_EQ(0, volume); |
| 3331 session_->SetAudioPlayout(receive_ssrc, true); | 3331 session_->SetAudioPlayout(receive_ssrc, true); |
| 3332 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); | 3332 EXPECT_TRUE(channel->GetOutputVolume(receive_ssrc, &volume)); |
| 3333 EXPECT_EQ(1, volume); | 3333 EXPECT_EQ(1, volume); |
| 3334 } | 3334 } |
| 3335 | 3335 |
| 3336 TEST_F(WebRtcSessionTest, SetAudioMaxSendBitrate) { | |
| 3337 Init(); | |
| 3338 SendAudioVideoStream1(); | |
| 3339 CreateAndSetRemoteOfferAndLocalAnswer(); | |
| 3340 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); | |
| 3341 ASSERT_TRUE(channel != NULL); | |
| 3342 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | |
| 3343 EXPECT_EQ(-1, channel->max_bps()); | |
| 3344 webrtc::RTCRtpParameters params = session_->GetAudioRtpParameters(send_ssrc); | |
| 3345 EXPECT_EQ(1, params.encodings.size()); | |
| 3346 EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps); | |
| 3347 params.encodings[0].max_bitrate_bps = 1000; | |
| 3348 EXPECT_TRUE(session_->SetAudioRtpParameters(send_ssrc, params)); | |
| 3349 | |
| 3350 // Verify that the media channel received the new parameters | |
|
Taylor Brandstetter
2016/03/12 01:57:06
nit: Add periods at the end of comments like this.
skvlad
2016/03/15 21:18:18
Done.
| |
| 3351 params = channel->GetRtpParameters(send_ssrc); | |
| 3352 EXPECT_EQ(1, params.encodings.size()); | |
| 3353 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); | |
| 3354 | |
| 3355 // Verify that reading back the parameters returns the same | |
| 3356 // value as what has been set previously | |
| 3357 params = session_->GetAudioRtpParameters(send_ssrc); | |
| 3358 EXPECT_EQ(1, params.encodings.size()); | |
| 3359 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); | |
| 3360 | |
| 3361 // Verify that the global bitrate limit (coming from SDP) has | |
| 3362 // not been changed | |
| 3363 EXPECT_EQ(-1, channel->max_bps()); | |
| 3364 } | |
| 3365 | |
| 3336 TEST_F(WebRtcSessionTest, SetAudioSend) { | 3366 TEST_F(WebRtcSessionTest, SetAudioSend) { |
| 3337 Init(); | 3367 Init(); |
| 3338 SendAudioVideoStream1(); | 3368 SendAudioVideoStream1(); |
| 3339 CreateAndSetRemoteOfferAndLocalAnswer(); | 3369 CreateAndSetRemoteOfferAndLocalAnswer(); |
| 3340 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); | 3370 cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); |
| 3341 ASSERT_TRUE(channel != NULL); | 3371 ASSERT_TRUE(channel != NULL); |
| 3342 ASSERT_EQ(1u, channel->send_streams().size()); | 3372 ASSERT_EQ(1u, channel->send_streams().size()); |
| 3343 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | 3373 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
| 3344 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); | 3374 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); |
| 3345 | 3375 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3392 EXPECT_TRUE(channel->sinks().begin()->second == NULL); | 3422 EXPECT_TRUE(channel->sinks().begin()->second == NULL); |
| 3393 ASSERT_EQ(1u, channel->recv_streams().size()); | 3423 ASSERT_EQ(1u, channel->recv_streams().size()); |
| 3394 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); | 3424 uint32_t receive_ssrc = channel->recv_streams()[0].first_ssrc(); |
| 3395 cricket::FakeVideoRenderer renderer; | 3425 cricket::FakeVideoRenderer renderer; |
| 3396 session_->SetVideoPlayout(receive_ssrc, true, &renderer); | 3426 session_->SetVideoPlayout(receive_ssrc, true, &renderer); |
| 3397 EXPECT_TRUE(channel->sinks().begin()->second == &renderer); | 3427 EXPECT_TRUE(channel->sinks().begin()->second == &renderer); |
| 3398 session_->SetVideoPlayout(receive_ssrc, false, &renderer); | 3428 session_->SetVideoPlayout(receive_ssrc, false, &renderer); |
| 3399 EXPECT_TRUE(channel->sinks().begin()->second == NULL); | 3429 EXPECT_TRUE(channel->sinks().begin()->second == NULL); |
| 3400 } | 3430 } |
| 3401 | 3431 |
| 3432 TEST_F(WebRtcSessionTest, SetVideoMaxSendBitrate) { | |
| 3433 Init(); | |
| 3434 SendAudioVideoStream1(); | |
| 3435 CreateAndSetRemoteOfferAndLocalAnswer(); | |
| 3436 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); | |
| 3437 ASSERT_TRUE(channel != NULL); | |
| 3438 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | |
| 3439 EXPECT_EQ(-1, channel->max_bps()); | |
| 3440 webrtc::RTCRtpParameters params = session_->GetVideoRtpParameters(send_ssrc); | |
| 3441 EXPECT_EQ(1, params.encodings.size()); | |
| 3442 EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps); | |
| 3443 params.encodings[0].max_bitrate_bps = 1000; | |
| 3444 EXPECT_TRUE(session_->SetVideoRtpParameters(send_ssrc, params)); | |
| 3445 | |
| 3446 // Read back the parameters and verify they have been changed | |
| 3447 params = session_->GetVideoRtpParameters(send_ssrc); | |
| 3448 EXPECT_EQ(1, params.encodings.size()); | |
| 3449 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); | |
| 3450 | |
| 3451 // Verify that the video channel received the new parameters | |
| 3452 params = channel->GetRtpParameters(send_ssrc); | |
| 3453 EXPECT_EQ(1, params.encodings.size()); | |
| 3454 EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); | |
| 3455 | |
| 3456 // Verify that the global bitrate limit has not been changed | |
| 3457 EXPECT_EQ(-1, channel->max_bps()); | |
| 3458 } | |
| 3459 | |
| 3402 TEST_F(WebRtcSessionTest, SetVideoSend) { | 3460 TEST_F(WebRtcSessionTest, SetVideoSend) { |
| 3403 Init(); | 3461 Init(); |
| 3404 SendAudioVideoStream1(); | 3462 SendAudioVideoStream1(); |
| 3405 CreateAndSetRemoteOfferAndLocalAnswer(); | 3463 CreateAndSetRemoteOfferAndLocalAnswer(); |
| 3406 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); | 3464 cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); |
| 3407 ASSERT_TRUE(channel != NULL); | 3465 ASSERT_TRUE(channel != NULL); |
| 3408 ASSERT_EQ(1u, channel->send_streams().size()); | 3466 ASSERT_EQ(1u, channel->send_streams().size()); |
| 3409 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); | 3467 uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
| 3410 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); | 3468 EXPECT_FALSE(channel->IsStreamMuted(send_ssrc)); |
| 3411 cricket::VideoOptions* options = NULL; | 3469 cricket::VideoOptions* options = NULL; |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4331 } | 4389 } |
| 4332 | 4390 |
| 4333 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4391 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
| 4334 // currently fails because upon disconnection and reconnection OnIceComplete is | 4392 // currently fails because upon disconnection and reconnection OnIceComplete is |
| 4335 // called more than once without returning to IceGatheringGathering. | 4393 // called more than once without returning to IceGatheringGathering. |
| 4336 | 4394 |
| 4337 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4395 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
| 4338 WebRtcSessionTest, | 4396 WebRtcSessionTest, |
| 4339 testing::Values(ALREADY_GENERATED, | 4397 testing::Values(ALREADY_GENERATED, |
| 4340 DTLS_IDENTITY_STORE)); | 4398 DTLS_IDENTITY_STORE)); |
| OLD | NEW |