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 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/base/arraysize.h" | 16 #include "webrtc/base/arraysize.h" |
17 #include "webrtc/base/gunit.h" | 17 #include "webrtc/base/gunit.h" |
18 #include "webrtc/base/stringutils.h" | 18 #include "webrtc/base/stringutils.h" |
19 #include "webrtc/call/flexfec_receive_stream.h" | 19 #include "webrtc/call/flexfec_receive_stream.h" |
20 #include "webrtc/common_video/h264/profile_level_id.h" | 20 #include "webrtc/common_video/h264/profile_level_id.h" |
21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
22 #include "webrtc/media/base/mediaconstants.h" | 22 #include "webrtc/media/base/mediaconstants.h" |
23 #include "webrtc/media/base/rtputils.h" | |
23 #include "webrtc/media/base/testutils.h" | 24 #include "webrtc/media/base/testutils.h" |
24 #include "webrtc/media/base/videoengine_unittest.h" | 25 #include "webrtc/media/base/videoengine_unittest.h" |
25 #include "webrtc/media/engine/constants.h" | 26 #include "webrtc/media/engine/constants.h" |
26 #include "webrtc/media/engine/fakewebrtccall.h" | 27 #include "webrtc/media/engine/fakewebrtccall.h" |
27 #include "webrtc/media/engine/fakewebrtcvideoengine.h" | 28 #include "webrtc/media/engine/fakewebrtcvideoengine.h" |
28 #include "webrtc/media/engine/simulcast.h" | 29 #include "webrtc/media/engine/simulcast.h" |
29 #include "webrtc/media/engine/webrtcvideoengine2.h" | 30 #include "webrtc/media/engine/webrtcvideoengine2.h" |
30 #include "webrtc/media/engine/webrtcvoiceengine.h" | 31 #include "webrtc/media/engine/webrtcvoiceengine.h" |
31 #include "webrtc/test/field_trial.h" | 32 #include "webrtc/test/field_trial.h" |
32 #include "webrtc/video_encoder.h" | 33 #include "webrtc/video_encoder.h" |
(...skipping 3714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3747 FlexfecPacketDoesntCreateUnsignalledStream) { | 3748 FlexfecPacketDoesntCreateUnsignalledStream) { |
3748 TestReceiveUnsignaledSsrcPacket(GetEngineCodec("flexfec-03").id, | 3749 TestReceiveUnsignaledSsrcPacket(GetEngineCodec("flexfec-03").id, |
3749 false /* expect_created_receive_stream */); | 3750 false /* expect_created_receive_stream */); |
3750 } | 3751 } |
3751 | 3752 |
3752 TEST_F(WebRtcVideoChannel2Test, RedRtxPacketDoesntCreateUnsignalledStream) { | 3753 TEST_F(WebRtcVideoChannel2Test, RedRtxPacketDoesntCreateUnsignalledStream) { |
3753 TestReceiveUnsignaledSsrcPacket(kRedRtxPayloadType, | 3754 TestReceiveUnsignaledSsrcPacket(kRedRtxPayloadType, |
3754 false /* expect_created_receive_stream */); | 3755 false /* expect_created_receive_stream */); |
3755 } | 3756 } |
3756 | 3757 |
3758 // Test that receiving any unsignalled SSRC works even if it changes. | |
3759 // The first unsignalled SSRC received will create a default receive stream. | |
3760 // Any different unsignalled SSRC received will replace the default. | |
3761 TEST_F(WebRtcVideoChannel2Test, RecvDiffUnsignalledSsrc) { | |
Taylor Brandstetter
2017/02/16 00:36:34
nit: "ReceiveDifferentUnsignaledSsrcs"
mo.zanaty
2017/02/17 00:43:04
Done.
| |
3762 | |
3763 // Allow receiving VP8, VP9, H264 (if enabled) | |
Taylor Brandstetter
2017/02/16 00:36:34
nit: Our style is to have periods even after one-l
mo.zanaty
2017/02/17 00:43:03
Done.
| |
3764 cricket::VideoRecvParameters parameters; | |
3765 parameters.codecs.push_back(GetEngineCodec("VP8")); | |
3766 parameters.codecs.push_back(GetEngineCodec("VP9")); | |
3767 | |
3768 #if defined(WEBRTC_USE_H264) | |
3769 cricket::VideoCodec H264codec(126, "H264"); | |
3770 parameters.codecs.push_back(H264codec); | |
3771 #endif | |
3772 | |
3773 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | |
3774 // No receive streams yet | |
3775 ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size()); | |
Taylor Brandstetter
2017/02/16 00:36:34
To make this test more robust, it would also be go
mo.zanaty
2017/02/17 00:43:03
Done.
| |
3776 | |
3777 // Receive VP8 packet on first SSRC | |
3778 uint8_t data[kMinRtpPacketLen]; | |
3779 cricket::RtpHeader rtpHeader; | |
3780 rtpHeader.payload_type = GetEngineCodec("VP8").id; | |
3781 rtpHeader.seq_num = rtpHeader.timestamp = 0; | |
3782 rtpHeader.ssrc = kIncomingUnsignalledSsrc+1; | |
3783 cricket::SetRtpHeader(data, sizeof(data), rtpHeader); | |
3784 rtc::CopyOnWriteBuffer packet(data, sizeof(data)); | |
3785 rtc::PacketTime packet_time; | |
3786 channel_->OnPacketReceived(&packet, packet_time); | |
3787 // VP8 packet should create default receive stream | |
3788 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()); | |
3789 FakeVideoReceiveStream* recv_stream = | |
3790 fake_call_->GetVideoReceiveStreams()[0]; | |
3791 EXPECT_EQ(rtpHeader.ssrc, recv_stream->GetConfig().rtp.remote_ssrc); | |
Taylor Brandstetter
2017/02/16 00:36:34
Then here, you can do:
recv_stream->InjectFrame(f
mo.zanaty
2017/02/17 00:43:03
Done.
| |
3792 | |
3793 // Receive VP9 packet on second SSRC | |
3794 rtpHeader.payload_type = GetEngineCodec("VP9").id; | |
3795 rtpHeader.ssrc = kIncomingUnsignalledSsrc+2; | |
3796 cricket::SetRtpHeader(data, sizeof(data), rtpHeader); | |
3797 rtc::CopyOnWriteBuffer packet2(data, sizeof(data)); | |
3798 channel_->OnPacketReceived(&packet2, packet_time); | |
3799 // VP9 packet should replace the default receive SSRC | |
3800 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()); | |
3801 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; | |
3802 EXPECT_EQ(rtpHeader.ssrc, recv_stream->GetConfig().rtp.remote_ssrc); | |
3803 | |
3804 #if defined(WEBRTC_USE_H264) | |
3805 // Receive H264 packet on third SSRC | |
3806 rtpHeader.payload_type = 126; | |
3807 rtpHeader.ssrc = kIncomingUnsignalledSsrc+3; | |
3808 cricket::SetRtpHeader(data, sizeof(data), rtpHeader); | |
3809 rtc::CopyOnWriteBuffer packet3(data, sizeof(data)); | |
3810 channel_->OnPacketReceived(&packet3, packet_time); | |
3811 // H264 packet should replace the default receive SSRC | |
3812 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()); | |
3813 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; | |
3814 EXPECT_EQ(rtpHeader.ssrc, recv_stream->GetConfig().rtp.remote_ssrc); | |
3815 #endif | |
3816 } | |
3817 | |
3757 TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) { | 3818 TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) { |
3758 AddSendStream(); | 3819 AddSendStream(); |
3759 | 3820 |
3760 cricket::FakeVideoCapturer capturer; | 3821 cricket::FakeVideoCapturer capturer; |
3761 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); | 3822 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
3762 cricket::VideoFormat capture_format_hd = | 3823 cricket::VideoFormat capture_format_hd = |
3763 capturer.GetSupportedFormats()->front(); | 3824 capturer.GetSupportedFormats()->front(); |
3764 EXPECT_EQ(1280, capture_format_hd.width); | 3825 EXPECT_EQ(1280, capture_format_hd.width); |
3765 EXPECT_EQ(720, capture_format_hd.height); | 3826 EXPECT_EQ(720, capture_format_hd.height); |
3766 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); | 3827 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4255 } | 4316 } |
4256 | 4317 |
4257 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { | 4318 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { |
4258 webrtc::test::ScopedFieldTrials override_field_trials_( | 4319 webrtc::test::ScopedFieldTrials override_field_trials_( |
4259 "WebRTC-SimulcastScreenshare/Enabled/"); | 4320 "WebRTC-SimulcastScreenshare/Enabled/"); |
4260 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, | 4321 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, |
4261 true); | 4322 true); |
4262 } | 4323 } |
4263 | 4324 |
4264 } // namespace cricket | 4325 } // namespace cricket |
OLD | NEW |