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

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

Issue 1309833002: Send RTCP packets via RtcpPacket callback (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Send RTCP messags directly via callback, refactoring, rebase Created 5 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 private: 678 private:
679 bool called_; 679 bool called_;
680 RawPacket* const packet_; 680 RawPacket* const packet_;
681 } verifier(packet.get()); 681 } verifier(packet.get());
682 CreateAndAddAppended(packet->MutableBuffer(), &length, packet->BufferLength(), 682 CreateAndAddAppended(packet->MutableBuffer(), &length, packet->BufferLength(),
683 &verifier); 683 &verifier);
684 OnBufferFull(packet->MutableBuffer(), &length, &verifier); 684 OnBufferFull(packet->MutableBuffer(), &length, &verifier);
685 return packet; 685 return packet;
686 } 686 }
687 687
688 bool RtcpPacket::Build(PacketReadyCallback* callback) const {
689 uint8_t buffer[IP_PACKET_SIZE];
690 return BuildExternalBuffer(buffer, IP_PACKET_SIZE, callback);
691 }
692
693 bool RtcpPacket::BuildExternalBuffer(uint8_t* buffer, 688 bool RtcpPacket::BuildExternalBuffer(uint8_t* buffer,
694 size_t max_length, 689 size_t max_length,
695 PacketReadyCallback* callback) const { 690 PacketReadyCallback* callback) const {
696 size_t index = 0; 691 size_t index = 0;
697 if (!CreateAndAddAppended(buffer, &index, max_length, callback)) 692 if (!CreateAndAddAppended(buffer, &index, max_length, callback))
698 return false; 693 return false;
699 return OnBufferFull(buffer, &index, callback); 694 return OnBufferFull(buffer, &index, callback);
700 } 695 }
701 696
702 bool RtcpPacket::CreateAndAddAppended(uint8_t* packet, 697 bool RtcpPacket::CreateAndAddAppended(uint8_t* packet,
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 return length_; 1215 return length_;
1221 } 1216 }
1222 1217
1223 void RawPacket::SetLength(size_t length) { 1218 void RawPacket::SetLength(size_t length) {
1224 assert(length <= buffer_length_); 1219 assert(length <= buffer_length_);
1225 length_ = length; 1220 length_ = length;
1226 } 1221 }
1227 1222
1228 } // namespace rtcp 1223 } // namespace rtcp
1229 } // namespace webrtc 1224 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698