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 12 matching lines...) Expand all Loading... | |
23 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 23 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" | |
34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" |
35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" | |
37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" |
38 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" |
39 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
40 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 38 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
41 #include "webrtc/modules/rtp_rtcp/source/time_util.h" | 39 #include "webrtc/modules/rtp_rtcp/source/time_util.h" |
42 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" | 40 #include "webrtc/modules/rtp_rtcp/source/tmmbr_help.h" |
43 | 41 |
44 namespace webrtc { | 42 namespace webrtc { |
45 | 43 |
46 namespace { | 44 namespace { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 NtpTime now) | 131 NtpTime now) |
134 : feedback_state_(feedback_state), | 132 : feedback_state_(feedback_state), |
135 nack_size_(nack_size), | 133 nack_size_(nack_size), |
136 nack_list_(nack_list), | 134 nack_list_(nack_list), |
137 picture_id_(picture_id), | 135 picture_id_(picture_id), |
138 now_(now) {} | 136 now_(now) {} |
139 | 137 |
140 const FeedbackState& feedback_state_; | 138 const FeedbackState& feedback_state_; |
141 const int32_t nack_size_; | 139 const int32_t nack_size_; |
142 const uint16_t* nack_list_; | 140 const uint16_t* nack_list_; |
143 const uint64_t picture_id_; | 141 const uint64_t picture_id_; |
danilchap
2017/03/14 13:31:46
may be remove this field too in this CL
nisse-webrtc
2017/03/14 13:41:09
Done.
| |
144 const NtpTime now_; | 142 const NtpTime now_; |
145 }; | 143 }; |
146 | 144 |
147 RTCPSender::RTCPSender( | 145 RTCPSender::RTCPSender( |
148 bool audio, | 146 bool audio, |
149 Clock* clock, | 147 Clock* clock, |
150 ReceiveStatistics* receive_statistics, | 148 ReceiveStatistics* receive_statistics, |
151 RtcpPacketTypeCounterObserver* packet_type_counter_observer, | 149 RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
152 RtcEventLog* event_log, | 150 RtcEventLog* event_log, |
153 Transport* outgoing_transport) | 151 Transport* outgoing_transport) |
(...skipping 29 matching lines...) Expand all Loading... | |
183 | 181 |
184 xr_send_receiver_reference_time_enabled_(false), | 182 xr_send_receiver_reference_time_enabled_(false), |
185 packet_type_counter_observer_(packet_type_counter_observer) { | 183 packet_type_counter_observer_(packet_type_counter_observer) { |
186 RTC_DCHECK(transport_ != nullptr); | 184 RTC_DCHECK(transport_ != nullptr); |
187 | 185 |
188 builders_[kRtcpSr] = &RTCPSender::BuildSR; | 186 builders_[kRtcpSr] = &RTCPSender::BuildSR; |
189 builders_[kRtcpRr] = &RTCPSender::BuildRR; | 187 builders_[kRtcpRr] = &RTCPSender::BuildRR; |
190 builders_[kRtcpSdes] = &RTCPSender::BuildSDES; | 188 builders_[kRtcpSdes] = &RTCPSender::BuildSDES; |
191 builders_[kRtcpPli] = &RTCPSender::BuildPLI; | 189 builders_[kRtcpPli] = &RTCPSender::BuildPLI; |
192 builders_[kRtcpFir] = &RTCPSender::BuildFIR; | 190 builders_[kRtcpFir] = &RTCPSender::BuildFIR; |
193 builders_[kRtcpSli] = &RTCPSender::BuildSLI; | |
194 builders_[kRtcpRpsi] = &RTCPSender::BuildRPSI; | |
195 builders_[kRtcpRemb] = &RTCPSender::BuildREMB; | 191 builders_[kRtcpRemb] = &RTCPSender::BuildREMB; |
196 builders_[kRtcpBye] = &RTCPSender::BuildBYE; | 192 builders_[kRtcpBye] = &RTCPSender::BuildBYE; |
197 builders_[kRtcpApp] = &RTCPSender::BuildAPP; | 193 builders_[kRtcpApp] = &RTCPSender::BuildAPP; |
198 builders_[kRtcpTmmbr] = &RTCPSender::BuildTMMBR; | 194 builders_[kRtcpTmmbr] = &RTCPSender::BuildTMMBR; |
199 builders_[kRtcpTmmbn] = &RTCPSender::BuildTMMBN; | 195 builders_[kRtcpTmmbn] = &RTCPSender::BuildTMMBN; |
200 builders_[kRtcpNack] = &RTCPSender::BuildNACK; | 196 builders_[kRtcpNack] = &RTCPSender::BuildNACK; |
201 builders_[kRtcpAnyExtendedReports] = &RTCPSender::BuildExtendedReports; | 197 builders_[kRtcpAnyExtendedReports] = &RTCPSender::BuildExtendedReports; |
202 } | 198 } |
203 | 199 |
204 RTCPSender::~RTCPSender() {} | 200 RTCPSender::~RTCPSender() {} |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 | 505 |
510 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 506 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
511 "RTCPSender::FIR"); | 507 "RTCPSender::FIR"); |
512 ++packet_type_counter_.fir_packets; | 508 ++packet_type_counter_.fir_packets; |
513 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount", | 509 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount", |
514 ssrc_, packet_type_counter_.fir_packets); | 510 ssrc_, packet_type_counter_.fir_packets); |
515 | 511 |
516 return std::unique_ptr<rtcp::RtcpPacket>(fir); | 512 return std::unique_ptr<rtcp::RtcpPacket>(fir); |
517 } | 513 } |
518 | 514 |
519 /* | |
520 0 1 2 3 | |
521 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
522 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
523 | First | Number | PictureID | | |
524 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
525 */ | |
526 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) { | |
527 rtcp::Sli* sli = new rtcp::Sli(); | |
528 sli->SetSenderSsrc(ssrc_); | |
529 sli->SetMediaSsrc(remote_ssrc_); | |
530 // Crop picture id to 6 least significant bits. | |
531 sli->AddPictureId(ctx.picture_id_ & 0x3F); | |
532 | |
533 return std::unique_ptr<rtcp::RtcpPacket>(sli); | |
534 } | |
535 | |
536 /* | |
537 0 1 2 3 | |
538 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
539 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
540 | PB |0| Payload Type| Native RPSI bit string | | |
541 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
542 | defined per codec ... | Padding (0) | | |
543 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
544 */ | |
545 /* | |
546 * Note: not generic made for VP8 | |
547 */ | |
548 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildRPSI( | |
549 const RtcpContext& ctx) { | |
550 if (ctx.feedback_state_.send_payload_type == 0xFF) | |
551 return nullptr; | |
552 | |
553 rtcp::Rpsi* rpsi = new rtcp::Rpsi(); | |
554 rpsi->SetSenderSsrc(ssrc_); | |
555 rpsi->SetMediaSsrc(remote_ssrc_); | |
556 rpsi->SetPayloadType(ctx.feedback_state_.send_payload_type); | |
557 rpsi->SetPictureId(ctx.picture_id_); | |
558 | |
559 return std::unique_ptr<rtcp::RtcpPacket>(rpsi); | |
560 } | |
561 | |
562 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB( | 515 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB( |
563 const RtcpContext& ctx) { | 516 const RtcpContext& ctx) { |
564 rtcp::Remb* remb = new rtcp::Remb(); | 517 rtcp::Remb* remb = new rtcp::Remb(); |
565 remb->SetSenderSsrc(ssrc_); | 518 remb->SetSenderSsrc(ssrc_); |
566 remb->SetBitrateBps(remb_bitrate_); | 519 remb->SetBitrateBps(remb_bitrate_); |
567 remb->SetSsrcs(remb_ssrcs_); | 520 remb->SetSsrcs(remb_ssrcs_); |
568 | 521 |
569 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 522 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
570 "RTCPSender::REMB"); | 523 "RTCPSender::REMB"); |
571 | 524 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1052 max_packet_size = max_packet_size_; | 1005 max_packet_size = max_packet_size_; |
1053 } | 1006 } |
1054 | 1007 |
1055 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); | 1008 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); |
1056 uint8_t buffer[IP_PACKET_SIZE]; | 1009 uint8_t buffer[IP_PACKET_SIZE]; |
1057 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && | 1010 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && |
1058 !sender.send_failure_; | 1011 !sender.send_failure_; |
1059 } | 1012 } |
1060 | 1013 |
1061 } // namespace webrtc | 1014 } // namespace webrtc |
OLD | NEW |