Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: webrtc/video/end_to_end_tests.cc

Issue 2337453002: H.264 packetization mode 0 (try 2) (Closed)
Patch Set: Addressed hbos comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); 124 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare);
125 void VerifyNewVideoSendStreamsRespectNetworkState( 125 void VerifyNewVideoSendStreamsRespectNetworkState(
126 MediaType network_to_bring_down, 126 MediaType network_to_bring_down,
127 VideoEncoder* encoder, 127 VideoEncoder* encoder,
128 Transport* transport); 128 Transport* transport);
129 void VerifyNewVideoReceiveStreamsRespectNetworkState( 129 void VerifyNewVideoReceiveStreamsRespectNetworkState(
130 MediaType network_to_bring_down, 130 MediaType network_to_bring_down,
131 Transport* transport); 131 Transport* transport);
132 }; 132 };
133 133
134 void SetPacketizationMode(H264PacketizationMode mode, VideoEncoder* encoder) {
135 VideoCodec codec_settings;
136 codec_settings.codecType = kVideoCodecH264;
137 codec_settings.H264()->packetization_mode = mode;
138 // TODO(hta): Determine appropriate value for max packet size.
139 static const int kMaxPacketSize = 1024;
140 encoder->InitEncode(&codec_settings, 0, kMaxPacketSize);
141 }
142
134 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { 143 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) {
135 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); 144 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_));
136 145
137 test::NullTransport transport; 146 test::NullTransport transport;
138 CreateSendConfig(1, 0, &transport); 147 CreateSendConfig(1, 0, &transport);
139 CreateMatchingReceiveConfigs(&transport); 148 CreateMatchingReceiveConfigs(&transport);
140 149
141 CreateVideoStreams(); 150 CreateVideoStreams();
142 151
143 video_receive_streams_[0]->Start(); 152 video_receive_streams_[0]->Start();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 376 }
368 377
369 TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) { 378 TEST_F(EndToEndTest, SendsAndReceivesVP9VideoRotation90) {
370 CodecObserver test(5, kVideoRotation_90, "VP9", 379 CodecObserver test(5, kVideoRotation_90, "VP9",
371 VideoEncoder::Create(VideoEncoder::kVp9), 380 VideoEncoder::Create(VideoEncoder::kVp9),
372 VP9Decoder::Create()); 381 VP9Decoder::Create());
373 RunBaseTest(&test); 382 RunBaseTest(&test);
374 } 383 }
375 #endif // !defined(RTC_DISABLE_VP9) 384 #endif // !defined(RTC_DISABLE_VP9)
376 385
377 #if defined(WEBRTC_END_TO_END_H264_TESTS) 386 #if defined(WEBRTC_USE_H264)
378 387
379 TEST_F(EndToEndTest, SendsAndReceivesH264) { 388 TEST_F(EndToEndTest, SendsAndReceivesH264) {
380 CodecObserver test(500, kVideoRotation_0, "H264", 389 CodecObserver test(500, kVideoRotation_0, "H264",
381 VideoEncoder::Create(VideoEncoder::kH264), 390 VideoEncoder::Create(VideoEncoder::kH264),
382 H264Decoder::Create()); 391 H264Decoder::Create());
383 RunBaseTest(&test); 392 RunBaseTest(&test);
384 } 393 }
385 394
386 TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) { 395 TEST_F(EndToEndTest, SendsAndReceivesH264VideoRotation90) {
387 CodecObserver test(5, kVideoRotation_90, "H264", 396 CodecObserver test(5, kVideoRotation_90, "H264",
388 VideoEncoder::Create(VideoEncoder::kH264), 397 VideoEncoder::Create(VideoEncoder::kH264),
389 H264Decoder::Create()); 398 H264Decoder::Create());
390 RunBaseTest(&test); 399 RunBaseTest(&test);
391 } 400 }
392 401
393 #endif // defined(WEBRTC_END_TO_END_H264_TESTS) 402 TEST_F(EndToEndTest, SendsAndReceivesH264PacketizationMode0) {
403 VideoEncoder* encoder = VideoEncoder::Create(VideoEncoder::kH264);
404 SetPacketizationMode(kH264PacketizationMode0, encoder);
405 // The CodecObserver takes ownership of the encoder.
406 CodecObserver test(500, kVideoRotation_0, "H264", encoder,
407 H264Decoder::Create());
408 RunBaseTest(&test);
409 }
410
411 TEST_F(EndToEndTest, SendsAndReceivesH264PacketizationMode1) {
412 VideoEncoder* encoder = VideoEncoder::Create(VideoEncoder::kH264);
413 SetPacketizationMode(kH264PacketizationMode1, encoder);
414 // The CodecObserver takes ownership of the encoder.
415 CodecObserver test(500, kVideoRotation_0, "H264", encoder,
416 H264Decoder::Create());
417 RunBaseTest(&test);
418 }
419
420 #endif // defined(WEBRTC_USE_H264)
394 421
395 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { 422 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) {
396 class SyncRtcpObserver : public test::EndToEndTest { 423 class SyncRtcpObserver : public test::EndToEndTest {
397 public: 424 public:
398 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {} 425 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {}
399 426
400 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { 427 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
401 RTCPUtility::RTCPParserV2 parser(packet, length, true); 428 RTCPUtility::RTCPParserV2 parser(packet, length, true);
402 EXPECT_TRUE(parser.IsValid()); 429 EXPECT_TRUE(parser.IsValid());
403 uint32_t ssrc = 0; 430 uint32_t ssrc = 0;
(...skipping 3558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3962 std::unique_ptr<VideoEncoder> encoder_; 3989 std::unique_ptr<VideoEncoder> encoder_;
3963 std::unique_ptr<VideoDecoder> decoder_; 3990 std::unique_ptr<VideoDecoder> decoder_;
3964 rtc::CriticalSection crit_; 3991 rtc::CriticalSection crit_;
3965 int recorded_frames_ GUARDED_BY(crit_); 3992 int recorded_frames_ GUARDED_BY(crit_);
3966 } test(this); 3993 } test(this);
3967 3994
3968 RunBaseTest(&test); 3995 RunBaseTest(&test);
3969 } 3996 }
3970 3997
3971 } // namespace webrtc 3998 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698