| 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 <list> | 12 #include <list> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "webrtc/base/arraysize.h" | 17 #include "webrtc/base/arraysize.h" |
| 18 #include "webrtc/base/gunit.h" | 18 #include "webrtc/base/gunit.h" |
| 19 #include "webrtc/base/stringutils.h" | 19 #include "webrtc/base/stringutils.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/testutils.h" | 23 #include "webrtc/media/base/testutils.h" |
| 23 #include "webrtc/media/base/videoengine_unittest.h" | 24 #include "webrtc/media/base/videoengine_unittest.h" |
| 24 #include "webrtc/media/engine/fakewebrtccall.h" | 25 #include "webrtc/media/engine/fakewebrtccall.h" |
| 25 #include "webrtc/media/engine/fakewebrtcvideoengine.h" | 26 #include "webrtc/media/engine/fakewebrtcvideoengine.h" |
| 26 #include "webrtc/media/engine/simulcast.h" | 27 #include "webrtc/media/engine/simulcast.h" |
| 27 #include "webrtc/media/engine/webrtcvideoengine2.h" | 28 #include "webrtc/media/engine/webrtcvideoengine2.h" |
| 28 #include "webrtc/media/engine/webrtcvoiceengine.h" | 29 #include "webrtc/media/engine/webrtcvoiceengine.h" |
| 29 #include "webrtc/test/field_trial.h" | 30 #include "webrtc/test/field_trial.h" |
| 30 #include "webrtc/video_encoder.h" | 31 #include "webrtc/video_encoder.h" |
| 31 | 32 |
| (...skipping 3710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3742 rtp_parameters.codecs[1]); | 3743 rtp_parameters.codecs[1]); |
| 3743 } | 3744 } |
| 3744 | 3745 |
| 3745 #if defined(WEBRTC_USE_H264) | 3746 #if defined(WEBRTC_USE_H264) |
| 3746 TEST_F(WebRtcVideoChannel2Test, GetRtpReceiveFmtpSprop) { | 3747 TEST_F(WebRtcVideoChannel2Test, GetRtpReceiveFmtpSprop) { |
| 3747 #else | 3748 #else |
| 3748 TEST_F(WebRtcVideoChannel2Test, DISABLED_GetRtpReceiveFmtpSprop) { | 3749 TEST_F(WebRtcVideoChannel2Test, DISABLED_GetRtpReceiveFmtpSprop) { |
| 3749 #endif | 3750 #endif |
| 3750 cricket::VideoRecvParameters parameters; | 3751 cricket::VideoRecvParameters parameters; |
| 3751 cricket::VideoCodec kH264sprop1(101, "H264"); | 3752 cricket::VideoCodec kH264sprop1(101, "H264"); |
| 3752 kH264sprop1.SetParam("sprop-parameter-sets", "uvw"); | 3753 kH264sprop1.SetParam(kH264FmtpSpropParameterSets, "uvw"); |
| 3753 parameters.codecs.push_back(kH264sprop1); | 3754 parameters.codecs.push_back(kH264sprop1); |
| 3754 cricket::VideoCodec kH264sprop2(102, "H264"); | 3755 cricket::VideoCodec kH264sprop2(102, "H264"); |
| 3755 kH264sprop2.SetParam("sprop-parameter-sets", "xyz"); | 3756 kH264sprop2.SetParam(kH264FmtpSpropParameterSets, "xyz"); |
| 3756 parameters.codecs.push_back(kH264sprop2); | 3757 parameters.codecs.push_back(kH264sprop2); |
| 3757 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 3758 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
| 3758 | 3759 |
| 3759 FakeVideoReceiveStream* recv_stream = AddRecvStream(); | 3760 FakeVideoReceiveStream* recv_stream = AddRecvStream(); |
| 3760 const webrtc::VideoReceiveStream::Config& cfg = recv_stream->GetConfig(); | 3761 const webrtc::VideoReceiveStream::Config& cfg = recv_stream->GetConfig(); |
| 3761 webrtc::RtpParameters rtp_parameters = | 3762 webrtc::RtpParameters rtp_parameters = |
| 3762 channel_->GetRtpReceiveParameters(last_ssrc_); | 3763 channel_->GetRtpReceiveParameters(last_ssrc_); |
| 3763 ASSERT_EQ(2u, rtp_parameters.codecs.size()); | 3764 ASSERT_EQ(2u, rtp_parameters.codecs.size()); |
| 3764 EXPECT_EQ(kH264sprop1.ToCodecParameters(), rtp_parameters.codecs[0]); | 3765 EXPECT_EQ(kH264sprop1.ToCodecParameters(), rtp_parameters.codecs[0]); |
| 3765 ASSERT_EQ(2u, cfg.decoders.size()); | 3766 ASSERT_EQ(2u, cfg.decoders.size()); |
| 3766 EXPECT_EQ(101, cfg.decoders[0].payload_type); | 3767 EXPECT_EQ(101, cfg.decoders[0].payload_type); |
| 3767 EXPECT_EQ("H264", cfg.decoders[0].payload_name); | 3768 EXPECT_EQ("H264", cfg.decoders[0].payload_name); |
| 3768 std::string sprop; | 3769 const auto it0 = |
| 3769 const webrtc::DecoderSpecificSettings* decoder_specific; | 3770 cfg.decoders[0].codec_params.find(kH264FmtpSpropParameterSets); |
| 3770 decoder_specific = &cfg.decoders[0].decoder_specific; | 3771 ASSERT_TRUE(it0 != cfg.decoders[0].codec_params.end()); |
| 3771 ASSERT_TRUE(static_cast<bool>(decoder_specific->h264_extra_settings)); | 3772 EXPECT_EQ("uvw", it0->second); |
| 3772 sprop = decoder_specific->h264_extra_settings->sprop_parameter_sets; | |
| 3773 EXPECT_EQ("uvw", sprop); | |
| 3774 | 3773 |
| 3775 EXPECT_EQ(102, cfg.decoders[1].payload_type); | 3774 EXPECT_EQ(102, cfg.decoders[1].payload_type); |
| 3776 EXPECT_EQ("H264", cfg.decoders[1].payload_name); | 3775 EXPECT_EQ("H264", cfg.decoders[1].payload_name); |
| 3777 decoder_specific = &cfg.decoders[1].decoder_specific; | 3776 const auto it1 = |
| 3778 ASSERT_TRUE(static_cast<bool>(decoder_specific->h264_extra_settings)); | 3777 cfg.decoders[1].codec_params.find(kH264FmtpSpropParameterSets); |
| 3779 sprop = decoder_specific->h264_extra_settings->sprop_parameter_sets; | 3778 ASSERT_TRUE(it1 != cfg.decoders[1].codec_params.end()); |
| 3780 EXPECT_EQ("xyz", sprop); | 3779 EXPECT_EQ("xyz", it1->second); |
| 3781 } | 3780 } |
| 3782 | 3781 |
| 3783 // Test that RtpParameters for receive stream has one encoding and it has | 3782 // Test that RtpParameters for receive stream has one encoding and it has |
| 3784 // the correct SSRC. | 3783 // the correct SSRC. |
| 3785 TEST_F(WebRtcVideoChannel2Test, RtpEncodingParametersSsrcIsSet) { | 3784 TEST_F(WebRtcVideoChannel2Test, RtpEncodingParametersSsrcIsSet) { |
| 3786 AddRecvStream(); | 3785 AddRecvStream(); |
| 3787 | 3786 |
| 3788 webrtc::RtpParameters rtp_parameters = | 3787 webrtc::RtpParameters rtp_parameters = |
| 3789 channel_->GetRtpReceiveParameters(last_ssrc_); | 3788 channel_->GetRtpReceiveParameters(last_ssrc_); |
| 3790 ASSERT_EQ(1u, rtp_parameters.encodings.size()); | 3789 ASSERT_EQ(1u, rtp_parameters.encodings.size()); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3997 | 3996 |
| 3998 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { | 3997 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { |
| 3999 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); | 3998 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); |
| 4000 } | 3999 } |
| 4001 | 4000 |
| 4002 // Test that we normalize send codec format size in simulcast. | 4001 // Test that we normalize send codec format size in simulcast. |
| 4003 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 4002 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
| 4004 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); | 4003 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); |
| 4005 } | 4004 } |
| 4006 } // namespace cricket | 4005 } // namespace cricket |
| OLD | NEW |