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

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

Issue 1823503002: Reland Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 return false; 1367 return false;
1368 } 1368 }
1369 return true; 1369 return true;
1370 } 1370 }
1371 1371
1372 sigslot::signal0<>* WebRtcSession::GetOnDestroyedSignal() { 1372 sigslot::signal0<>* WebRtcSession::GetOnDestroyedSignal() {
1373 return &SignalDestroyed; 1373 return &SignalDestroyed;
1374 } 1374 }
1375 1375
1376 bool WebRtcSession::SendData(const cricket::SendDataParams& params, 1376 bool WebRtcSession::SendData(const cricket::SendDataParams& params,
1377 const rtc::Buffer& payload, 1377 const rtc::CopyOnWriteBuffer& payload,
1378 cricket::SendDataResult* result) { 1378 cricket::SendDataResult* result) {
1379 if (!data_channel_) { 1379 if (!data_channel_) {
1380 LOG(LS_ERROR) << "SendData called when data_channel_ is NULL."; 1380 LOG(LS_ERROR) << "SendData called when data_channel_ is NULL.";
1381 return false; 1381 return false;
1382 } 1382 }
1383 return data_channel_->SendData(params, payload, result); 1383 return data_channel_->SendData(params, payload, result);
1384 } 1384 }
1385 1385
1386 bool WebRtcSession::ConnectDataChannel(DataChannel* webrtc_data_channel) { 1386 bool WebRtcSession::ConnectDataChannel(DataChannel* webrtc_data_channel) {
1387 if (!data_channel_) { 1387 if (!data_channel_) {
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 } 1847 }
1848 1848
1849 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { 1849 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) {
1850 SetError(ERROR_TRANSPORT, 1850 SetError(ERROR_TRANSPORT,
1851 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); 1851 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp);
1852 } 1852 }
1853 1853
1854 void WebRtcSession::OnDataChannelMessageReceived( 1854 void WebRtcSession::OnDataChannelMessageReceived(
1855 cricket::DataChannel* channel, 1855 cricket::DataChannel* channel,
1856 const cricket::ReceiveDataParams& params, 1856 const cricket::ReceiveDataParams& params,
1857 const rtc::Buffer& payload) { 1857 const rtc::CopyOnWriteBuffer& payload) {
1858 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); 1858 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
1859 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) { 1859 if (params.type == cricket::DMT_CONTROL && IsOpenMessage(payload)) {
1860 // Received OPEN message; parse and signal that a new data channel should 1860 // Received OPEN message; parse and signal that a new data channel should
1861 // be created. 1861 // be created.
1862 std::string label; 1862 std::string label;
1863 InternalDataChannelInit config; 1863 InternalDataChannelInit config;
1864 config.id = params.ssrc; 1864 config.id = params.ssrc;
1865 if (!ParseDataChannelOpenMessage(payload, &label, &config)) { 1865 if (!ParseDataChannelOpenMessage(payload, &label, &config)) {
1866 LOG(LS_WARNING) << "Failed to parse the OPEN message for sid " 1866 LOG(LS_WARNING) << "Failed to parse the OPEN message for sid "
1867 << params.ssrc; 1867 << params.ssrc;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 } 2160 }
2161 } 2161 }
2162 2162
2163 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, 2163 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel,
2164 const rtc::SentPacket& sent_packet) { 2164 const rtc::SentPacket& sent_packet) {
2165 RTC_DCHECK(worker_thread()->IsCurrent()); 2165 RTC_DCHECK(worker_thread()->IsCurrent());
2166 media_controller_->call_w()->OnSentPacket(sent_packet); 2166 media_controller_->call_w()->OnSentPacket(sent_packet);
2167 } 2167 }
2168 2168
2169 } // namespace webrtc 2169 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698