Chromium Code Reviews| Index: webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
| diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
| index fe0e49f79e6a2df6194a307095fe8c40beb49062..c786b856bf900518a44ea404e4fbc0cd29d45527 100644 |
| --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
| +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc |
| @@ -1240,7 +1240,7 @@ size_t RTPSender::CreateRtpHeader(uint8_t* header, |
| } |
| uint16_t len = |
| - BuildRTPHeaderExtension(header + rtp_header_length, marker_bit); |
| + BuildRtpHeaderExtension(header + rtp_header_length, marker_bit); |
| if (len > 0) { |
| header[0] |= 0x10; // Set extension bit. |
| rtp_header_length += len; |
| @@ -1255,17 +1255,25 @@ int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer, |
| int64_t capture_time_ms, |
| bool timestamp_provided, |
| bool inc_sequence_number) { |
| + if (!timestamp_provided) { |
| + rtc::CritScope lock(&send_critsect_); |
|
danilchap
2016/06/15 20:04:21
this is not a thread-safe way to keep old behavior
Sergey Ulanov
2016/06/15 20:53:24
Done.
|
| + // Calculate |capture_timestamp| so that BuildRtpHeader() effectively will |
| + // set timestamp_ = timestamp_ + 1. |
| + capture_timestamp = timestamp_ - start_timestamp_ + 1; |
| + } |
| + return BuildRtpHeader(data_buffer, payload_type, marker_bit, |
| + capture_timestamp, capture_time_ms); |
| +} |
| + |
| +int32_t RTPSender::BuildRtpHeader(uint8_t* data_buffer, |
| + int8_t payload_type, |
| + bool marker_bit, |
| + uint32_t capture_timestamp, |
| + int64_t capture_time_ms) { |
| assert(payload_type >= 0); |
| rtc::CritScope lock(&send_critsect_); |
| - if (timestamp_provided) { |
| - timestamp_ = start_timestamp_ + capture_timestamp; |
| - } else { |
| - // Make a unique time stamp. |
| - // We can't inc by the actual time, since then we increase the risk of back |
| - // timing. |
| - timestamp_++; |
| - } |
| + timestamp_ = start_timestamp_ + capture_timestamp; |
| last_timestamp_time_ms_ = clock_->TimeInMilliseconds(); |
| uint32_t sequence_number = sequence_number_++; |
| capture_time_ms_ = capture_time_ms; |
| @@ -1274,7 +1282,7 @@ int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer, |
| timestamp_, sequence_number, csrcs_); |
| } |
| -uint16_t RTPSender::BuildRTPHeaderExtension(uint8_t* data_buffer, |
| +uint16_t RTPSender::BuildRtpHeaderExtension(uint8_t* data_buffer, |
| bool marker_bit) const { |
| if (rtp_header_extension_map_.Size() <= 0) { |
| return 0; |