OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <algorithm> // max | 10 #include <algorithm> // max |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 namespace webrtc { | 49 namespace webrtc { |
50 | 50 |
51 enum VideoFormat { kGeneric, kVP8, }; | 51 enum VideoFormat { kGeneric, kVP8, }; |
52 | 52 |
53 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, | 53 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, |
54 const std::vector<VideoFrame>& frames2); | 54 const std::vector<VideoFrame>& frames2); |
55 VideoFrame CreateVideoFrame(int width, int height, uint8_t data); | 55 VideoFrame CreateVideoFrame(int width, int height, uint8_t data); |
56 | 56 |
57 class VideoSendStreamTest : public test::CallTest { | 57 class VideoSendStreamTest : public test::CallTest { |
58 protected: | 58 protected: |
59 VideoSendStreamTest() : VideoSendStreamTest(true) {} | |
60 explicit VideoSendStreamTest(bool enable_ulpfec) | |
61 : field_trial_( | |
62 enable_ulpfec ? "" : "WebRTC-DisableUlpFecExperiment/Enabled/") {} | |
63 | |
59 void TestNackRetransmission(uint32_t retransmit_ssrc, | 64 void TestNackRetransmission(uint32_t retransmit_ssrc, |
60 uint8_t retransmit_payload_type); | 65 uint8_t retransmit_payload_type); |
61 void TestPacketFragmentationSize(VideoFormat format, bool with_fec); | 66 void TestPacketFragmentationSize(VideoFormat format, bool with_fec); |
62 | 67 |
63 void TestVp9NonFlexMode(uint8_t num_temporal_layers, | 68 void TestVp9NonFlexMode(uint8_t num_temporal_layers, |
64 uint8_t num_spatial_layers); | 69 uint8_t num_spatial_layers); |
65 | 70 |
66 void TestRequestSourceRotateVideo(bool support_orientation_ext); | 71 void TestRequestSourceRotateVideo(bool support_orientation_ext); |
72 | |
73 test::ScopedFieldTrials field_trial_; | |
67 }; | 74 }; |
68 | 75 |
69 TEST_F(VideoSendStreamTest, CanStartStartedStream) { | 76 TEST_F(VideoSendStreamTest, CanStartStartedStream) { |
70 task_queue_.SendTask([this]() { | 77 task_queue_.SendTask([this]() { |
71 CreateSenderCall(Call::Config(event_log_.get())); | 78 CreateSenderCall(Call::Config(event_log_.get())); |
72 | 79 |
73 test::NullTransport transport; | 80 test::NullTransport transport; |
74 CreateSendConfig(1, 0, 0, &transport); | 81 CreateSendConfig(1, 0, 0, &transport); |
75 CreateVideoStreams(); | 82 CreateVideoStreams(); |
76 video_send_stream_->Start(); | 83 video_send_stream_->Start(); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 UlpfecObserver test(true, false, true, true, "VP8", encoder.get()); | 554 UlpfecObserver test(true, false, true, true, "VP8", encoder.get()); |
548 RunBaseTest(&test); | 555 RunBaseTest(&test); |
549 } | 556 } |
550 | 557 |
551 TEST_F(VideoSendStreamTest, SupportsUlpfecWithoutExtensions) { | 558 TEST_F(VideoSendStreamTest, SupportsUlpfecWithoutExtensions) { |
552 std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create()); | 559 std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create()); |
553 UlpfecObserver test(false, false, true, true, "VP8", encoder.get()); | 560 UlpfecObserver test(false, false, true, true, "VP8", encoder.get()); |
554 RunBaseTest(&test); | 561 RunBaseTest(&test); |
555 } | 562 } |
556 | 563 |
564 class VideoSendStreamWithoutUlpfecTest : public VideoSendStreamTest { | |
565 protected: | |
brandtr
2017/08/23 14:10:44
Maybe put the ScopedFieldTrials as a member of thi
stefan-webrtc
2017/08/23 14:27:08
Yes, I don't know why I did it this way.
| |
566 VideoSendStreamWithoutUlpfecTest() : VideoSendStreamTest(false) {} | |
567 }; | |
568 | |
569 TEST_F(VideoSendStreamWithoutUlpfecTest, NoUlpfecIfDisabledThroughFieldTrial) { | |
570 std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create()); | |
571 UlpfecObserver test(false, false, true, false, "VP8", encoder.get()); | |
572 RunBaseTest(&test); | |
573 } | |
574 | |
557 // The FEC scheme used is not efficient for H264, so we should not use RED/FEC | 575 // The FEC scheme used is not efficient for H264, so we should not use RED/FEC |
558 // since we'll still have to re-request FEC packets, effectively wasting | 576 // since we'll still have to re-request FEC packets, effectively wasting |
559 // bandwidth since the receiver has to wait for FEC retransmissions to determine | 577 // bandwidth since the receiver has to wait for FEC retransmissions to determine |
560 // that the received state is actually decodable. | 578 // that the received state is actually decodable. |
561 TEST_F(VideoSendStreamTest, DoesNotUtilizeUlpfecForH264WithNackEnabled) { | 579 TEST_F(VideoSendStreamTest, DoesNotUtilizeUlpfecForH264WithNackEnabled) { |
562 std::unique_ptr<VideoEncoder> encoder( | 580 std::unique_ptr<VideoEncoder> encoder( |
563 new test::FakeH264Encoder(Clock::GetRealTimeClock())); | 581 new test::FakeH264Encoder(Clock::GetRealTimeClock())); |
564 UlpfecObserver test(false, true, true, false, "H264", encoder.get()); | 582 UlpfecObserver test(false, true, true, false, "H264", encoder.get()); |
565 RunBaseTest(&test); | 583 RunBaseTest(&test); |
566 } | 584 } |
(...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3490 capturer_ = frame_generator_capturer; | 3508 capturer_ = frame_generator_capturer; |
3491 } | 3509 } |
3492 | 3510 |
3493 test::FrameGeneratorCapturer* capturer_ = nullptr; | 3511 test::FrameGeneratorCapturer* capturer_ = nullptr; |
3494 } test; | 3512 } test; |
3495 | 3513 |
3496 RunBaseTest(&test); | 3514 RunBaseTest(&test); |
3497 } | 3515 } |
3498 | 3516 |
3499 } // namespace webrtc | 3517 } // namespace webrtc |
OLD | NEW |