OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 info.Clear(); | 2577 info.Clear(); |
2578 EXPECT_TRUE(channel_->GetStats(&info)); | 2578 EXPECT_TRUE(channel_->GetStats(&info)); |
2579 ASSERT_EQ(1U, info.senders.size()); | 2579 ASSERT_EQ(1U, info.senders.size()); |
2580 EXPECT_EQ(3, info.senders[0].adapt_changes); | 2580 EXPECT_EQ(3, info.senders[0].adapt_changes); |
2581 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_CPU, | 2581 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_CPU, |
2582 info.senders[0].adapt_reason); | 2582 info.senders[0].adapt_reason); |
2583 | 2583 |
2584 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], NULL)); | 2584 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], NULL)); |
2585 } | 2585 } |
2586 | 2586 |
| 2587 TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) { |
| 2588 AddSendStream(cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3))); |
| 2589 |
| 2590 // Capture format VGA. |
| 2591 cricket::FakeVideoCapturer video_capturer_vga; |
| 2592 const std::vector<cricket::VideoFormat>* formats = |
| 2593 video_capturer_vga.GetSupportedFormats(); |
| 2594 cricket::VideoFormat capture_format_vga = (*formats)[1]; |
| 2595 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); |
| 2596 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &video_capturer_vga)); |
| 2597 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
| 2598 |
| 2599 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30, 0); |
| 2600 cricket::VideoSendParameters parameters; |
| 2601 parameters.codecs.push_back(send_codec); |
| 2602 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
| 2603 EXPECT_TRUE(channel_->SetSend(true)); |
| 2604 |
| 2605 // Verify that the CpuOveruseObserver is registered and trigger downgrade. |
| 2606 parameters.options.cpu_overuse_detection = rtc::Optional<bool>(true); |
| 2607 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
| 2608 |
| 2609 // Trigger overuse -> adapt CPU. |
| 2610 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
| 2611 webrtc::LoadObserver* overuse_callback = |
| 2612 fake_call_->GetVideoSendStreams().front()->GetConfig().overuse_callback; |
| 2613 ASSERT_TRUE(overuse_callback != NULL); |
| 2614 overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kOveruse); |
| 2615 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
| 2616 cricket::VideoMediaInfo info; |
| 2617 EXPECT_TRUE(channel_->GetStats(&info)); |
| 2618 ASSERT_EQ(1U, info.senders.size()); |
| 2619 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_CPU, |
| 2620 info.senders[0].adapt_reason); |
| 2621 |
| 2622 // Set bandwidth limitation stats for the stream -> adapt CPU + BW. |
| 2623 webrtc::VideoSendStream::Stats stats; |
| 2624 stats.bw_limited_resolution = true; |
| 2625 fake_call_->GetVideoSendStreams().front()->SetStats(stats); |
| 2626 info.Clear(); |
| 2627 EXPECT_TRUE(channel_->GetStats(&info)); |
| 2628 ASSERT_EQ(1U, info.senders.size()); |
| 2629 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_CPU + |
| 2630 CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH, |
| 2631 info.senders[0].adapt_reason); |
| 2632 |
| 2633 // Trigger upgrade -> adapt BW. |
| 2634 overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kUnderuse); |
| 2635 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
| 2636 info.Clear(); |
| 2637 EXPECT_TRUE(channel_->GetStats(&info)); |
| 2638 ASSERT_EQ(1U, info.senders.size()); |
| 2639 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH, |
| 2640 info.senders[0].adapt_reason); |
| 2641 |
| 2642 // Reset bandwidth limitation state -> adapt NONE. |
| 2643 stats.bw_limited_resolution = false; |
| 2644 fake_call_->GetVideoSendStreams().front()->SetStats(stats); |
| 2645 info.Clear(); |
| 2646 EXPECT_TRUE(channel_->GetStats(&info)); |
| 2647 ASSERT_EQ(1U, info.senders.size()); |
| 2648 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_NONE, |
| 2649 info.senders[0].adapt_reason); |
| 2650 |
| 2651 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], NULL)); |
| 2652 } |
| 2653 |
| 2654 TEST_F(WebRtcVideoChannel2Test, |
| 2655 GetStatsTranslatesBandwidthLimitedResolutionCorrectly) { |
| 2656 FakeVideoSendStream* stream = AddSendStream(); |
| 2657 webrtc::VideoSendStream::Stats stats; |
| 2658 stats.bw_limited_resolution = true; |
| 2659 stream->SetStats(stats); |
| 2660 |
| 2661 cricket::VideoMediaInfo info; |
| 2662 EXPECT_TRUE(channel_->GetStats(&info)); |
| 2663 ASSERT_EQ(1U, info.senders.size()); |
| 2664 EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_BANDWIDTH, |
| 2665 info.senders[0].adapt_reason); |
| 2666 } |
| 2667 |
2587 TEST_F(WebRtcVideoChannel2Test, | 2668 TEST_F(WebRtcVideoChannel2Test, |
2588 GetStatsTranslatesSendRtcpPacketTypesCorrectly) { | 2669 GetStatsTranslatesSendRtcpPacketTypesCorrectly) { |
2589 FakeVideoSendStream* stream = AddSendStream(); | 2670 FakeVideoSendStream* stream = AddSendStream(); |
2590 webrtc::VideoSendStream::Stats stats; | 2671 webrtc::VideoSendStream::Stats stats; |
2591 stats.substreams[17].rtcp_packet_type_counts.fir_packets = 2; | 2672 stats.substreams[17].rtcp_packet_type_counts.fir_packets = 2; |
2592 stats.substreams[17].rtcp_packet_type_counts.nack_packets = 3; | 2673 stats.substreams[17].rtcp_packet_type_counts.nack_packets = 3; |
2593 stats.substreams[17].rtcp_packet_type_counts.pli_packets = 4; | 2674 stats.substreams[17].rtcp_packet_type_counts.pli_packets = 4; |
2594 | 2675 |
2595 stats.substreams[42].rtcp_packet_type_counts.fir_packets = 5; | 2676 stats.substreams[42].rtcp_packet_type_counts.fir_packets = 5; |
2596 stats.substreams[42].rtcp_packet_type_counts.nack_packets = 7; | 2677 stats.substreams[42].rtcp_packet_type_counts.nack_packets = 7; |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 // Ensures that the correct settings are applied to the codec when two temporal | 3418 // Ensures that the correct settings are applied to the codec when two temporal |
3338 // layer screencasting is enabled, and that the correct simulcast settings are | 3419 // layer screencasting is enabled, and that the correct simulcast settings are |
3339 // reapplied when disabling screencasting. | 3420 // reapplied when disabling screencasting. |
3340 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3421 TEST_F(WebRtcVideoChannel2SimulcastTest, |
3341 DISABLED_TwoTemporalLayerScreencastSettings) { | 3422 DISABLED_TwoTemporalLayerScreencastSettings) { |
3342 // TODO(pbos): Implement. | 3423 // TODO(pbos): Implement. |
3343 FAIL() << "Not implemented."; | 3424 FAIL() << "Not implemented."; |
3344 } | 3425 } |
3345 | 3426 |
3346 } // namespace cricket | 3427 } // namespace cricket |
OLD | NEW |