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 "webrtc/api/video_codecs/video_encoder.h" | 18 #include "webrtc/api/video_codecs/video_encoder.h" |
19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/event.h" | 20 #include "webrtc/base/event.h" |
21 #include "webrtc/base/file.h" | 21 #include "webrtc/base/file.h" |
22 #include "webrtc/base/optional.h" | 22 #include "webrtc/base/optional.h" |
23 #include "webrtc/base/random.h" | 23 #include "webrtc/base/random.h" |
24 #include "webrtc/base/rate_limiter.h" | 24 #include "webrtc/base/rate_limiter.h" |
25 #include "webrtc/call/call.h" | 25 #include "webrtc/call/call.h" |
26 #include "webrtc/common_video/include/frame_callback.h" | 26 #include "webrtc/common_video/include/frame_callback.h" |
27 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 27 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
28 #include "webrtc/media/base/fakevideorenderer.h" | 28 #include "webrtc/media/base/fakevideorenderer.h" |
| 29 #include "webrtc/media/base/mediaconstants.h" |
| 30 #include "webrtc/media/engine/internalencoderfactory.h" |
| 31 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
29 #include "webrtc/modules/include/module_common_types.h" | 32 #include "webrtc/modules/include/module_common_types.h" |
30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 33 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
31 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 34 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" |
| 37 #include "webrtc/modules/rtp_rtcp/source/rtp_format.h" |
34 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 38 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
35 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 39 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
36 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 40 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 41 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" |
37 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 42 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
38 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 43 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
39 #include "webrtc/system_wrappers/include/metrics.h" | 44 #include "webrtc/system_wrappers/include/metrics.h" |
40 #include "webrtc/system_wrappers/include/metrics_default.h" | 45 #include "webrtc/system_wrappers/include/metrics_default.h" |
41 #include "webrtc/system_wrappers/include/sleep.h" | 46 #include "webrtc/system_wrappers/include/sleep.h" |
42 #include "webrtc/test/call_test.h" | 47 #include "webrtc/test/call_test.h" |
43 #include "webrtc/test/direct_transport.h" | 48 #include "webrtc/test/direct_transport.h" |
44 #include "webrtc/test/encoder_settings.h" | 49 #include "webrtc/test/encoder_settings.h" |
45 #include "webrtc/test/fake_decoder.h" | 50 #include "webrtc/test/fake_decoder.h" |
46 #include "webrtc/test/fake_encoder.h" | 51 #include "webrtc/test/fake_encoder.h" |
47 #include "webrtc/test/field_trial.h" | 52 #include "webrtc/test/field_trial.h" |
48 #include "webrtc/test/frame_generator.h" | 53 #include "webrtc/test/frame_generator.h" |
49 #include "webrtc/test/frame_generator_capturer.h" | 54 #include "webrtc/test/frame_generator_capturer.h" |
| 55 #include "webrtc/test/gmock.h" |
50 #include "webrtc/test/gtest.h" | 56 #include "webrtc/test/gtest.h" |
51 #include "webrtc/test/gmock.h" | |
52 #include "webrtc/test/null_transport.h" | 57 #include "webrtc/test/null_transport.h" |
53 #include "webrtc/test/rtcp_packet_parser.h" | 58 #include "webrtc/test/rtcp_packet_parser.h" |
54 #include "webrtc/test/rtp_rtcp_observer.h" | 59 #include "webrtc/test/rtp_rtcp_observer.h" |
55 #include "webrtc/test/testsupport/fileutils.h" | 60 #include "webrtc/test/testsupport/fileutils.h" |
56 #include "webrtc/test/testsupport/perf_test.h" | 61 #include "webrtc/test/testsupport/perf_test.h" |
57 #include "webrtc/video/transport_adapter.h" | 62 #include "webrtc/video/transport_adapter.h" |
58 | 63 |
59 #if defined(MEMORY_SANITIZER) | 64 #if defined(MEMORY_SANITIZER) |
60 // Flaky under MemorySanitizer, see | 65 // Flaky under MemorySanitizer, see |
61 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7419 | 66 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7419 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 bool need_rtp_; | 130 bool need_rtp_; |
126 bool need_rtcp_; | 131 bool need_rtcp_; |
127 rtc::CriticalSection crit_; | 132 rtc::CriticalSection crit_; |
128 }; | 133 }; |
129 | 134 |
130 void DecodesRetransmittedFrame(bool enable_rtx, bool enable_red); | 135 void DecodesRetransmittedFrame(bool enable_rtx, bool enable_red); |
131 void ReceivesPliAndRecovers(int rtp_history_ms); | 136 void ReceivesPliAndRecovers(int rtp_history_ms); |
132 void RespectsRtcpMode(RtcpMode rtcp_mode); | 137 void RespectsRtcpMode(RtcpMode rtcp_mode); |
133 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); | 138 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); |
134 void TestRtpStatePreservation(bool use_rtx, bool provoke_rtcpsr_before_rtp); | 139 void TestRtpStatePreservation(bool use_rtx, bool provoke_rtcpsr_before_rtp); |
| 140 void TestPictureIdStatePreservation(VideoEncoder* encoder); |
135 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); | 141 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); |
136 void VerifyNewVideoSendStreamsRespectNetworkState( | 142 void VerifyNewVideoSendStreamsRespectNetworkState( |
137 MediaType network_to_bring_up, | 143 MediaType network_to_bring_up, |
138 VideoEncoder* encoder, | 144 VideoEncoder* encoder, |
139 Transport* transport); | 145 Transport* transport); |
140 void VerifyNewVideoReceiveStreamsRespectNetworkState( | 146 void VerifyNewVideoReceiveStreamsRespectNetworkState( |
141 MediaType network_to_bring_up, | 147 MediaType network_to_bring_up, |
142 Transport* transport); | 148 Transport* transport); |
143 }; | 149 }; |
144 | 150 |
(...skipping 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3628 size_t ssrcs_to_observe_; | 3634 size_t ssrcs_to_observe_; |
3629 std::map<uint32_t, bool> observed_redundant_retransmission_; | 3635 std::map<uint32_t, bool> observed_redundant_retransmission_; |
3630 std::map<uint32_t, bool> registered_rtx_ssrc_; | 3636 std::map<uint32_t, bool> registered_rtx_ssrc_; |
3631 } test; | 3637 } test; |
3632 | 3638 |
3633 RunBaseTest(&test); | 3639 RunBaseTest(&test); |
3634 } | 3640 } |
3635 | 3641 |
3636 void EndToEndTest::TestRtpStatePreservation(bool use_rtx, | 3642 void EndToEndTest::TestRtpStatePreservation(bool use_rtx, |
3637 bool provoke_rtcpsr_before_rtp) { | 3643 bool provoke_rtcpsr_before_rtp) { |
3638 // This test use other VideoStream settings than the the default settings | 3644 // This test uses other VideoStream settings than the the default settings |
3639 // implemented in DefaultVideoStreamFactory. Therefore this test implement | 3645 // implemented in DefaultVideoStreamFactory. Therefore this test implements |
3640 // its own VideoEncoderConfig::VideoStreamFactoryInterface which is created | 3646 // its own VideoEncoderConfig::VideoStreamFactoryInterface which is created |
3641 // in ModifyVideoConfigs. | 3647 // in ModifyVideoConfigs. |
3642 class VideoStreamFactory | 3648 class VideoStreamFactory |
3643 : public VideoEncoderConfig::VideoStreamFactoryInterface { | 3649 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
3644 public: | 3650 public: |
3645 VideoStreamFactory() {} | 3651 VideoStreamFactory() {} |
3646 | 3652 |
3647 private: | 3653 private: |
3648 std::vector<VideoStream> CreateEncoderStreams( | 3654 std::vector<VideoStream> CreateEncoderStreams( |
3649 int width, | 3655 int width, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3879 } | 3885 } |
3880 | 3886 |
3881 TEST_F(EndToEndTest, RestartingSendStreamPreservesRtpStatesWithRtx) { | 3887 TEST_F(EndToEndTest, RestartingSendStreamPreservesRtpStatesWithRtx) { |
3882 TestRtpStatePreservation(true, false); | 3888 TestRtpStatePreservation(true, false); |
3883 } | 3889 } |
3884 | 3890 |
3885 TEST_F(EndToEndTest, RestartingSendStreamKeepsRtpAndRtcpTimestampsSynced) { | 3891 TEST_F(EndToEndTest, RestartingSendStreamKeepsRtpAndRtcpTimestampsSynced) { |
3886 TestRtpStatePreservation(true, true); | 3892 TestRtpStatePreservation(true, true); |
3887 } | 3893 } |
3888 | 3894 |
| 3895 void EndToEndTest::TestPictureIdStatePreservation(VideoEncoder* encoder) { |
| 3896 const size_t kFrameMaxWidth = 1280; |
| 3897 const size_t kFrameMaxHeight = 720; |
| 3898 const size_t kFrameRate = 30; |
| 3899 |
| 3900 // Use a special stream factory in this test to ensure that all simulcast |
| 3901 // streams are being sent. |
| 3902 class VideoStreamFactory |
| 3903 : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 3904 public: |
| 3905 VideoStreamFactory() = default; |
| 3906 |
| 3907 private: |
| 3908 std::vector<VideoStream> CreateEncoderStreams( |
| 3909 int width, |
| 3910 int height, |
| 3911 const VideoEncoderConfig& encoder_config) override { |
| 3912 std::vector<VideoStream> streams = |
| 3913 test::CreateVideoStreams(width, height, encoder_config); |
| 3914 |
| 3915 const size_t kBitrate = 100000; |
| 3916 |
| 3917 if (encoder_config.number_of_streams > 1) { |
| 3918 RTC_DCHECK_EQ(3, encoder_config.number_of_streams); |
| 3919 |
| 3920 for (size_t i = 0; i < encoder_config.number_of_streams; ++i) { |
| 3921 streams[i].min_bitrate_bps = kBitrate; |
| 3922 streams[i].target_bitrate_bps = kBitrate; |
| 3923 streams[i].max_bitrate_bps = kBitrate; |
| 3924 } |
| 3925 |
| 3926 // test::CreateVideoStreams does not return frame sizes for the lower |
| 3927 // streams that are accepted by VP8Impl::InitEncode. |
| 3928 // TODO(brandtr): Fix the problem in test::CreateVideoStreams, rather |
| 3929 // than overriding the values here. |
| 3930 streams[1].width = streams[2].width / 2; |
| 3931 streams[1].height = streams[2].height / 2; |
| 3932 streams[0].width = streams[1].width / 2; |
| 3933 streams[0].height = streams[1].height / 2; |
| 3934 } else { |
| 3935 // Use the same total bitrates when sending a single stream to avoid |
| 3936 // lowering the bitrate estimate and requiring a subsequent rampup. |
| 3937 streams[0].min_bitrate_bps = 3 * kBitrate; |
| 3938 streams[0].target_bitrate_bps = 3 * kBitrate; |
| 3939 streams[0].max_bitrate_bps = 3 * kBitrate; |
| 3940 } |
| 3941 |
| 3942 return streams; |
| 3943 } |
| 3944 }; |
| 3945 |
| 3946 class PictureIdObserver : public test::RtpRtcpObserver { |
| 3947 public: |
| 3948 PictureIdObserver() |
| 3949 : test::RtpRtcpObserver(kDefaultTimeoutMs), num_ssrcs_to_observe_(1) {} |
| 3950 |
| 3951 void ResetExpectations(size_t num_expected_ssrcs) { |
| 3952 rtc::CritScope lock(&crit_); |
| 3953 // Do not clear the timestamp and picture_id, to ensure that we check |
| 3954 // consistency between reinits and recreations. |
| 3955 num_packets_sent_.clear(); |
| 3956 num_ssrcs_to_observe_ = num_expected_ssrcs; |
| 3957 ssrc_observed_.clear(); |
| 3958 } |
| 3959 |
| 3960 private: |
| 3961 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 3962 rtc::CritScope lock(&crit_); |
| 3963 |
| 3964 // RTP header. |
| 3965 RTPHeader header; |
| 3966 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
| 3967 const uint32_t timestamp = header.timestamp; |
| 3968 const uint32_t ssrc = header.ssrc; |
| 3969 |
| 3970 const bool known_ssrc = |
| 3971 (ssrc == kVideoSendSsrcs[0] || ssrc == kVideoSendSsrcs[1] || |
| 3972 ssrc == kVideoSendSsrcs[2]); |
| 3973 EXPECT_TRUE(known_ssrc) << "Unknown SSRC sent."; |
| 3974 |
| 3975 const bool is_padding = |
| 3976 (length == header.headerLength + header.paddingLength); |
| 3977 if (is_padding) { |
| 3978 return SEND_PACKET; |
| 3979 } |
| 3980 |
| 3981 // VP8 header. |
| 3982 std::unique_ptr<RtpDepacketizer> depacketizer( |
| 3983 RtpDepacketizer::Create(kRtpVideoVp8)); |
| 3984 RtpDepacketizer::ParsedPayload parsed_payload; |
| 3985 EXPECT_TRUE(depacketizer->Parse( |
| 3986 &parsed_payload, &packet[header.headerLength], |
| 3987 length - header.headerLength - header.paddingLength)); |
| 3988 const uint16_t picture_id = |
| 3989 parsed_payload.type.Video.codecHeader.VP8.pictureId; |
| 3990 |
| 3991 // If this is the first packet, we have nothing to compare to. |
| 3992 if (last_observed_timestamp_.find(ssrc) == |
| 3993 last_observed_timestamp_.end()) { |
| 3994 last_observed_timestamp_[ssrc] = timestamp; |
| 3995 last_observed_picture_id_[ssrc] = picture_id; |
| 3996 ++num_packets_sent_[ssrc]; |
| 3997 |
| 3998 return SEND_PACKET; |
| 3999 } |
| 4000 |
| 4001 // Verify continuity and monotonicity of picture_id sequence. |
| 4002 if (last_observed_timestamp_[ssrc] == timestamp) { |
| 4003 // Packet belongs to same frame as before. |
| 4004 EXPECT_EQ(last_observed_picture_id_[ssrc], picture_id); |
| 4005 } else { |
| 4006 // Packet is a new frame. |
| 4007 EXPECT_EQ((last_observed_picture_id_[ssrc] + 1) % (1 << 15), |
| 4008 picture_id); |
| 4009 } |
| 4010 last_observed_timestamp_[ssrc] = timestamp; |
| 4011 last_observed_picture_id_[ssrc] = picture_id; |
| 4012 |
| 4013 // Pass the test when enough media packets have been received |
| 4014 // on all streams. |
| 4015 if (++num_packets_sent_[ssrc] >= 10 && !ssrc_observed_[ssrc]) { |
| 4016 ssrc_observed_[ssrc] = true; |
| 4017 if (--num_ssrcs_to_observe_ == 0) { |
| 4018 observation_complete_.Set(); |
| 4019 } |
| 4020 } |
| 4021 |
| 4022 return SEND_PACKET; |
| 4023 } |
| 4024 |
| 4025 rtc::CriticalSection crit_; |
| 4026 std::map<uint32_t, uint32_t> last_observed_timestamp_ GUARDED_BY(crit_); |
| 4027 std::map<uint32_t, uint16_t> last_observed_picture_id_ GUARDED_BY(crit_); |
| 4028 std::map<uint32_t, size_t> num_packets_sent_ GUARDED_BY(crit_); |
| 4029 size_t num_ssrcs_to_observe_ GUARDED_BY(crit_); |
| 4030 std::map<uint32_t, bool> ssrc_observed_ GUARDED_BY(crit_); |
| 4031 } observer; |
| 4032 |
| 4033 Call::Config config(event_log_.get()); |
| 4034 CreateCalls(config, config); |
| 4035 |
| 4036 test::PacketTransport send_transport( |
| 4037 sender_call_.get(), &observer, test::PacketTransport::kSender, |
| 4038 payload_type_map_, FakeNetworkPipe::Config()); |
| 4039 test::PacketTransport receive_transport( |
| 4040 nullptr, &observer, test::PacketTransport::kReceiver, payload_type_map_, |
| 4041 FakeNetworkPipe::Config()); |
| 4042 send_transport.SetReceiver(receiver_call_->Receiver()); |
| 4043 receive_transport.SetReceiver(sender_call_->Receiver()); |
| 4044 |
| 4045 CreateSendConfig(kNumSsrcs, 0, 0, &send_transport); |
| 4046 video_send_config_.encoder_settings.encoder = encoder; |
| 4047 video_send_config_.encoder_settings.payload_name = "VP8"; |
| 4048 video_encoder_config_.video_stream_factory = |
| 4049 new rtc::RefCountedObject<VideoStreamFactory>(); |
| 4050 video_encoder_config_.number_of_streams = 1; |
| 4051 CreateMatchingReceiveConfigs(&receive_transport); |
| 4052 |
| 4053 CreateVideoStreams(); |
| 4054 CreateFrameGeneratorCapturer(kFrameRate, kFrameMaxWidth, kFrameMaxHeight); |
| 4055 |
| 4056 auto reinit_encoder_and_test = [this, &observer](int num_expected_ssrcs) { |
| 4057 video_send_stream_->ReconfigureVideoEncoder(video_encoder_config_.Copy()); |
| 4058 observer.ResetExpectations(num_expected_ssrcs); |
| 4059 EXPECT_TRUE(observer.Wait()) << "Timed out waiting for packets."; |
| 4060 }; |
| 4061 |
| 4062 // TODO(brandtr): Add tests where we recreate the whole VideoSendStream. This |
| 4063 // requires synchronizing the frame generator output with the packetization |
| 4064 // output, to not have any timing-dependent gaps in the picture_id sequence. |
| 4065 |
| 4066 // Initial test with a single stream. |
| 4067 Start(); |
| 4068 EXPECT_TRUE(observer.Wait()) << "Timed out waiting for packets."; |
| 4069 |
| 4070 // Reinit the encoder and make sure the picture_id sequence is continuous. |
| 4071 reinit_encoder_and_test(1); |
| 4072 |
| 4073 // Go up to three streams. |
| 4074 video_encoder_config_.number_of_streams = 3; |
| 4075 reinit_encoder_and_test(3); |
| 4076 reinit_encoder_and_test(3); |
| 4077 |
| 4078 // Go back to one stream. |
| 4079 video_encoder_config_.number_of_streams = 1; |
| 4080 reinit_encoder_and_test(1); |
| 4081 reinit_encoder_and_test(1); |
| 4082 |
| 4083 send_transport.StopSending(); |
| 4084 receive_transport.StopSending(); |
| 4085 |
| 4086 Stop(); |
| 4087 DestroyStreams(); |
| 4088 } |
| 4089 |
| 4090 // These tests exposed a race in libvpx, see |
| 4091 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7663. Disabling the tests |
| 4092 // on tsan until the race has been fixed. |
| 4093 #if defined(THREAD_SANITIZER) |
| 4094 #define MAYBE_PictureIdStateRetainedAfterReinitingVp8 \ |
| 4095 DISABLED_PictureIdStateRetainedAfterReinitingVp8 |
| 4096 #define MAYBE_PictureIdStateRetainedAfterReinitingSimulcastEncoderAdapter \ |
| 4097 DISABLED_PictureIdStateRetainedAfterReinitingSimulcastEncoderAdapter |
| 4098 #else |
| 4099 #define MAYBE_PictureIdStateRetainedAfterReinitingVp8 \ |
| 4100 PictureIdStateRetainedAfterReinitingVp8 |
| 4101 #define MAYBE_PictureIdStateRetainedAfterReinitingSimulcastEncoderAdapter \ |
| 4102 PictureIdStateRetainedAfterReinitingSimulcastEncoderAdapter |
| 4103 #endif |
| 4104 TEST_F(EndToEndTest, MAYBE_PictureIdStateRetainedAfterReinitingVp8) { |
| 4105 std::unique_ptr<VideoEncoder> encoder(VP8Encoder::Create()); |
| 4106 TestPictureIdStatePreservation(encoder.get()); |
| 4107 } |
| 4108 |
| 4109 TEST_F(EndToEndTest, |
| 4110 MAYBE_PictureIdStateRetainedAfterReinitingSimulcastEncoderAdapter) { |
| 4111 class VideoEncoderFactoryAdapter : public webrtc::VideoEncoderFactory { |
| 4112 public: |
| 4113 explicit VideoEncoderFactoryAdapter( |
| 4114 cricket::WebRtcVideoEncoderFactory* factory) |
| 4115 : factory_(factory) {} |
| 4116 virtual ~VideoEncoderFactoryAdapter() {} |
| 4117 |
| 4118 // Implements webrtc::VideoEncoderFactory. |
| 4119 webrtc::VideoEncoder* Create() override { |
| 4120 return factory_->CreateVideoEncoder( |
| 4121 cricket::VideoCodec(cricket::kVp8CodecName)); |
| 4122 } |
| 4123 |
| 4124 void Destroy(webrtc::VideoEncoder* encoder) override { |
| 4125 return factory_->DestroyVideoEncoder(encoder); |
| 4126 } |
| 4127 |
| 4128 private: |
| 4129 cricket::WebRtcVideoEncoderFactory* const factory_; |
| 4130 }; |
| 4131 |
| 4132 cricket::InternalEncoderFactory internal_encoder_factory; |
| 4133 SimulcastEncoderAdapter simulcast_encoder_adapter( |
| 4134 new VideoEncoderFactoryAdapter(&internal_encoder_factory)); |
| 4135 |
| 4136 TestPictureIdStatePreservation(&simulcast_encoder_adapter); |
| 4137 } |
| 4138 |
3889 TEST_F(EndToEndTest, RespectsNetworkState) { | 4139 TEST_F(EndToEndTest, RespectsNetworkState) { |
3890 // TODO(pbos): Remove accepted downtime packets etc. when signaling network | 4140 // TODO(pbos): Remove accepted downtime packets etc. when signaling network |
3891 // down blocks until no more packets will be sent. | 4141 // down blocks until no more packets will be sent. |
3892 | 4142 |
3893 // Pacer will send from its packet list and then send required padding before | 4143 // Pacer will send from its packet list and then send required padding before |
3894 // checking paused_ again. This should be enough for one round of pacing, | 4144 // checking paused_ again. This should be enough for one round of pacing, |
3895 // otherwise increase. | 4145 // otherwise increase. |
3896 static const int kNumAcceptedDowntimeRtp = 5; | 4146 static const int kNumAcceptedDowntimeRtp = 5; |
3897 // A single RTCP may be in the pipeline. | 4147 // A single RTCP may be in the pipeline. |
3898 static const int kNumAcceptedDowntimeRtcp = 1; | 4148 static const int kNumAcceptedDowntimeRtcp = 1; |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4470 std::unique_ptr<VideoEncoder> encoder_; | 4720 std::unique_ptr<VideoEncoder> encoder_; |
4471 std::unique_ptr<VideoDecoder> decoder_; | 4721 std::unique_ptr<VideoDecoder> decoder_; |
4472 rtc::CriticalSection crit_; | 4722 rtc::CriticalSection crit_; |
4473 int recorded_frames_ GUARDED_BY(crit_); | 4723 int recorded_frames_ GUARDED_BY(crit_); |
4474 } test(this); | 4724 } test(this); |
4475 | 4725 |
4476 RunBaseTest(&test); | 4726 RunBaseTest(&test); |
4477 } | 4727 } |
4478 | 4728 |
4479 } // namespace webrtc | 4729 } // namespace webrtc |
OLD | NEW |