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> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); | 123 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); |
124 void VerifyNewVideoSendStreamsRespectNetworkState( | 124 void VerifyNewVideoSendStreamsRespectNetworkState( |
125 MediaType network_to_bring_down, | 125 MediaType network_to_bring_down, |
126 VideoEncoder* encoder, | 126 VideoEncoder* encoder, |
127 Transport* transport); | 127 Transport* transport); |
128 void VerifyNewVideoReceiveStreamsRespectNetworkState( | 128 void VerifyNewVideoReceiveStreamsRespectNetworkState( |
129 MediaType network_to_bring_down, | 129 MediaType network_to_bring_down, |
130 Transport* transport); | 130 Transport* transport); |
131 }; | 131 }; |
132 | 132 |
133 void SetPacketizationMode(H264PacketizationMode mode, VideoEncoder* encoder) { | |
134 VideoCodec codec_settings; | |
135 codec_settings.codecType = kVideoCodecH264; | |
136 codec_settings.H264()->packetization_mode = mode; | |
137 // TODO(hta): Determine appropriate value for max packet size. | |
138 static const int kMaxPacketSize = 1024; | |
139 encoder->InitEncode(&codec_settings, 0, kMaxPacketSize); | |
140 } | |
141 | |
142 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { | 133 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { |
143 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); | 134 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); |
144 | 135 |
145 test::NullTransport transport; | 136 test::NullTransport transport; |
146 CreateSendConfig(1, 0, &transport); | 137 CreateSendConfig(1, 0, &transport); |
147 CreateMatchingReceiveConfigs(&transport); | 138 CreateMatchingReceiveConfigs(&transport); |
148 | 139 |
149 CreateVideoStreams(); | 140 CreateVideoStreams(); |
150 | 141 |
151 video_receive_streams_[0]->Start(); | 142 video_receive_streams_[0]->Start(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 368 } |
378 | 369 |
379 TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) { | 370 TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) { |
380 CodecObserver test(5, kVideoRotation_90, "VP9", | 371 CodecObserver test(5, kVideoRotation_90, "VP9", |
381 VideoEncoder::Create(VideoEncoder::kVp9), | 372 VideoEncoder::Create(VideoEncoder::kVp9), |
382 VP9Decoder::Create()); | 373 VP9Decoder::Create()); |
383 RunBaseTest(&test); | 374 RunBaseTest(&test); |
384 } | 375 } |
385 #endif // !defined(RTC_DISABLE_VP9) | 376 #endif // !defined(RTC_DISABLE_VP9) |
386 | 377 |
387 #if defined(WEBRTC_USE_H264) | 378 #if defined(WEBRTC_END_TO_END_H264_TESTS) |
388 | 379 |
389 TEST_F(EndToEndTest, SendsAndReceivesH264) { | 380 TEST_F(EndToEndTest, SendsAndReceivesH264) { |
390 CodecObserver test(500, kVideoRotation_0, "H264", | 381 CodecObserver test(500, kVideoRotation_0, "H264", |
391 VideoEncoder::Create(VideoEncoder::kH264), | 382 VideoEncoder::Create(VideoEncoder::kH264), |
392 H264Decoder::Create()); | 383 H264Decoder::Create()); |
393 RunBaseTest(&test); | 384 RunBaseTest(&test); |
394 } | 385 } |
395 | 386 |
396 TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) { | 387 TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) { |
397 CodecObserver test(5, kVideoRotation_90, "H264", | 388 CodecObserver test(5, kVideoRotation_90, "H264", |
398 VideoEncoder::Create(VideoEncoder::kH264), | 389 VideoEncoder::Create(VideoEncoder::kH264), |
399 H264Decoder::Create()); | 390 H264Decoder::Create()); |
400 RunBaseTest(&test); | 391 RunBaseTest(&test); |
401 } | 392 } |
402 | 393 |
403 TEST_F(EndToEndTest, SendsAndReceivesH264PacketizationMode0) { | 394 #endif // defined(WEBRTC_END_TO_END_H264_TESTS) |
404 VideoEncoder* encoder = VideoEncoder::Create(VideoEncoder::kH264); | |
405 SetPacketizationMode(kH264PacketizationMode0, encoder); | |
406 // The CodecObserver takes ownership of the encoder. | |
407 CodecObserver test(500, kVideoRotation_0, "H264", encoder, | |
408 H264Decoder::Create()); | |
409 RunBaseTest(&test); | |
410 } | |
411 | |
412 TEST_F(EndToEndTest, SendsAndReceivesH264PacketizationMode1) { | |
413 VideoEncoder* encoder = VideoEncoder::Create(VideoEncoder::kH264); | |
414 SetPacketizationMode(kH264PacketizationMode1, encoder); | |
415 // The CodecObserver takes ownership of the encoder. | |
416 CodecObserver test(500, kVideoRotation_0, "H264", encoder, | |
417 H264Decoder::Create()); | |
418 RunBaseTest(&test); | |
419 } | |
420 | |
421 #endif // defined(WEBRTC_USE_H264) | |
422 | 395 |
423 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { | 396 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { |
424 class SyncRtcpObserver : public test::EndToEndTest { | 397 class SyncRtcpObserver : public test::EndToEndTest { |
425 public: | 398 public: |
426 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {} | 399 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {} |
427 | 400 |
428 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { | 401 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { |
429 test::RtcpPacketParser parser; | 402 test::RtcpPacketParser parser; |
430 EXPECT_TRUE(parser.Parse(packet, length)); | 403 EXPECT_TRUE(parser.Parse(packet, length)); |
431 EXPECT_EQ(kReceiverLocalVideoSsrc, parser.sender_ssrc()); | 404 EXPECT_EQ(kReceiverLocalVideoSsrc, parser.sender_ssrc()); |
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3936 std::unique_ptr<VideoEncoder> encoder_; | 3909 std::unique_ptr<VideoEncoder> encoder_; |
3937 std::unique_ptr<VideoDecoder> decoder_; | 3910 std::unique_ptr<VideoDecoder> decoder_; |
3938 rtc::CriticalSection crit_; | 3911 rtc::CriticalSection crit_; |
3939 int recorded_frames_ GUARDED_BY(crit_); | 3912 int recorded_frames_ GUARDED_BY(crit_); |
3940 } test(this); | 3913 } test(this); |
3941 | 3914 |
3942 RunBaseTest(&test); | 3915 RunBaseTest(&test); |
3943 } | 3916 } |
3944 | 3917 |
3945 } // namespace webrtc | 3918 } // namespace webrtc |
OLD | NEW |