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> | 10 #include <algorithm> |
11 #include <list> | 11 #include <list> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 #include <sstream> | 14 #include <sstream> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/event.h" | 21 #include "webrtc/base/event.h" |
22 #include "webrtc/base/optional.h" | 22 #include "webrtc/base/optional.h" |
23 #include "webrtc/base/rate_limiter.h" | 23 #include "webrtc/base/rate_limiter.h" |
24 #include "webrtc/call.h" | 24 #include "webrtc/call.h" |
25 #include "webrtc/call/transport_adapter.h" | 25 #include "webrtc/call/transport_adapter.h" |
26 #include "webrtc/common_video/include/frame_callback.h" | 26 #include "webrtc/common_video/include/frame_callback.h" |
| 27 #include "webrtc/media/base/fakevideorenderer.h" |
27 #include "webrtc/modules/include/module_common_types.h" | 28 #include "webrtc/modules/include/module_common_types.h" |
28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
29 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 30 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
34 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 35 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
35 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 36 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
36 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 37 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 first_media_ssrc_ = send_config->rtp.ssrcs[0]; | 1579 first_media_ssrc_ = send_config->rtp.ssrcs[0]; |
1579 } | 1580 } |
1580 | 1581 |
1581 void UpdateReceiveConfig( | 1582 void UpdateReceiveConfig( |
1582 size_t stream_index, | 1583 size_t stream_index, |
1583 VideoReceiveStream::Config* receive_config) override { | 1584 VideoReceiveStream::Config* receive_config) override { |
1584 receive_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1585 receive_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1585 receive_config->rtp.extensions.clear(); | 1586 receive_config->rtp.extensions.clear(); |
1586 receive_config->rtp.extensions.push_back(RtpExtension( | 1587 receive_config->rtp.extensions.push_back(RtpExtension( |
1587 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); | 1588 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
| 1589 receive_config->renderer = &fake_renderer_; |
1588 } | 1590 } |
1589 | 1591 |
1590 test::DirectTransport* CreateSendTransport(Call* sender_call) override { | 1592 test::DirectTransport* CreateSendTransport(Call* sender_call) override { |
1591 observer_ = new RtpExtensionHeaderObserver(sender_call, first_media_ssrc_, | 1593 observer_ = new RtpExtensionHeaderObserver(sender_call, first_media_ssrc_, |
1592 rtx_to_media_ssrcs_); | 1594 rtx_to_media_ssrcs_); |
1593 return observer_; | 1595 return observer_; |
1594 } | 1596 } |
1595 | 1597 |
1596 private: | 1598 private: |
| 1599 test::FakeVideoRenderer fake_renderer_; |
1597 uint32_t first_media_ssrc_; | 1600 uint32_t first_media_ssrc_; |
1598 std::map<uint32_t, uint32_t> rtx_to_media_ssrcs_; | 1601 std::map<uint32_t, uint32_t> rtx_to_media_ssrcs_; |
1599 RtpExtensionHeaderObserver* observer_; | 1602 RtpExtensionHeaderObserver* observer_; |
1600 } tester; | 1603 } tester; |
1601 | 1604 |
1602 tester.RunTest(); | 1605 tester.RunTest(); |
1603 } | 1606 } |
1604 | 1607 |
1605 class TransportFeedbackTester : public test::EndToEndTest { | 1608 class TransportFeedbackTester : public test::EndToEndTest { |
1606 public: | 1609 public: |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 int64_t elapsed_sec = (now - start_runtime_ms_) / 1000; | 2082 int64_t elapsed_sec = (now - start_runtime_ms_) / 1000; |
2080 return elapsed_sec > metrics::kMinRunTimeInSeconds; | 2083 return elapsed_sec > metrics::kMinRunTimeInSeconds; |
2081 } | 2084 } |
2082 | 2085 |
2083 void ModifyVideoConfigs( | 2086 void ModifyVideoConfigs( |
2084 VideoSendStream::Config* send_config, | 2087 VideoSendStream::Config* send_config, |
2085 std::vector<VideoReceiveStream::Config>* receive_configs, | 2088 std::vector<VideoReceiveStream::Config>* receive_configs, |
2086 VideoEncoderConfig* encoder_config) override { | 2089 VideoEncoderConfig* encoder_config) override { |
2087 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 2090 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
2088 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 2091 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 2092 (*receive_configs)[0].renderer = &fake_renderer_; |
2089 } | 2093 } |
2090 | 2094 |
2091 void OnVideoStreamsCreated( | 2095 void OnVideoStreamsCreated( |
2092 VideoSendStream* send_stream, | 2096 VideoSendStream* send_stream, |
2093 const std::vector<VideoReceiveStream*>& receive_streams) override { | 2097 const std::vector<VideoReceiveStream*>& receive_streams) override { |
2094 send_stream_ = send_stream; | 2098 send_stream_ = send_stream; |
2095 receive_streams_ = receive_streams; | 2099 receive_streams_ = receive_streams; |
2096 } | 2100 } |
2097 | 2101 |
2098 void PerformTest() override { | 2102 void PerformTest() override { |
2099 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed."; | 2103 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed."; |
2100 } | 2104 } |
2101 | 2105 |
| 2106 test::FakeVideoRenderer fake_renderer_; |
2102 rtc::CriticalSection crit_; | 2107 rtc::CriticalSection crit_; |
2103 uint64_t sent_rtp_packets_; | 2108 uint64_t sent_rtp_packets_; |
2104 uint16_t dropped_rtp_packet_ GUARDED_BY(&crit_); | 2109 uint16_t dropped_rtp_packet_ GUARDED_BY(&crit_); |
2105 bool dropped_rtp_packet_requested_ GUARDED_BY(&crit_); | 2110 bool dropped_rtp_packet_requested_ GUARDED_BY(&crit_); |
2106 std::vector<VideoReceiveStream*> receive_streams_; | 2111 std::vector<VideoReceiveStream*> receive_streams_; |
2107 VideoSendStream* send_stream_; | 2112 VideoSendStream* send_stream_; |
2108 int64_t start_runtime_ms_; | 2113 int64_t start_runtime_ms_; |
2109 } test; | 2114 } test; |
2110 | 2115 |
2111 metrics::Reset(); | 2116 metrics::Reset(); |
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 private: | 3746 private: |
3742 bool video_observed_; | 3747 bool video_observed_; |
3743 bool audio_observed_; | 3748 bool audio_observed_; |
3744 SequenceNumberUnwrapper unwrapper_; | 3749 SequenceNumberUnwrapper unwrapper_; |
3745 std::set<int64_t> received_packet_ids_; | 3750 std::set<int64_t> received_packet_ids_; |
3746 } test; | 3751 } test; |
3747 | 3752 |
3748 RunBaseTest(&test); | 3753 RunBaseTest(&test); |
3749 } | 3754 } |
3750 } // namespace webrtc | 3755 } // namespace webrtc |
OLD | NEW |