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

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

Issue 1369263002: Unify Transport and newapi::Transport interfaces. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: self-review 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) 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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 delaySinceLastReceivedSR = now-receiveTime; 1110 delaySinceLastReceivedSR = now-receiveTime;
1111 } 1111 }
1112 report_block->delaySinceLastSR = delaySinceLastReceivedSR; 1112 report_block->delaySinceLastSR = delaySinceLastReceivedSR;
1113 report_block->lastSR = feedback_state.remote_sr; 1113 report_block->lastSR = feedback_state.remote_sr;
1114 return true; 1114 return true;
1115 } 1115 }
1116 1116
1117 int32_t RTCPSender::SendToNetwork(const uint8_t* dataBuffer, size_t length) { 1117 int32_t RTCPSender::SendToNetwork(const uint8_t* dataBuffer, size_t length) {
1118 CriticalSectionScoped lock(critical_section_transport_.get()); 1118 CriticalSectionScoped lock(critical_section_transport_.get());
1119 if (cbTransport_) { 1119 if (cbTransport_) {
1120 if (cbTransport_->SendRTCPPacket(dataBuffer, length) > 0) 1120 if (cbTransport_->SendRtcp(dataBuffer, length))
1121 return 0; 1121 return 0;
1122 } 1122 }
1123 return -1; 1123 return -1;
1124 } 1124 }
1125 1125
1126 void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) { 1126 void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
1127 assert(csrcs.size() <= kRtpCsrcSize); 1127 assert(csrcs.size() <= kRtpCsrcSize);
1128 CriticalSectionScoped lock(critical_section_rtcp_sender_.get()); 1128 CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
1129 csrcs_ = csrcs; 1129 csrcs_ = csrcs;
1130 } 1130 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 CriticalSectionScoped lock(critical_section_transport_.get()); 1213 CriticalSectionScoped lock(critical_section_transport_.get());
1214 if (!cbTransport_) 1214 if (!cbTransport_)
1215 return false; 1215 return false;
1216 1216
1217 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { 1217 class Sender : public rtcp::RtcpPacket::PacketReadyCallback {
1218 public: 1218 public:
1219 Sender(Transport* transport) 1219 Sender(Transport* transport)
1220 : transport_(transport), send_failure_(false) {} 1220 : transport_(transport), send_failure_(false) {}
1221 1221
1222 void OnPacketReady(uint8_t* data, size_t length) override { 1222 void OnPacketReady(uint8_t* data, size_t length) override {
1223 if (transport_->SendRTCPPacket(data, length) <= 0) 1223 if (!transport_->SendRtcp(data, length))
1224 send_failure_ = true; 1224 send_failure_ = true;
1225 } 1225 }
1226 1226
1227 Transport* const transport_; 1227 Transport* const transport_;
1228 bool send_failure_; 1228 bool send_failure_;
1229 } sender(cbTransport_); 1229 } sender(cbTransport_);
1230 1230
1231 uint8_t buffer[IP_PACKET_SIZE]; 1231 uint8_t buffer[IP_PACKET_SIZE];
1232 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && 1232 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
1233 !sender.send_failure_; 1233 !sender.send_failure_;
1234 } 1234 }
1235 1235
1236 } // namespace webrtc 1236 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698