| 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 23 matching lines...) Expand all Loading... |
| 34 #include "talk/media/webrtc/fakewebrtccall.h" | 34 #include "talk/media/webrtc/fakewebrtccall.h" |
| 35 #include "talk/media/webrtc/fakewebrtcvideoengine.h" | 35 #include "talk/media/webrtc/fakewebrtcvideoengine.h" |
| 36 #include "talk/media/webrtc/simulcast.h" | 36 #include "talk/media/webrtc/simulcast.h" |
| 37 #include "talk/media/webrtc/webrtcvideochannelfactory.h" | 37 #include "talk/media/webrtc/webrtcvideochannelfactory.h" |
| 38 #include "talk/media/webrtc/webrtcvideoengine2.h" | 38 #include "talk/media/webrtc/webrtcvideoengine2.h" |
| 39 #include "talk/media/webrtc/webrtcvoiceengine.h" | 39 #include "talk/media/webrtc/webrtcvoiceengine.h" |
| 40 #include "webrtc/base/arraysize.h" | 40 #include "webrtc/base/arraysize.h" |
| 41 #include "webrtc/base/gunit.h" | 41 #include "webrtc/base/gunit.h" |
| 42 #include "webrtc/base/stringutils.h" | 42 #include "webrtc/base/stringutils.h" |
| 43 #include "webrtc/test/field_trial.h" | 43 #include "webrtc/test/field_trial.h" |
| 44 #include "webrtc/test/histogram.h" |
| 44 #include "webrtc/video_encoder.h" | 45 #include "webrtc/video_encoder.h" |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 static const int kDefaultQpMax = 56; | 48 static const int kDefaultQpMax = 56; |
| 48 static const int kDefaultFramerate = 30; | 49 static const int kDefaultFramerate = 30; |
| 49 | 50 |
| 50 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0); | 51 static const cricket::VideoCodec kVp8Codec720p(100, "VP8", 1280, 720, 30, 0); |
| 51 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); | 52 static const cricket::VideoCodec kVp8Codec360p(100, "VP8", 640, 360, 30, 0); |
| 52 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); | 53 static const cricket::VideoCodec kVp8Codec270p(100, "VP8", 480, 270, 30, 0); |
| 53 | 54 |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 | 1548 |
| 1548 TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthFixed) { | 1549 TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthFixed) { |
| 1549 FAIL() << "Not implemented."; // TODO(pbos): Implement. | 1550 FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1550 } | 1551 } |
| 1551 | 1552 |
| 1552 TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { | 1553 TEST_F(WebRtcVideoChannel2Test, DISABLED_SetBandwidthInConference) { |
| 1553 FAIL() << "Not implemented."; // TODO(pbos): Implement. | 1554 FAIL() << "Not implemented."; // TODO(pbos): Implement. |
| 1554 } | 1555 } |
| 1555 | 1556 |
| 1556 TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { | 1557 TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { |
| 1558 webrtc::test::ClearHistograms(); |
| 1557 static const int kScreenshareMinBitrateKbps = 800; | 1559 static const int kScreenshareMinBitrateKbps = 800; |
| 1558 cricket::VideoCodec codec = kVp8Codec360p; | 1560 cricket::VideoCodec codec = kVp8Codec360p; |
| 1559 cricket::VideoSendParameters parameters; | 1561 cricket::VideoSendParameters parameters; |
| 1560 parameters.codecs.push_back(codec); | 1562 parameters.codecs.push_back(codec); |
| 1561 parameters.options.screencast_min_bitrate = | 1563 parameters.options.screencast_min_bitrate = |
| 1562 rtc::Optional<int>(kScreenshareMinBitrateKbps); | 1564 rtc::Optional<int>(kScreenshareMinBitrateKbps); |
| 1563 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 1565 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
| 1564 | 1566 |
| 1565 AddSendStream(); | 1567 AddSendStream(); |
| 1566 | 1568 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1586 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, | 1588 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, |
| 1587 encoder_config.content_type); | 1589 encoder_config.content_type); |
| 1588 EXPECT_EQ(codec.width, encoder_config.streams.front().width); | 1590 EXPECT_EQ(codec.width, encoder_config.streams.front().width); |
| 1589 EXPECT_EQ(codec.height, encoder_config.streams.front().height); | 1591 EXPECT_EQ(codec.height, encoder_config.streams.front().height); |
| 1590 EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps) | 1592 EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps) |
| 1591 << "Non-screenshare shouldn't use min-transmit bitrate."; | 1593 << "Non-screenshare shouldn't use min-transmit bitrate."; |
| 1592 | 1594 |
| 1593 capturer.SetScreencast(true); | 1595 capturer.SetScreencast(true); |
| 1594 EXPECT_TRUE(capturer.CaptureFrame()); | 1596 EXPECT_TRUE(capturer.CaptureFrame()); |
| 1595 | 1597 |
| 1596 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); | 1598 // Changing content type to screen will reset stream, so number of swapped |
| 1599 // frames will be reset. |
| 1600 send_stream = fake_call_->GetVideoSendStreams().front(); |
| 1601 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 1597 | 1602 |
| 1598 // Verify screencast settings. | 1603 // Verify screencast settings. |
| 1599 encoder_config = send_stream->GetEncoderConfig(); | 1604 encoder_config = send_stream->GetEncoderConfig(); |
| 1600 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen, | 1605 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen, |
| 1601 encoder_config.content_type); | 1606 encoder_config.content_type); |
| 1602 EXPECT_EQ(kScreenshareMinBitrateKbps * 1000, | 1607 EXPECT_EQ(kScreenshareMinBitrateKbps * 1000, |
| 1603 encoder_config.min_transmit_bitrate_bps); | 1608 encoder_config.min_transmit_bitrate_bps); |
| 1604 | 1609 |
| 1605 EXPECT_EQ(capture_format_hd.width, encoder_config.streams.front().width); | 1610 EXPECT_EQ(capture_format_hd.width, encoder_config.streams.front().width); |
| 1606 EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height); | 1611 EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 | 1877 |
| 1873 // Trigger overuse. | 1878 // Trigger overuse. |
| 1874 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); | 1879 ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
| 1875 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); | 1880 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); |
| 1876 webrtc::LoadObserver* overuse_callback = | 1881 webrtc::LoadObserver* overuse_callback = |
| 1877 send_stream->GetConfig().overuse_callback; | 1882 send_stream->GetConfig().overuse_callback; |
| 1878 ASSERT_TRUE(overuse_callback != NULL); | 1883 ASSERT_TRUE(overuse_callback != NULL); |
| 1879 overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kOveruse); | 1884 overuse_callback->OnLoadUpdate(webrtc::LoadObserver::kOveruse); |
| 1880 | 1885 |
| 1881 EXPECT_TRUE(capturer.CaptureFrame()); | 1886 EXPECT_TRUE(capturer.CaptureFrame()); |
| 1887 send_stream = fake_call_->GetVideoSendStreams().front(); |
| 1882 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); | 1888 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 1883 | 1889 |
| 1884 if (enable_overuse && !is_screenshare) { | 1890 if (enable_overuse && !is_screenshare) { |
| 1885 EXPECT_LT(send_stream->GetLastWidth(), codec.width); | 1891 EXPECT_LT(send_stream->GetLastWidth(), codec.width); |
| 1886 EXPECT_LT(send_stream->GetLastHeight(), codec.height); | 1892 EXPECT_LT(send_stream->GetLastHeight(), codec.height); |
| 1887 } else { | 1893 } else { |
| 1888 EXPECT_EQ(codec.width, send_stream->GetLastWidth()); | 1894 EXPECT_EQ(codec.width, send_stream->GetLastWidth()); |
| 1889 EXPECT_EQ(codec.height, send_stream->GetLastHeight()); | 1895 EXPECT_EQ(codec.height, send_stream->GetLastHeight()); |
| 1890 } | 1896 } |
| 1891 | 1897 |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2904 } | 2910 } |
| 2905 | 2911 |
| 2906 TEST_F(WebRtcVideoChannel2Test, ConfiguresLocalSsrc) { | 2912 TEST_F(WebRtcVideoChannel2Test, ConfiguresLocalSsrc) { |
| 2907 TestReceiverLocalSsrcConfiguration(false); | 2913 TestReceiverLocalSsrcConfiguration(false); |
| 2908 } | 2914 } |
| 2909 | 2915 |
| 2910 TEST_F(WebRtcVideoChannel2Test, ConfiguresLocalSsrcOnExistingReceivers) { | 2916 TEST_F(WebRtcVideoChannel2Test, ConfiguresLocalSsrcOnExistingReceivers) { |
| 2911 TestReceiverLocalSsrcConfiguration(true); | 2917 TestReceiverLocalSsrcConfiguration(true); |
| 2912 } | 2918 } |
| 2913 | 2919 |
| 2920 TEST_F(WebRtcVideoChannel2Test, UpdatesStatsDependingOnContentType) {} |
| 2921 |
| 2914 class WebRtcVideoEngine2SimulcastTest : public testing::Test {}; | 2922 class WebRtcVideoEngine2SimulcastTest : public testing::Test {}; |
| 2915 | 2923 |
| 2916 // Test that if we add a stream with RTX SSRC's, SSRC's get set correctly. | 2924 // Test that if we add a stream with RTX SSRC's, SSRC's get set correctly. |
| 2917 TEST_F(WebRtcVideoEngine2SimulcastTest, DISABLED_TestStreamWithRtx) { | 2925 TEST_F(WebRtcVideoEngine2SimulcastTest, DISABLED_TestStreamWithRtx) { |
| 2918 // TODO(pbos): Implement. | 2926 // TODO(pbos): Implement. |
| 2919 FAIL() << "Not implemented."; | 2927 FAIL() << "Not implemented."; |
| 2920 } | 2928 } |
| 2921 | 2929 |
| 2922 // Test that if we get too few ssrcs are given in AddSendStream(), | 2930 // Test that if we get too few ssrcs are given in AddSendStream(), |
| 2923 // only supported sub-streams will be added. | 2931 // only supported sub-streams will be added. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3274 // Ensures that the correct settings are applied to the codec when two temporal | 3282 // Ensures that the correct settings are applied to the codec when two temporal |
| 3275 // layer screencasting is enabled, and that the correct simulcast settings are | 3283 // layer screencasting is enabled, and that the correct simulcast settings are |
| 3276 // reapplied when disabling screencasting. | 3284 // reapplied when disabling screencasting. |
| 3277 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3285 TEST_F(WebRtcVideoChannel2SimulcastTest, |
| 3278 DISABLED_TwoTemporalLayerScreencastSettings) { | 3286 DISABLED_TwoTemporalLayerScreencastSettings) { |
| 3279 // TODO(pbos): Implement. | 3287 // TODO(pbos): Implement. |
| 3280 FAIL() << "Not implemented."; | 3288 FAIL() << "Not implemented."; |
| 3281 } | 3289 } |
| 3282 | 3290 |
| 3283 } // namespace cricket | 3291 } // namespace cricket |
| OLD | NEW |