| OLD | NEW | 
|     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  Loading... | 
|   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   // Bug webrtc:7859. While FEC is invoked from rtp_sender_video, and not after | 
 |   740   // the pacer, these modifications of the header below are happening after the | 
 |   741   // FEC protection packets are calculated. This will corrupt recovered packets | 
 |   742   // at the same place. It's not an issue for extensions, which are present in | 
 |   743   // all the packets (their content just may be incorrect on recovered packets). | 
 |   744   // In case of VideoTimingExtension, since it's present not in every packet, | 
 |   745   // data after rtp header may be corrupted if these packets are protected by | 
 |   746   // the FEC. | 
|   739   int64_t now_ms = clock_->TimeInMilliseconds(); |   747   int64_t now_ms = clock_->TimeInMilliseconds(); | 
|   740   int64_t diff_ms = now_ms - capture_time_ms; |   748   int64_t diff_ms = now_ms - capture_time_ms; | 
|   741   packet_to_send->SetExtension<TransmissionOffset>(kTimestampTicksPerMs * |   749   packet_to_send->SetExtension<TransmissionOffset>(kTimestampTicksPerMs * | 
|   742                                                    diff_ms); |   750                                                    diff_ms); | 
|   743   packet_to_send->SetExtension<AbsoluteSendTime>( |   751   packet_to_send->SetExtension<AbsoluteSendTime>( | 
|   744       AbsoluteSendTime::MsTo24Bits(now_ms)); |   752       AbsoluteSendTime::MsTo24Bits(now_ms)); | 
|   745  |   753  | 
|   746   // TODO(ilnik): (webrtc:7859) For now we can't modify pacer exit timestamp in |   754   if (packet_to_send->HasExtension<VideoTimingExtension>()) | 
|   747   // video timing extension because only some packets have it and it will break |   755     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  |   756  | 
|   752   PacketOptions options; |   757   PacketOptions options; | 
|   753   if (UpdateTransportSequenceNumber(packet_to_send, &options.packet_id)) { |   758   if (UpdateTransportSequenceNumber(packet_to_send, &options.packet_id)) { | 
|   754     AddPacketToTransportFeedback(options.packet_id, *packet_to_send, |   759     AddPacketToTransportFeedback(options.packet_id, *packet_to_send, | 
|   755                                  pacing_info); |   760                                  pacing_info); | 
|   756   } |   761   } | 
|   757  |   762  | 
|   758   if (!is_retransmit && !send_over_rtx) { |   763   if (!is_retransmit && !send_over_rtx) { | 
|   759     UpdateDelayStatistics(packet->capture_time_ms(), now_ms); |   764     UpdateDelayStatistics(packet->capture_time_ms(), now_ms); | 
|   760     UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), |   765     UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   829                               RtpPacketSender::Priority priority) { |   834                               RtpPacketSender::Priority priority) { | 
|   830   RTC_DCHECK(packet); |   835   RTC_DCHECK(packet); | 
|   831   int64_t now_ms = clock_->TimeInMilliseconds(); |   836   int64_t now_ms = clock_->TimeInMilliseconds(); | 
|   832  |   837  | 
|   833   // |capture_time_ms| <= 0 is considered invalid. |   838   // |capture_time_ms| <= 0 is considered invalid. | 
|   834   // TODO(holmer): This should be changed all over Video Engine so that negative |   839   // 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. |   840   // time is consider invalid, while 0 is considered a valid time. | 
|   836   if (packet->capture_time_ms() > 0) { |   841   if (packet->capture_time_ms() > 0) { | 
|   837     packet->SetExtension<TransmissionOffset>( |   842     packet->SetExtension<TransmissionOffset>( | 
|   838         kTimestampTicksPerMs * (now_ms - packet->capture_time_ms())); |   843         kTimestampTicksPerMs * (now_ms - packet->capture_time_ms())); | 
|   839     // TODO(ilnik): (webrtc:7859) For now we can't modify pacer exit timestamp |   844     if (packet->HasExtension<VideoTimingExtension>()) | 
|   840     // in video timing extension because only some packets have it an it will |   845       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   } |   846   } | 
|   845   packet->SetExtension<AbsoluteSendTime>(AbsoluteSendTime::MsTo24Bits(now_ms)); |   847   packet->SetExtension<AbsoluteSendTime>(AbsoluteSendTime::MsTo24Bits(now_ms)); | 
|   846  |   848  | 
|   847   if (video_) { |   849   if (video_) { | 
|   848     BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoTotBitrate_kbps", now_ms, |   850     BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoTotBitrate_kbps", now_ms, | 
|   849                                     ActualSendBitrateKbit(), packet->Ssrc()); |   851                                     ActualSendBitrateKbit(), packet->Ssrc()); | 
|   850     BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoFecBitrate_kbps", now_ms, |   852     BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoFecBitrate_kbps", now_ms, | 
|   851                                     FecOverheadRate() / 1000, packet->Ssrc()); |   853                                     FecOverheadRate() / 1000, packet->Ssrc()); | 
|   852     BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoNackBitrate_kbps", now_ms, |   854     BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoNackBitrate_kbps", now_ms, | 
|   853                                     NackOverheadRate() / 1000, packet->Ssrc()); |   855                                     NackOverheadRate() / 1000, packet->Ssrc()); | 
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1281     if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { |  1283     if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { | 
|  1282       return; |  1284       return; | 
|  1283     } |  1285     } | 
|  1284     rtp_overhead_bytes_per_packet_ = packet.headers_size(); |  1286     rtp_overhead_bytes_per_packet_ = packet.headers_size(); | 
|  1285     overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; |  1287     overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; | 
|  1286   } |  1288   } | 
|  1287   overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); |  1289   overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); | 
|  1288 } |  1290 } | 
|  1289  |  1291  | 
|  1290 }  // namespace webrtc |  1292 }  // namespace webrtc | 
| OLD | NEW |