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

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

Issue 2947133002: Fix timing frames and FEC conflict (Closed)
Patch Set: Modify VideoSendStream test for video timing extension Created 3 years, 6 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
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 "seqnum", packet->SequenceNumber()); 729 "seqnum", packet->SequenceNumber());
730 730
731 std::unique_ptr<RtpPacketToSend> packet_rtx; 731 std::unique_ptr<RtpPacketToSend> packet_rtx;
732 if (send_over_rtx) { 732 if (send_over_rtx) {
733 packet_rtx = BuildRtxPacket(*packet); 733 packet_rtx = BuildRtxPacket(*packet);
734 if (!packet_rtx) 734 if (!packet_rtx)
735 return false; 735 return false;
736 packet_to_send = packet_rtx.get(); 736 packet_to_send = packet_rtx.get();
737 } 737 }
738 738
739
740 // Bug webrtc:7859. While FEC is invoked from rtp_sender_video, and not after
741 // the pacer, these modifications of the header below are happening after the
742 // FEC protection packets are calculated. This will corrupt recovered packets
743 // at the same place. It's not an issue for extensions, which are present in
744 // all the packets (their content just may be incorrect on recovered packets).
745 // In case of VideoTimingExtension, since it's present not in every packet,
746 // data after rtp header may be corrupted if these packets are protected by
747 // the FEC.
739 int64_t now_ms = clock_->TimeInMilliseconds(); 748 int64_t now_ms = clock_->TimeInMilliseconds();
740 int64_t diff_ms = now_ms - capture_time_ms; 749 int64_t diff_ms = now_ms - capture_time_ms;
741 packet_to_send->SetExtension<TransmissionOffset>(kTimestampTicksPerMs * 750 packet_to_send->SetExtension<TransmissionOffset>(kTimestampTicksPerMs *
742 diff_ms); 751 diff_ms);
743 packet_to_send->SetExtension<AbsoluteSendTime>( 752 packet_to_send->SetExtension<AbsoluteSendTime>(
744 AbsoluteSendTime::MsTo24Bits(now_ms)); 753 AbsoluteSendTime::MsTo24Bits(now_ms));
745 754
746 // TODO(ilnik): (webrtc:7859) For now we can't modify pacer exit timestamp in 755 if (packet_to_send->HasExtension<VideoTimingExtension>())
747 // video timing extension because only some packets have it and it will break 756 packet_to_send->set_pacer_exit_time_ms(now_ms);
748 // FEC recovered packets, which will lead to corruptions. Ideally, here
749 // |packet->set_pacer_exit_time_ms(now_ms)| should be called if
750 // |VideoTimingExtension| is present.
751 757
752 PacketOptions options; 758 PacketOptions options;
753 if (UpdateTransportSequenceNumber(packet_to_send, &options.packet_id)) { 759 if (UpdateTransportSequenceNumber(packet_to_send, &options.packet_id)) {
754 AddPacketToTransportFeedback(options.packet_id, *packet_to_send, 760 AddPacketToTransportFeedback(options.packet_id, *packet_to_send,
755 pacing_info); 761 pacing_info);
756 } 762 }
757 763
758 if (!is_retransmit && !send_over_rtx) { 764 if (!is_retransmit && !send_over_rtx) {
759 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); 765 UpdateDelayStatistics(packet->capture_time_ms(), now_ms);
760 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), 766 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 RtpPacketSender::Priority priority) { 835 RtpPacketSender::Priority priority) {
830 RTC_DCHECK(packet); 836 RTC_DCHECK(packet);
831 int64_t now_ms = clock_->TimeInMilliseconds(); 837 int64_t now_ms = clock_->TimeInMilliseconds();
832 838
833 // |capture_time_ms| <= 0 is considered invalid. 839 // |capture_time_ms| <= 0 is considered invalid.
834 // TODO(holmer): This should be changed all over Video Engine so that negative 840 // TODO(holmer): This should be changed all over Video Engine so that negative
835 // time is consider invalid, while 0 is considered a valid time. 841 // time is consider invalid, while 0 is considered a valid time.
836 if (packet->capture_time_ms() > 0) { 842 if (packet->capture_time_ms() > 0) {
837 packet->SetExtension<TransmissionOffset>( 843 packet->SetExtension<TransmissionOffset>(
838 kTimestampTicksPerMs * (now_ms - packet->capture_time_ms())); 844 kTimestampTicksPerMs * (now_ms - packet->capture_time_ms()));
839 // TODO(ilnik): (webrtc:7859) For now we can't modify pacer exit timestamp 845 if (packet->HasExtension<VideoTimingExtension>())
840 // in video timing extension because only some packets have it an it will 846 packet->set_pacer_exit_time_ms(now_ms);
841 // break FEC recovered packets, which will lead to corruptions. Ideally,
842 // here |packet->set_pacer_exit_time_ms(now_ms)| should be called if
843 // |VideoTimingExtension| is present.
844 } 847 }
845 packet->SetExtension<AbsoluteSendTime>(AbsoluteSendTime::MsTo24Bits(now_ms)); 848 packet->SetExtension<AbsoluteSendTime>(AbsoluteSendTime::MsTo24Bits(now_ms));
846 849
847 if (video_) { 850 if (video_) {
848 BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoTotBitrate_kbps", now_ms, 851 BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoTotBitrate_kbps", now_ms,
849 ActualSendBitrateKbit(), packet->Ssrc()); 852 ActualSendBitrateKbit(), packet->Ssrc());
850 BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoFecBitrate_kbps", now_ms, 853 BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoFecBitrate_kbps", now_ms,
851 FecOverheadRate() / 1000, packet->Ssrc()); 854 FecOverheadRate() / 1000, packet->Ssrc());
852 BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoNackBitrate_kbps", now_ms, 855 BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoNackBitrate_kbps", now_ms,
853 NackOverheadRate() / 1000, packet->Ssrc()); 856 NackOverheadRate() / 1000, packet->Ssrc());
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { 1284 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) {
1282 return; 1285 return;
1283 } 1286 }
1284 rtp_overhead_bytes_per_packet_ = packet.headers_size(); 1287 rtp_overhead_bytes_per_packet_ = packet.headers_size();
1285 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; 1288 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_;
1286 } 1289 }
1287 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); 1290 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet);
1288 } 1291 }
1289 1292
1290 } // namespace webrtc 1293 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc » ('j') | webrtc/video/video_send_stream_tests.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698