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

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

Issue 2871173008: Fix packetization logic to leave space for extensions in the last packet (Closed)
Patch Set: Implemented danilchap@ comments Created 3 years, 7 months 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> // max 10 #include <algorithm> // max
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 class VideoRotationObserver : public test::SendTest { 256 class VideoRotationObserver : public test::SendTest {
257 public: 257 public:
258 VideoRotationObserver() : SendTest(kDefaultTimeoutMs) { 258 VideoRotationObserver() : SendTest(kDefaultTimeoutMs) {
259 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension( 259 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension(
260 kRtpExtensionVideoRotation, test::kVideoRotationExtensionId)); 260 kRtpExtensionVideoRotation, test::kVideoRotationExtensionId));
261 } 261 }
262 262
263 Action OnSendRtp(const uint8_t* packet, size_t length) override { 263 Action OnSendRtp(const uint8_t* packet, size_t length) override {
264 RTPHeader header; 264 RTPHeader header;
265 EXPECT_TRUE(parser_->Parse(packet, length, &header)); 265 EXPECT_TRUE(parser_->Parse(packet, length, &header));
266 // Only the last packet of the frame is required to have the extension.
267 if (!header.markerBit)
268 return SEND_PACKET;
266 EXPECT_TRUE(header.extension.hasVideoRotation); 269 EXPECT_TRUE(header.extension.hasVideoRotation);
267 EXPECT_EQ(kVideoRotation_90, header.extension.videoRotation); 270 EXPECT_EQ(kVideoRotation_90, header.extension.videoRotation);
268 observation_complete_.Set(); 271 observation_complete_.Set();
269 return SEND_PACKET; 272 return SEND_PACKET;
270 } 273 }
271 274
272 void ModifyVideoConfigs( 275 void ModifyVideoConfigs(
273 VideoSendStream::Config* send_config, 276 VideoSendStream::Config* send_config,
274 std::vector<VideoReceiveStream::Config>* receive_configs, 277 std::vector<VideoReceiveStream::Config>* receive_configs,
275 VideoEncoderConfig* encoder_config) override { 278 VideoEncoderConfig* encoder_config) override {
(...skipping 19 matching lines...) Expand all
295 class VideoRotationObserver : public test::SendTest { 298 class VideoRotationObserver : public test::SendTest {
296 public: 299 public:
297 VideoRotationObserver() : SendTest(kDefaultTimeoutMs) { 300 VideoRotationObserver() : SendTest(kDefaultTimeoutMs) {
298 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension( 301 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension(
299 kRtpExtensionVideoContentType, test::kVideoContentTypeExtensionId)); 302 kRtpExtensionVideoContentType, test::kVideoContentTypeExtensionId));
300 } 303 }
301 304
302 Action OnSendRtp(const uint8_t* packet, size_t length) override { 305 Action OnSendRtp(const uint8_t* packet, size_t length) override {
303 RTPHeader header; 306 RTPHeader header;
304 EXPECT_TRUE(parser_->Parse(packet, length, &header)); 307 EXPECT_TRUE(parser_->Parse(packet, length, &header));
308 // Only the last packet of the frame must have extension.
309 if (!header.markerBit)
310 return SEND_PACKET;
305 EXPECT_TRUE(header.extension.hasVideoContentType); 311 EXPECT_TRUE(header.extension.hasVideoContentType);
306 EXPECT_EQ(VideoContentType::SCREENSHARE, 312 EXPECT_EQ(VideoContentType::SCREENSHARE,
307 header.extension.videoContentType); 313 header.extension.videoContentType);
308 observation_complete_.Set(); 314 observation_complete_.Set();
309 return SEND_PACKET; 315 return SEND_PACKET;
310 } 316 }
311 317
312 void ModifyVideoConfigs( 318 void ModifyVideoConfigs(
313 VideoSendStream::Config* send_config, 319 VideoSendStream::Config* send_config,
314 std::vector<VideoReceiveStream::Config>* receive_configs, 320 std::vector<VideoReceiveStream::Config>* receive_configs,
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // Normal NACKs should use the send SSRC. 816 // Normal NACKs should use the send SSRC.
811 TestNackRetransmission(kVideoSendSsrcs[0], kFakeVideoSendPayloadType); 817 TestNackRetransmission(kVideoSendSsrcs[0], kFakeVideoSendPayloadType);
812 } 818 }
813 819
814 TEST_F(VideoSendStreamTest, RetransmitsNackOverRtx) { 820 TEST_F(VideoSendStreamTest, RetransmitsNackOverRtx) {
815 // NACKs over RTX should use a separate SSRC. 821 // NACKs over RTX should use a separate SSRC.
816 TestNackRetransmission(kSendRtxSsrcs[0], kSendRtxPayloadType); 822 TestNackRetransmission(kSendRtxSsrcs[0], kSendRtxPayloadType);
817 } 823 }
818 824
819 void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format, 825 void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
820 bool with_fec) { 826 bool with_fec) {
sprang_webrtc 2017/05/17 13:10:07 Maybe would be a good idea to add optional last-pa
ilnik 2017/05/17 15:06:34 No. It will complicate that test greatly, however,
sprang_webrtc 2017/05/18 09:48:19 Acknowledged.
821 // Use a fake encoder to output a frame of every size in the range [90, 290], 827 // Use a fake encoder to output a frame of every size in the range [90, 290],
822 // for each size making sure that the exact number of payload bytes received 828 // for each size making sure that the exact number of payload bytes received
823 // is correct and that packets are fragmented to respect max packet size. 829 // is correct and that packets are fragmented to respect max packet size.
824 static const size_t kMaxPacketSize = 128; 830 static const size_t kMaxPacketSize = 128;
825 static const size_t start = 90; 831 static const size_t start = 90;
826 static const size_t stop = 290; 832 static const size_t stop = 290;
827 833
828 // Observer that verifies that the expected number of packets and bytes 834 // Observer that verifies that the expected number of packets and bytes
829 // arrive for each frame size, from start_size to stop_size. 835 // arrive for each frame size, from start_size to stop_size.
830 class FrameFragmentationTest : public test::SendTest, 836 class FrameFragmentationTest : public test::SendTest,
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
3330 rtc::CriticalSection crit_; 3336 rtc::CriticalSection crit_;
3331 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); 3337 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_);
3332 bool first_packet_sent_ GUARDED_BY(&crit_); 3338 bool first_packet_sent_ GUARDED_BY(&crit_);
3333 rtc::Event bitrate_changed_event_; 3339 rtc::Event bitrate_changed_event_;
3334 } test; 3340 } test;
3335 3341
3336 RunBaseTest(&test); 3342 RunBaseTest(&test);
3337 } 3343 }
3338 3344
3339 } // namespace webrtc 3345 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698