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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc

Issue 3000753002: Add a flags field to video timing extension. (Closed)
Patch Set: Final rebase try Created 3 years, 4 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 10
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "webrtc/api/video/video_timing.h"
14 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" 15 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
15 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" 16 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
16 #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" 17 #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" 21 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" 23 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" 24 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 .Times(0); // Not called because packet should not be protected. 988 .Times(0); // Not called because packet should not be protected.
988 989
989 const uint32_t kTimestamp = 1234; 990 const uint32_t kTimestamp = 1234;
990 const uint8_t kPayloadType = 127; 991 const uint8_t kPayloadType = 127;
991 const int64_t kCaptureTimeMs = fake_clock_.TimeInMilliseconds(); 992 const int64_t kCaptureTimeMs = fake_clock_.TimeInMilliseconds();
992 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; 993 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC";
993 EXPECT_EQ(0, rtp_sender_->RegisterPayload(payload_name, kPayloadType, 90000, 994 EXPECT_EQ(0, rtp_sender_->RegisterPayload(payload_name, kPayloadType, 90000,
994 0, 1500)); 995 0, 1500));
995 RTPVideoHeader video_header; 996 RTPVideoHeader video_header;
996 memset(&video_header, 0, sizeof(RTPVideoHeader)); 997 memset(&video_header, 0, sizeof(RTPVideoHeader));
997 video_header.video_timing.is_timing_frame = true; 998 video_header.video_timing.flags = TimingFrameFlags::kTriggeredByTimer;
998 EXPECT_TRUE(rtp_sender_->SendOutgoingData( 999 EXPECT_TRUE(rtp_sender_->SendOutgoingData(
999 kVideoFrameKey, kPayloadType, kTimestamp, kCaptureTimeMs, kPayloadData, 1000 kVideoFrameKey, kPayloadType, kTimestamp, kCaptureTimeMs, kPayloadData,
1000 sizeof(kPayloadData), nullptr, &video_header, nullptr)); 1001 sizeof(kPayloadData), nullptr, &video_header, nullptr));
1001 1002
1002 EXPECT_CALL(mock_rtc_event_log_, 1003 EXPECT_CALL(mock_rtc_event_log_,
1003 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)) 1004 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
1004 .Times(1); 1005 .Times(1);
1005 EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum, 1006 EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum,
1006 fake_clock_.TimeInMilliseconds(), 1007 fake_clock_.TimeInMilliseconds(),
1007 false, PacedPacketInfo())); 1008 false, PacedPacketInfo()));
1008 ASSERT_EQ(1, transport_.packets_sent()); 1009 ASSERT_EQ(1, transport_.packets_sent());
1009 const RtpPacketReceived& media_packet = transport_.sent_packets_[0]; 1010 const RtpPacketReceived& media_packet = transport_.sent_packets_[0];
1010 EXPECT_EQ(kMediaPayloadType, media_packet.PayloadType()); 1011 EXPECT_EQ(kMediaPayloadType, media_packet.PayloadType());
1011 EXPECT_EQ(kSeqNum, media_packet.SequenceNumber()); 1012 EXPECT_EQ(kSeqNum, media_packet.SequenceNumber());
1012 EXPECT_EQ(kMediaSsrc, media_packet.Ssrc()); 1013 EXPECT_EQ(kMediaSsrc, media_packet.Ssrc());
1013 1014
1014 // Now try to send not a timing frame. 1015 // Now try to send not a timing frame.
1015 uint16_t flexfec_seq_num; 1016 uint16_t flexfec_seq_num;
1016 EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kLowPriority, 1017 EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kLowPriority,
1017 kFlexfecSsrc, _, _, _, false)) 1018 kFlexfecSsrc, _, _, _, false))
1018 .WillOnce(testing::SaveArg<2>(&flexfec_seq_num)); 1019 .WillOnce(testing::SaveArg<2>(&flexfec_seq_num));
1019 EXPECT_CALL(mock_paced_sender_, 1020 EXPECT_CALL(mock_paced_sender_,
1020 InsertPacket(RtpPacketSender::kLowPriority, kMediaSsrc, 1021 InsertPacket(RtpPacketSender::kLowPriority, kMediaSsrc,
1021 kSeqNum + 1, _, _, false)); 1022 kSeqNum + 1, _, _, false));
1022 video_header.video_timing.is_timing_frame = false; 1023 video_header.video_timing.flags = TimingFrameFlags::kInvalid;
1023 EXPECT_TRUE(rtp_sender_->SendOutgoingData( 1024 EXPECT_TRUE(rtp_sender_->SendOutgoingData(
1024 kVideoFrameKey, kPayloadType, kTimestamp + 1, kCaptureTimeMs + 1, 1025 kVideoFrameKey, kPayloadType, kTimestamp + 1, kCaptureTimeMs + 1,
1025 kPayloadData, sizeof(kPayloadData), nullptr, &video_header, nullptr)); 1026 kPayloadData, sizeof(kPayloadData), nullptr, &video_header, nullptr));
1026 1027
1027 EXPECT_CALL(mock_rtc_event_log_, 1028 EXPECT_CALL(mock_rtc_event_log_,
1028 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)) 1029 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
1029 .Times(2); 1030 .Times(2);
1030 EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum + 1, 1031 EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum + 1,
1031 fake_clock_.TimeInMilliseconds(), 1032 fake_clock_.TimeInMilliseconds(),
1032 false, PacedPacketInfo())); 1033 false, PacedPacketInfo()));
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 uint8_t kFrame[kMaxPacketLength]; 1565 uint8_t kFrame[kMaxPacketLength];
1565 const int64_t kPacketizationTimeMs = 100; 1566 const int64_t kPacketizationTimeMs = 100;
1566 const int64_t kEncodeStartDeltaMs = 10; 1567 const int64_t kEncodeStartDeltaMs = 10;
1567 const int64_t kEncodeFinishDeltaMs = 50; 1568 const int64_t kEncodeFinishDeltaMs = 50;
1568 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( 1569 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
1569 kRtpExtensionVideoTiming, kVideoTimingExtensionId)); 1570 kRtpExtensionVideoTiming, kVideoTimingExtensionId));
1570 1571
1571 const int64_t kCaptureTimestamp = fake_clock_.TimeInMilliseconds(); 1572 const int64_t kCaptureTimestamp = fake_clock_.TimeInMilliseconds();
1572 1573
1573 RTPVideoHeader hdr = {0}; 1574 RTPVideoHeader hdr = {0};
1574 hdr.video_timing.is_timing_frame = true; 1575 hdr.video_timing.flags = TimingFrameFlags::kTriggeredByTimer;
1575 hdr.video_timing.encode_start_delta_ms = kEncodeStartDeltaMs; 1576 hdr.video_timing.encode_start_delta_ms = kEncodeStartDeltaMs;
1576 hdr.video_timing.encode_finish_delta_ms = kEncodeFinishDeltaMs; 1577 hdr.video_timing.encode_finish_delta_ms = kEncodeFinishDeltaMs;
1577 1578
1578 fake_clock_.AdvanceTimeMilliseconds(kPacketizationTimeMs); 1579 fake_clock_.AdvanceTimeMilliseconds(kPacketizationTimeMs);
1579 rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameKey, kPayload, 1580 rtp_sender_video_->SendVideo(kRtpVideoGeneric, kVideoFrameKey, kPayload,
1580 kTimestamp, kCaptureTimestamp, kFrame, 1581 kTimestamp, kCaptureTimestamp, kFrame,
1581 sizeof(kFrame), nullptr, &hdr); 1582 sizeof(kFrame), nullptr, &hdr);
1582 VideoSendTiming timing; 1583 VideoSendTiming timing;
1583 EXPECT_TRUE(transport_.last_sent_packet().GetExtension<VideoTimingExtension>( 1584 EXPECT_TRUE(transport_.last_sent_packet().GetExtension<VideoTimingExtension>(
1584 &timing)); 1585 &timing));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, 1753 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead,
1753 RtpSenderTestWithoutPacer, 1754 RtpSenderTestWithoutPacer,
1754 ::testing::Bool()); 1755 ::testing::Bool());
1755 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, 1756 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead,
1756 RtpSenderVideoTest, 1757 RtpSenderVideoTest,
1757 ::testing::Bool()); 1758 ::testing::Bool());
1758 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, 1759 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead,
1759 RtpSenderAudioTest, 1760 RtpSenderAudioTest,
1760 ::testing::Bool()); 1761 ::testing::Bool());
1761 } // namespace webrtc 1762 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698