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

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

Issue 1338203003: Wire up send-side bandwidth estimation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments, rebase Created 5 years, 3 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
11 #include "webrtc/base/checks.h"
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 12 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
13 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
12 14
13 #include <assert.h> 15 #include <assert.h>
14 #include <math.h> // ceil 16 #include <math.h> // ceil
15 #include <string.h> // memcpy 17 #include <string.h> // memcpy
16 18
17 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
18 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
19 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
20 22
21 namespace webrtc { 23 namespace webrtc {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 { 75 {
74 return _packetType; 76 return _packetType;
75 } 77 }
76 78
77 const RTCPUtility::RTCPPacket& 79 const RTCPUtility::RTCPPacket&
78 RTCPUtility::RTCPParserV2::Packet() const 80 RTCPUtility::RTCPParserV2::Packet() const
79 { 81 {
80 return _packet; 82 return _packet;
81 } 83 }
82 84
85 rtcp::RtcpPacket* RTCPUtility::RTCPParserV2::ReleaseRtcpPacket() {
86 return rtcp_packet_.release();
87 }
83 RTCPUtility::RTCPPacketTypes 88 RTCPUtility::RTCPPacketTypes
84 RTCPUtility::RTCPParserV2::Begin() 89 RTCPUtility::RTCPParserV2::Begin()
85 { 90 {
86 _ptrRTCPData = _ptrRTCPDataBegin; 91 _ptrRTCPData = _ptrRTCPDataBegin;
87 92
88 return Iterate(); 93 return Iterate();
89 } 94 }
90 95
91 RTCPUtility::RTCPPacketTypes 96 RTCPUtility::RTCPPacketTypes
92 RTCPUtility::RTCPParserV2::Iterate() 97 RTCPUtility::RTCPParserV2::Iterate()
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 case 5: 1234 case 5:
1230 { 1235 {
1231 // RTCP-SR-REQ Rapid Synchronisation of RTP Flows 1236 // RTCP-SR-REQ Rapid Synchronisation of RTP Flows
1232 // draft-perkins-avt-rapid-rtp-sync-03.txt 1237 // draft-perkins-avt-rapid-rtp-sync-03.txt
1233 // trigger a new RTCP SR 1238 // trigger a new RTCP SR
1234 _packetType = RTCPPacketTypes::kRtpfbSrReq; 1239 _packetType = RTCPPacketTypes::kRtpfbSrReq;
1235 1240
1236 // Note: No state transition, SR REQ is empty! 1241 // Note: No state transition, SR REQ is empty!
1237 return true; 1242 return true;
1238 } 1243 }
1244 case 15: {
1245 _packetType = RTCPPacketTypes::kTransportFeedback;
1246 rtcp_packet_ =
1247 rtcp::TransportFeedback::ParseFrom(_ptrRTCPData - 12, length);
1248 // Since we parse the whole packet here, keep the TopLevel state and
1249 // just end the current block.
1250 EndCurrentBlock();
1251
1252 return rtcp_packet_.get() != nullptr;
1253 }
1239 default: 1254 default:
1240 break; 1255 break;
1241 } 1256 }
1242 EndCurrentBlock(); 1257 EndCurrentBlock();
1243 return false; 1258 return false;
stefan-webrtc 2015/09/18 10:57:23 I think it would be easier to read if we to put an
sprang_webrtc 2015/09/21 10:44:10 All cases in this switch returns true. There is on
stefan-webrtc 2015/09/21 11:12:07 Sounds good. log it once every 10 seconds maybe?
sprang_webrtc 2015/09/21 13:42:53 Done.
1244 } else if (header.packet_type == PT_PSFB) { 1259 } else if (header.packet_type == PT_PSFB) {
1245 // Payload specific feedback 1260 // Payload specific feedback
1246 switch (header.count_or_format) { 1261 switch (header.count_or_format) {
1247 case 1: 1262 case 1:
1248 // PLI 1263 // PLI
1249 _packetType = RTCPPacketTypes::kPsfbPli; 1264 _packetType = RTCPPacketTypes::kPsfbPli;
1250 _packet.PLI.SenderSSRC = senderSSRC; 1265 _packet.PLI.SenderSSRC = senderSSRC;
1251 _packet.PLI.MediaSSRC = mediaSSRC; 1266 _packet.PLI.MediaSSRC = mediaSSRC;
1252 1267
1253 // Note: No state transition, PLI FCI is empty! 1268 // Note: No state transition, PLI FCI is empty!
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 const RTCPUtility::RtcpCommonHeader* 1706 const RTCPUtility::RtcpCommonHeader*
1692 RTCPUtility::RTCPPacketIterator::Current() { 1707 RTCPUtility::RTCPPacketIterator::Current() {
1693 if (!_ptrBlock) 1708 if (!_ptrBlock)
1694 { 1709 {
1695 return NULL; 1710 return NULL;
1696 } 1711 }
1697 1712
1698 return &_header; 1713 return &_header;
1699 } 1714 }
1700 } // namespace webrtc 1715 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698