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

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

Issue 2362373002: Remove chain of methods in RtpRtcp module to get current payload frequency for RTCP SRs (Closed)
Patch Set: comment Created 4 years, 2 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 std::string NACKStringBuilder::GetResult() { 66 std::string NACKStringBuilder::GetResult() {
67 if (consecutive_) { 67 if (consecutive_) {
68 stream_ << "-" << prevNack_; 68 stream_ << "-" << prevNack_;
69 consecutive_ = false; 69 consecutive_ = false;
70 } 70 }
71 return stream_.str(); 71 return stream_.str();
72 } 72 }
73 73
74 RTCPSender::FeedbackState::FeedbackState() 74 RTCPSender::FeedbackState::FeedbackState()
75 : send_payload_type(0), 75 : send_payload_type(0),
76 frequency_hz(0),
77 packets_sent(0), 76 packets_sent(0),
78 media_bytes_sent(0), 77 media_bytes_sent(0),
79 send_bitrate(0), 78 send_bitrate(0),
80 last_rr_ntp_secs(0), 79 last_rr_ntp_secs(0),
81 last_rr_ntp_frac(0), 80 last_rr_ntp_frac(0),
82 remote_sr(0), 81 remote_sr(0),
83 has_last_xr_rr(false), 82 has_last_xr_rr(false),
84 module(nullptr) {} 83 module(nullptr) {}
85 84
86 class PacketContainer : public rtcp::CompoundPacket, 85 class PacketContainer : public rtcp::CompoundPacket,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 return false; 435 return false;
437 } 436 }
438 437
439 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSR(const RtcpContext& ctx) { 438 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSR(const RtcpContext& ctx) {
440 // Timestamp shouldn't be estimated before first media frame. 439 // Timestamp shouldn't be estimated before first media frame.
441 RTC_DCHECK_GE(last_frame_capture_time_ms_, 0); 440 RTC_DCHECK_GE(last_frame_capture_time_ms_, 0);
442 // The timestamp of this RTCP packet should be estimated as the timestamp of 441 // The timestamp of this RTCP packet should be estimated as the timestamp of
443 // the frame being captured at this moment. We are calculating that 442 // the frame being captured at this moment. We are calculating that
444 // timestamp as the last frame's timestamp + the time since the last frame 443 // timestamp as the last frame's timestamp + the time since the last frame
445 // was captured. 444 // was captured.
445 uint32_t rtp_rate =
446 (audio_ ? kBogusRtpRateForAudioRtcp : kVideoPayloadTypeFrequency) / 1000;
446 uint32_t rtp_timestamp = 447 uint32_t rtp_timestamp =
447 timestamp_offset_ + last_rtp_timestamp_ + 448 timestamp_offset_ + last_rtp_timestamp_ +
448 (clock_->TimeInMilliseconds() - last_frame_capture_time_ms_) * 449 (clock_->TimeInMilliseconds() - last_frame_capture_time_ms_) * rtp_rate;
449 (ctx.feedback_state_.frequency_hz / 1000);
450 450
451 rtcp::SenderReport* report = new rtcp::SenderReport(); 451 rtcp::SenderReport* report = new rtcp::SenderReport();
452 report->SetSenderSsrc(ssrc_); 452 report->SetSenderSsrc(ssrc_);
453 report->SetNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_)); 453 report->SetNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
454 report->SetRtpTimestamp(rtp_timestamp); 454 report->SetRtpTimestamp(rtp_timestamp);
455 report->SetPacketCount(ctx.feedback_state_.packets_sent); 455 report->SetPacketCount(ctx.feedback_state_.packets_sent);
456 report->SetOctetCount(ctx.feedback_state_.media_bytes_sent); 456 report->SetOctetCount(ctx.feedback_state_.media_bytes_sent);
457 457
458 for (auto it : report_blocks_) 458 for (auto it : report_blocks_)
459 report->AddReportBlock(it.second); 459 report->AddReportBlock(it.second);
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 // but we can't because of an incorrect warning (C4822) in MVS 2013. 1042 // but we can't because of an incorrect warning (C4822) in MVS 2013.
1043 } sender(transport_, event_log_); 1043 } sender(transport_, event_log_);
1044 1044
1045 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); 1045 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE));
1046 uint8_t buffer[IP_PACKET_SIZE]; 1046 uint8_t buffer[IP_PACKET_SIZE];
1047 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && 1047 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) &&
1048 !sender.send_failure_; 1048 !sender.send_failure_;
1049 } 1049 }
1050 1050
1051 } // namespace webrtc 1051 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698