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 |
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" |
12 | 12 |
13 #include <assert.h> // assert | 13 #include <assert.h> // assert |
14 #include <string.h> // memcpy | 14 #include <string.h> // memcpy |
15 | 15 |
16 #include <algorithm> // min | 16 #include <algorithm> // min |
17 #include <limits> // max | 17 #include <limits> // max |
18 #include <utility> | 18 #include <utility> |
19 | 19 |
20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
22 #include "webrtc/base/trace_event.h" | 22 #include "webrtc/base/trace_event.h" |
23 #include "webrtc/common_types.h" | 23 #include "webrtc/common_types.h" |
24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" |
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
| 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
32 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 33 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
33 | 34 |
34 namespace webrtc { | 35 namespace webrtc { |
35 | 36 |
36 using RTCPUtility::RTCPCnameInformation; | 37 using RTCPUtility::RTCPCnameInformation; |
37 | 38 |
38 NACKStringBuilder::NACKStringBuilder() | 39 NACKStringBuilder::NACKStringBuilder() |
39 : stream_(""), count_(0), prevNack_(0), consecutive_(false) {} | 40 : stream_(""), count_(0), prevNack_(0), consecutive_(false) {} |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 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 | 550 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 |
550 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 551 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
551 | First | Number | PictureID | | 552 | First | Number | PictureID | |
552 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
553 */ | 554 */ |
554 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) { | 555 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) { |
555 rtcp::Sli* sli = new rtcp::Sli(); | 556 rtcp::Sli* sli = new rtcp::Sli(); |
556 sli->From(ssrc_); | 557 sli->From(ssrc_); |
557 sli->To(remote_ssrc_); | 558 sli->To(remote_ssrc_); |
558 // Crop picture id to 6 least significant bits. | 559 // Crop picture id to 6 least significant bits. |
559 sli->WithPictureId(ctx.picture_id_ & 0x3F); | 560 sli->WithMacroblocks(ctx.picture_id_ & 0x3F, 0, 0x1fff); |
560 sli->WithFirstMb(0); | |
561 sli->WithNumberOfMb(0x1FFF); // 13 bits, only ones for now. | |
562 | 561 |
563 return rtc::scoped_ptr<rtcp::Sli>(sli); | 562 return rtc::scoped_ptr<rtcp::Sli>(sli); |
564 } | 563 } |
565 | 564 |
566 /* | 565 /* |
567 0 1 2 3 | 566 0 1 2 3 |
568 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 | 567 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 |
569 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 568 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
570 | PB |0| Payload Type| Native RPSI bit string | | 569 | PB |0| Payload Type| Native RPSI bit string | |
571 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 570 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 Transport* const transport_; | 1050 Transport* const transport_; |
1052 bool send_failure_; | 1051 bool send_failure_; |
1053 } sender(transport_); | 1052 } sender(transport_); |
1054 | 1053 |
1055 uint8_t buffer[IP_PACKET_SIZE]; | 1054 uint8_t buffer[IP_PACKET_SIZE]; |
1056 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && | 1055 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && |
1057 !sender.send_failure_; | 1056 !sender.send_failure_; |
1058 } | 1057 } |
1059 | 1058 |
1060 } // namespace webrtc | 1059 } // namespace webrtc |
OLD | NEW |