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

Side by Side Diff: webrtc/api/webrtcsession.cc

Issue 1785713005: Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback from tommi. Created 4 years, 9 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
« no previous file with comments | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 return false; 1302 return false;
1303 } 1303 }
1304 return true; 1304 return true;
1305 } 1305 }
1306 1306
1307 sigslot::signal0<>* WebRtcSession::GetOnDestroyedSignal() { 1307 sigslot::signal0<>* WebRtcSession::GetOnDestroyedSignal() {
1308 return &SignalDestroyed; 1308 return &SignalDestroyed;
1309 } 1309 }
1310 1310
1311 bool WebRtcSession::SendData(const cricket::SendDataParams& params, 1311 bool WebRtcSession::SendData(const cricket::SendDataParams& params,
1312 const rtc::Buffer& payload, 1312 const rtc::CopyOnWriteBuffer& payload,
1313 cricket::SendDataResult* result) { 1313 cricket::SendDataResult* result) {
1314 if (!data_channel_) { 1314 if (!data_channel_) {
1315 LOG(LS_ERROR) << "SendData called when data_channel_ is NULL."; 1315 LOG(LS_ERROR) << "SendData called when data_channel_ is NULL.";
1316 return false; 1316 return false;
1317 } 1317 }
1318 return data_channel_->SendData(params, payload, result); 1318 return data_channel_->SendData(params, payload, result);
1319 } 1319 }
1320 1320
1321 bool WebRtcSession::ConnectDataChannel(DataChannel* webrtc_data_channel) { 1321 bool WebRtcSession::ConnectDataChannel(DataChannel* webrtc_data_channel) {
1322 if (!data_channel_) { 1322 if (!data_channel_) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 } 1764 }
1765 1765
1766 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { 1766 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) {
1767 SetError(ERROR_TRANSPORT, 1767 SetError(ERROR_TRANSPORT,
1768 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); 1768 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp);
1769 } 1769 }
1770 1770
1771 void WebRtcSession::OnDataChannelMessageReceived( 1771 void WebRtcSession::OnDataChannelMessageReceived(
1772 cricket::DataChannel* channel, 1772 cricket::DataChannel* channel,
1773 const cricket::ReceiveDataParams& params, 1773 const cricket::ReceiveDataParams& params,
1774 const rtc::Buffer& payload) { 1774 const rtc::CopyOnWriteBuffer& payload) {
1775 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); 1775 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
1776 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { 1776 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) {
1777 // Received OPEN message; parse and signal that a new data channel should 1777 // Received OPEN message; parse and signal that a new data channel should
1778 // be created. 1778 // be created.
1779 std::string label; 1779 std::string label;
1780 InternalDataChannelInit config; 1780 InternalDataChannelInit config;
1781 config.id = params.ssrc; 1781 config.id = params.ssrc;
1782 if (!ParseDataChannelOpenMessage(payload, &label, &config)) { 1782 if (!ParseDataChannelOpenMessage(payload, &label, &config)) {
1783 LOG(LS_WARNING) << "Failed to parse the OPEN message for sid " 1783 LOG(LS_WARNING) << "Failed to parse the OPEN message for sid "
1784 << params.ssrc; 1784 << params.ssrc;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 } 2077 }
2078 } 2078 }
2079 2079
2080 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, 2080 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel,
2081 const rtc::SentPacket& sent_packet) { 2081 const rtc::SentPacket& sent_packet) {
2082 RTC_DCHECK(worker_thread()->IsCurrent()); 2082 RTC_DCHECK(worker_thread()->IsCurrent());
2083 media_controller_->call_w()->OnSentPacket(sent_packet); 2083 media_controller_->call_w()->OnSentPacket(sent_packet);
2084 } 2084 }
2085 2085
2086 } // namespace webrtc 2086 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698