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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.cc

Issue 2020203002: [rtcp] RapidResyncRequest::Parse updated not to use RTCPUtility (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix compile Created 4 years, 6 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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_packet/rapid_resync_request.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/base/logging.h" 14 #include "webrtc/base/logging.h"
15 15 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
16 using webrtc::RTCPUtility::RtcpCommonHeader;
17 16
18 namespace webrtc { 17 namespace webrtc {
19 namespace rtcp { 18 namespace rtcp {
19 constexpr uint8_t RapidResyncRequest::kFeedbackMessageType;
20 // RFC 4585: Feedback format. 20 // RFC 4585: Feedback format.
21 // Rapid Resynchronisation Request (draft-perkins-avt-rapid-rtp-sync-03). 21 // Rapid Resynchronisation Request (draft-perkins-avt-rapid-rtp-sync-03).
22 // 22 //
23 // 0 1 2 3 23 // 0 1 2 3
24 // 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 24 // 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
25 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 25 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
26 // |V=2|P| FMT=5 | PT=205 | length=2 | 26 // |V=2|P| FMT=5 | PT=205 | length=2 |
27 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 27 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28 // | SSRC of packet sender | 28 // | SSRC of packet sender |
29 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 29 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30 // | SSRC of media source | 30 // | SSRC of media source |
31 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 31 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 bool RapidResyncRequest::Parse(const RtcpCommonHeader& header, 32 bool RapidResyncRequest::Parse(const CommonHeader& packet) {
33 const uint8_t* payload) { 33 RTC_DCHECK_EQ(packet.type(), kPacketType);
34 RTC_CHECK(header.packet_type == kPacketType); 34 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
35 RTC_CHECK(header.count_or_format == kFeedbackMessageType);
36 35
37 if (header.payload_size_bytes != kCommonFeedbackLength) { 36 if (packet.payload_size_bytes() != kCommonFeedbackLength) {
38 LOG(LS_WARNING) << "Packet payload size should be " << kCommonFeedbackLength 37 LOG(LS_WARNING) << "Packet payload size should be " << kCommonFeedbackLength
39 << " instead of " << header.payload_size_bytes 38 << " instead of " << packet.payload_size_bytes()
40 << " to be a valid Rapid Resynchronisation Request"; 39 << " to be a valid Rapid Resynchronisation Request";
41 return false; 40 return false;
42 } 41 }
43 42
44 ParseCommonFeedback(payload); 43 ParseCommonFeedback(packet.payload());
45 return true; 44 return true;
46 } 45 }
47 46
48 bool RapidResyncRequest::Create( 47 bool RapidResyncRequest::Create(
49 uint8_t* packet, 48 uint8_t* packet,
50 size_t* index, 49 size_t* index,
51 size_t max_length, 50 size_t max_length,
52 RtcpPacket::PacketReadyCallback* callback) const { 51 RtcpPacket::PacketReadyCallback* callback) const {
53 while (*index + BlockLength() > max_length) { 52 while (*index + BlockLength() > max_length) {
54 if (!OnBufferFull(packet, index, callback)) 53 if (!OnBufferFull(packet, index, callback))
55 return false; 54 return false;
56 } 55 }
57 56
58 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, 57 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet,
59 index); 58 index);
60 CreateCommonFeedback(packet + *index); 59 CreateCommonFeedback(packet + *index);
61 *index += kCommonFeedbackLength; 60 *index += kCommonFeedbackLength;
62 return true; 61 return true;
63 } 62 }
64 } // namespace rtcp 63 } // namespace rtcp
65 } // namespace webrtc 64 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698