OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 13 matching lines...) Expand all Loading... |
24 #include "webrtc/media/engine/webrtcvideochannelfactory.h" | 24 #include "webrtc/media/engine/webrtcvideochannelfactory.h" |
25 #include "webrtc/media/engine/webrtcvideoengine2.h" | 25 #include "webrtc/media/engine/webrtcvideoengine2.h" |
26 #include "webrtc/media/engine/webrtcvoiceengine.h" | 26 #include "webrtc/media/engine/webrtcvoiceengine.h" |
27 #include "webrtc/test/field_trial.h" | 27 #include "webrtc/test/field_trial.h" |
28 #include "webrtc/video_encoder.h" | 28 #include "webrtc/video_encoder.h" |
29 | 29 |
30 namespace { | 30 namespace { |
31 static const int kDefaultQpMax = 56; | 31 static const int kDefaultQpMax = 56; |
32 static const int kDefaultFramerate = 30; | 32 static const int kDefaultFramerate = 30; |
33 | 33 |
34 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0); | 34 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30); |
35 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); | 35 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30); |
36 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); | 36 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30); |
37 | 37 |
38 static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30, 0); | 38 static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 400, 30); |
39 static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30, 0); | 39 static const cricket::VideoCodec kVp9Codec(101, "VP9", 640, 400, 30); |
40 static const cricket::VideoCodec kH264Codec(102, "H264", 640, 400, 30, 0); | 40 static const cricket::VideoCodec kH264Codec(102, "H264", 640, 400, 30); |
41 | 41 |
42 static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0, 0); | 42 static const cricket::VideoCodec kRedCodec(116, "red", 0, 0, 0); |
43 static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0, 0); | 43 static const cricket::VideoCodec kUlpfecCodec(117, "ulpfec", 0, 0, 0); |
44 | 44 |
45 static const uint8_t kRedRtxPayloadType = 125; | 45 static const uint8_t kRedRtxPayloadType = 125; |
46 | 46 |
47 static const uint32_t kSsrcs1[] = {1}; | 47 static const uint32_t kSsrcs1[] = {1}; |
48 static const uint32_t kSsrcs3[] = {1, 2, 3}; | 48 static const uint32_t kSsrcs3[] = {1, 2, 3}; |
49 static const uint32_t kRtxSsrcs1[] = {4}; | 49 static const uint32_t kRtxSsrcs1[] = {4}; |
50 static const uint32_t kIncomingUnsignalledSsrc = 0xC0FFEE; | 50 static const uint32_t kIncomingUnsignalledSsrc = 0xC0FFEE; |
51 static const char kUnsupportedExtensionName[] = | 51 static const char kUnsupportedExtensionName[] = |
52 "urn:ietf:params:rtp-hdrext:unsupported"; | 52 "urn:ietf:params:rtp-hdrext:unsupported"; |
53 | 53 |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 // TODO(juberti): Restore this test once we support sending 0 fps. | 845 // TODO(juberti): Restore this test once we support sending 0 fps. |
846 WEBRTC_DISABLED_BASE_TEST(AdaptDropAllFrames); | 846 WEBRTC_DISABLED_BASE_TEST(AdaptDropAllFrames); |
847 // TODO(juberti): Understand why we get decode errors on this test. | 847 // TODO(juberti): Understand why we get decode errors on this test. |
848 WEBRTC_DISABLED_BASE_TEST(AdaptFramerate); | 848 WEBRTC_DISABLED_BASE_TEST(AdaptFramerate); |
849 | 849 |
850 WEBRTC_BASE_TEST(SendsLowerResolutionOnSmallerFrames); | 850 WEBRTC_BASE_TEST(SendsLowerResolutionOnSmallerFrames); |
851 | 851 |
852 WEBRTC_BASE_TEST(MultipleSendStreams); | 852 WEBRTC_BASE_TEST(MultipleSendStreams); |
853 | 853 |
854 TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Vga) { | 854 TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Vga) { |
855 SendAndReceive(cricket::VideoCodec(100, "VP8", 640, 400, 30, 0)); | 855 SendAndReceive(cricket::VideoCodec(100, "VP8", 640, 400, 30)); |
856 } | 856 } |
857 | 857 |
858 TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Qvga) { | 858 TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Qvga) { |
859 SendAndReceive(cricket::VideoCodec(100, "VP8", 320, 200, 30, 0)); | 859 SendAndReceive(cricket::VideoCodec(100, "VP8", 320, 200, 30)); |
860 } | 860 } |
861 | 861 |
862 TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8SvcQqvga) { | 862 TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8SvcQqvga) { |
863 SendAndReceive(cricket::VideoCodec(100, "VP8", 160, 100, 30, 0)); | 863 SendAndReceive(cricket::VideoCodec(100, "VP8", 160, 100, 30)); |
864 } | 864 } |
865 | 865 |
866 TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) { | 866 TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) { |
867 Base::TwoStreamsSendAndReceive(kVp8Codec); | 867 Base::TwoStreamsSendAndReceive(kVp8Codec); |
868 } | 868 } |
869 | 869 |
870 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { | 870 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
871 public: | 871 public: |
872 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} | 872 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} |
873 explicit WebRtcVideoChannel2Test(const char* field_trials) | 873 explicit WebRtcVideoChannel2Test(const char* field_trials) |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 FakeVideoSendStream* stream = AddSendStream(); | 2271 FakeVideoSendStream* stream = AddSendStream(); |
2272 webrtc::VideoSendStream::Config config = stream->GetConfig(); | 2272 webrtc::VideoSendStream::Config config = stream->GetConfig(); |
2273 | 2273 |
2274 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); | 2274 EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type); |
2275 EXPECT_EQ(-1, config.rtp.fec.red_payload_type); | 2275 EXPECT_EQ(-1, config.rtp.fec.red_payload_type); |
2276 } | 2276 } |
2277 | 2277 |
2278 TEST_F(WebRtcVideoChannel2Test, | 2278 TEST_F(WebRtcVideoChannel2Test, |
2279 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { | 2279 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { |
2280 cricket::VideoSendParameters parameters; | 2280 cricket::VideoSendParameters parameters; |
2281 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); | 2281 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0); |
2282 parameters.codecs.push_back(rtx_codec); | 2282 parameters.codecs.push_back(rtx_codec); |
2283 EXPECT_FALSE(channel_->SetSendParameters(parameters)) | 2283 EXPECT_FALSE(channel_->SetSendParameters(parameters)) |
2284 << "RTX codec without associated payload type should be rejected."; | 2284 << "RTX codec without associated payload type should be rejected."; |
2285 } | 2285 } |
2286 | 2286 |
2287 TEST_F(WebRtcVideoChannel2Test, | 2287 TEST_F(WebRtcVideoChannel2Test, |
2288 SetSendCodecRejectsRtxWithoutMatchingVideoCodec) { | 2288 SetSendCodecRejectsRtxWithoutMatchingVideoCodec) { |
2289 cricket::VideoSendParameters parameters; | 2289 cricket::VideoSendParameters parameters; |
2290 cricket::VideoCodec rtx_codec = | 2290 cricket::VideoCodec rtx_codec = |
2291 cricket::VideoCodec::CreateRtxCodec(96, kVp8Codec.id); | 2291 cricket::VideoCodec::CreateRtxCodec(96, kVp8Codec.id); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2503 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptAllValidPayloadTypes) { | 2503 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsAcceptAllValidPayloadTypes) { |
2504 cricket::VideoSendParameters parameters; | 2504 cricket::VideoSendParameters parameters; |
2505 parameters.codecs.push_back(kVp8Codec); | 2505 parameters.codecs.push_back(kVp8Codec); |
2506 for (int payload_type = 0; payload_type <= 127; ++payload_type) { | 2506 for (int payload_type = 0; payload_type <= 127; ++payload_type) { |
2507 parameters.codecs[0].id = payload_type; | 2507 parameters.codecs[0].id = payload_type; |
2508 EXPECT_TRUE(channel_->SetSendParameters(parameters)) | 2508 EXPECT_TRUE(channel_->SetSendParameters(parameters)) |
2509 << "Payload type '" << payload_type << "' rejected."; | 2509 << "Payload type '" << payload_type << "' rejected."; |
2510 } | 2510 } |
2511 } | 2511 } |
2512 | 2512 |
| 2513 // Test that setting the a different set of codecs but with an identical front |
| 2514 // codec doesn't result in the stream being recreated. |
| 2515 // This may happen when a subsequent negotiation includes fewer codecs, as a |
| 2516 // result of one of the codecs being rejected. |
| 2517 TEST_F(WebRtcVideoChannel2Test, |
| 2518 SetSendCodecsIdenticalFirstCodecDoesntRecreateStream) { |
| 2519 cricket::VideoSendParameters parameters1; |
| 2520 parameters1.codecs.push_back(kVp8Codec); |
| 2521 parameters1.codecs.push_back(kVp9Codec); |
| 2522 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); |
| 2523 |
| 2524 AddSendStream(); |
| 2525 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); |
| 2526 |
| 2527 cricket::VideoSendParameters parameters2; |
| 2528 parameters2.codecs.push_back(kVp8Codec); |
| 2529 EXPECT_TRUE(channel_->SetSendParameters(parameters2)); |
| 2530 EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); |
| 2531 } |
| 2532 |
2513 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithOnlyVp8) { | 2533 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithOnlyVp8) { |
2514 cricket::VideoRecvParameters parameters; | 2534 cricket::VideoRecvParameters parameters; |
2515 parameters.codecs.push_back(kVp8Codec); | 2535 parameters.codecs.push_back(kVp8Codec); |
2516 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 2536 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
2517 } | 2537 } |
2518 | 2538 |
2519 // Test that we set our inbound RTX codecs properly. | 2539 // Test that we set our inbound RTX codecs properly. |
2520 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithRtx) { | 2540 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithRtx) { |
2521 cricket::VideoRecvParameters parameters; | 2541 cricket::VideoRecvParameters parameters; |
2522 parameters.codecs.push_back(kVp8Codec); | 2542 parameters.codecs.push_back(kVp8Codec); |
2523 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); | 2543 cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0); |
2524 parameters.codecs.push_back(rtx_codec); | 2544 parameters.codecs.push_back(rtx_codec); |
2525 EXPECT_FALSE(channel_->SetRecvParameters(parameters)) | 2545 EXPECT_FALSE(channel_->SetRecvParameters(parameters)) |
2526 << "RTX codec without associated payload should be rejected."; | 2546 << "RTX codec without associated payload should be rejected."; |
2527 | 2547 |
2528 parameters.codecs[1].SetParam("apt", kVp8Codec.id + 1); | 2548 parameters.codecs[1].SetParam("apt", kVp8Codec.id + 1); |
2529 EXPECT_FALSE(channel_->SetRecvParameters(parameters)) | 2549 EXPECT_FALSE(channel_->SetRecvParameters(parameters)) |
2530 << "RTX codec with invalid associated payload type should be rejected."; | 2550 << "RTX codec with invalid associated payload type should be rejected."; |
2531 | 2551 |
2532 parameters.codecs[1].SetParam("apt", kVp8Codec.id); | 2552 parameters.codecs[1].SetParam("apt", kVp8Codec.id); |
2533 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 2553 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
2534 | 2554 |
2535 cricket::VideoCodec rtx_codec2(97, "rtx", 0, 0, 0, 0); | 2555 cricket::VideoCodec rtx_codec2(97, "rtx", 0, 0, 0); |
2536 rtx_codec2.SetParam("apt", rtx_codec.id); | 2556 rtx_codec2.SetParam("apt", rtx_codec.id); |
2537 parameters.codecs.push_back(rtx_codec2); | 2557 parameters.codecs.push_back(rtx_codec2); |
2538 | 2558 |
2539 EXPECT_FALSE(channel_->SetRecvParameters(parameters)) << | 2559 EXPECT_FALSE(channel_->SetRecvParameters(parameters)) << |
2540 "RTX codec with another RTX as associated payload type should be " | 2560 "RTX codec with another RTX as associated payload type should be " |
2541 "rejected."; | 2561 "rejected."; |
2542 } | 2562 } |
2543 | 2563 |
2544 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsDifferentPayloadType) { | 2564 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsDifferentPayloadType) { |
2545 cricket::VideoRecvParameters parameters; | 2565 cricket::VideoRecvParameters parameters; |
2546 parameters.codecs.push_back(kVp8Codec); | 2566 parameters.codecs.push_back(kVp8Codec); |
2547 parameters.codecs[0].id = 99; | 2567 parameters.codecs[0].id = 99; |
2548 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 2568 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
2549 } | 2569 } |
2550 | 2570 |
2551 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) { | 2571 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsAcceptDefaultCodecs) { |
2552 cricket::VideoRecvParameters parameters; | 2572 cricket::VideoRecvParameters parameters; |
2553 parameters.codecs = engine_.codecs(); | 2573 parameters.codecs = engine_.codecs(); |
2554 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 2574 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
2555 | 2575 |
2556 FakeVideoReceiveStream* stream = AddRecvStream(); | 2576 FakeVideoReceiveStream* stream = AddRecvStream(); |
2557 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); | 2577 webrtc::VideoReceiveStream::Config config = stream->GetConfig(); |
2558 EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].payload_name); | 2578 EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].payload_name); |
2559 EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type); | 2579 EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type); |
2560 } | 2580 } |
2561 | 2581 |
2562 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { | 2582 TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsRejectUnsupportedCodec) { |
2563 cricket::VideoRecvParameters parameters; | 2583 cricket::VideoRecvParameters parameters; |
2564 parameters.codecs.push_back(kVp8Codec); | 2584 parameters.codecs.push_back(kVp8Codec); |
2565 parameters.codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30, 0)); | 2585 parameters.codecs.push_back(VideoCodec(101, "WTF3", 640, 400, 30)); |
2566 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); | 2586 EXPECT_FALSE(channel_->SetRecvParameters(parameters)); |
2567 } | 2587 } |
2568 | 2588 |
2569 // TODO(pbos): Enable VP9 through external codec support | 2589 // TODO(pbos): Enable VP9 through external codec support |
2570 TEST_F(WebRtcVideoChannel2Test, | 2590 TEST_F(WebRtcVideoChannel2Test, |
2571 DISABLED_SetRecvCodecsAcceptsMultipleVideoCodecs) { | 2591 DISABLED_SetRecvCodecsAcceptsMultipleVideoCodecs) { |
2572 cricket::VideoRecvParameters parameters; | 2592 cricket::VideoRecvParameters parameters; |
2573 parameters.codecs.push_back(kVp8Codec); | 2593 parameters.codecs.push_back(kVp8Codec); |
2574 parameters.codecs.push_back(kVp9Codec); | 2594 parameters.codecs.push_back(kVp9Codec); |
2575 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 2595 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2623 | 2643 |
2624 TEST_F(WebRtcVideoChannel2Test, | 2644 TEST_F(WebRtcVideoChannel2Test, |
2625 SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { | 2645 SetRecvCodecsAcceptSameCodecOnMultiplePayloadTypes) { |
2626 cricket::VideoRecvParameters parameters; | 2646 cricket::VideoRecvParameters parameters; |
2627 parameters.codecs.push_back(kVp8Codec); | 2647 parameters.codecs.push_back(kVp8Codec); |
2628 parameters.codecs.push_back(kVp8Codec); | 2648 parameters.codecs.push_back(kVp8Codec); |
2629 parameters.codecs[1].id += 1; | 2649 parameters.codecs[1].id += 1; |
2630 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 2650 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
2631 } | 2651 } |
2632 | 2652 |
2633 // Test that setting the same codecs but with a different order and preference | 2653 // Test that setting the same codecs but with a different order |
2634 // doesn't result in the stream being recreated. | 2654 // doesn't result in the stream being recreated. |
2635 TEST_F(WebRtcVideoChannel2Test, | 2655 TEST_F(WebRtcVideoChannel2Test, |
2636 SetRecvCodecsDifferentOrderAndPreferenceDoesntRecreateStream) { | 2656 SetRecvCodecsDifferentOrderDoesntRecreateStream) { |
2637 cricket::VideoRecvParameters parameters1; | 2657 cricket::VideoRecvParameters parameters1; |
2638 parameters1.codecs.push_back(kVp8Codec); | 2658 parameters1.codecs.push_back(kVp8Codec); |
2639 parameters1.codecs.push_back(kRedCodec); | 2659 parameters1.codecs.push_back(kRedCodec); |
2640 EXPECT_TRUE(channel_->SetRecvParameters(parameters1)); | 2660 EXPECT_TRUE(channel_->SetRecvParameters(parameters1)); |
2641 | 2661 |
2642 AddRecvStream(cricket::StreamParams::CreateLegacy(123)); | 2662 AddRecvStream(cricket::StreamParams::CreateLegacy(123)); |
2643 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams()); | 2663 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams()); |
2644 | 2664 |
2645 cricket::VideoRecvParameters parameters2; | 2665 cricket::VideoRecvParameters parameters2; |
2646 parameters2.codecs.push_back(kRedCodec); | 2666 parameters2.codecs.push_back(kRedCodec); |
2647 parameters2.codecs.push_back(kVp8Codec); | 2667 parameters2.codecs.push_back(kVp8Codec); |
2648 parameters2.codecs[1].preference += 1; | |
2649 EXPECT_TRUE(channel_->SetRecvParameters(parameters2)); | 2668 EXPECT_TRUE(channel_->SetRecvParameters(parameters2)); |
2650 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams()); | 2669 EXPECT_EQ(1, fake_call_->GetNumCreatedReceiveStreams()); |
2651 } | 2670 } |
2652 | 2671 |
2653 TEST_F(WebRtcVideoChannel2Test, SendStreamNotSendingByDefault) { | 2672 TEST_F(WebRtcVideoChannel2Test, SendStreamNotSendingByDefault) { |
2654 EXPECT_FALSE(AddSendStream()->IsSending()); | 2673 EXPECT_FALSE(AddSendStream()->IsSending()); |
2655 } | 2674 } |
2656 | 2675 |
2657 TEST_F(WebRtcVideoChannel2Test, ReceiveStreamReceivingByDefault) { | 2676 TEST_F(WebRtcVideoChannel2Test, ReceiveStreamReceivingByDefault) { |
2658 EXPECT_TRUE(AddRecvStream()->IsReceiving()); | 2677 EXPECT_TRUE(AddRecvStream()->IsReceiving()); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 | 2842 |
2824 // Capture format VGA. | 2843 // Capture format VGA. |
2825 cricket::FakeVideoCapturer video_capturer_vga; | 2844 cricket::FakeVideoCapturer video_capturer_vga; |
2826 const std::vector<cricket::VideoFormat>* formats = | 2845 const std::vector<cricket::VideoFormat>* formats = |
2827 video_capturer_vga.GetSupportedFormats(); | 2846 video_capturer_vga.GetSupportedFormats(); |
2828 cricket::VideoFormat capture_format_vga = (*formats)[1]; | 2847 cricket::VideoFormat capture_format_vga = (*formats)[1]; |
2829 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); | 2848 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); |
2830 channel_->SetSource(kSsrcs3[0], &video_capturer_vga); | 2849 channel_->SetSource(kSsrcs3[0], &video_capturer_vga); |
2831 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); | 2850 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
2832 | 2851 |
2833 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30, 0); | 2852 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30); |
2834 cricket::VideoSendParameters parameters; | 2853 cricket::VideoSendParameters parameters; |
2835 parameters.codecs.push_back(send_codec); | 2854 parameters.codecs.push_back(send_codec); |
2836 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2855 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2837 EXPECT_TRUE(channel_->SetSend(true)); | 2856 EXPECT_TRUE(channel_->SetSend(true)); |
2838 | 2857 |
2839 // Verify that the CpuOveruseObserver is registered and trigger downgrade. | 2858 // Verify that the CpuOveruseObserver is registered and trigger downgrade. |
2840 | 2859 |
2841 // Trigger overuse. | 2860 // Trigger overuse. |
2842 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); | 2861 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
2843 webrtc::LoadObserver* overuse_callback = | 2862 webrtc::LoadObserver* overuse_callback = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 | 2915 |
2897 // Capture format VGA. | 2916 // Capture format VGA. |
2898 cricket::FakeVideoCapturer video_capturer_vga; | 2917 cricket::FakeVideoCapturer video_capturer_vga; |
2899 const std::vector<cricket::VideoFormat>* formats = | 2918 const std::vector<cricket::VideoFormat>* formats = |
2900 video_capturer_vga.GetSupportedFormats(); | 2919 video_capturer_vga.GetSupportedFormats(); |
2901 cricket::VideoFormat capture_format_vga = (*formats)[1]; | 2920 cricket::VideoFormat capture_format_vga = (*formats)[1]; |
2902 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); | 2921 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); |
2903 channel_->SetSource(kSsrcs3[0], &video_capturer_vga); | 2922 channel_->SetSource(kSsrcs3[0], &video_capturer_vga); |
2904 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); | 2923 EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
2905 | 2924 |
2906 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30, 0); | 2925 cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30); |
2907 cricket::VideoSendParameters parameters; | 2926 cricket::VideoSendParameters parameters; |
2908 parameters.codecs.push_back(send_codec); | 2927 parameters.codecs.push_back(send_codec); |
2909 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2928 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2910 EXPECT_TRUE(channel_->SetSend(true)); | 2929 EXPECT_TRUE(channel_->SetSend(true)); |
2911 | 2930 |
2912 // Verify that the CpuOveruseObserver is registered and trigger downgrade. | 2931 // Verify that the CpuOveruseObserver is registered and trigger downgrade. |
2913 | 2932 |
2914 // Trigger overuse -> adapt CPU. | 2933 // Trigger overuse -> adapt CPU. |
2915 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); | 2934 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
2916 webrtc::LoadObserver* overuse_callback = | 2935 webrtc::LoadObserver* overuse_callback = |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3580 } | 3599 } |
3581 | 3600 |
3582 // Test that we normalize send codec format size in simulcast. | 3601 // Test that we normalize send codec format size in simulcast. |
3583 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3602 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3584 cricket::VideoCodec codec(kVp8Codec270p); | 3603 cricket::VideoCodec codec(kVp8Codec270p); |
3585 codec.width += 1; | 3604 codec.width += 1; |
3586 codec.height += 1; | 3605 codec.height += 1; |
3587 VerifySimulcastSettings(codec, 2, 2); | 3606 VerifySimulcastSettings(codec, 2, 2); |
3588 } | 3607 } |
3589 } // namespace cricket | 3608 } // namespace cricket |
OLD | NEW |