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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 1728503002: Replace scoped_ptr with unique_ptr in webrtc/media/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up1
Patch Set: Created 4 years, 10 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1329 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1330 RTC_DCHECK(stream_); 1330 RTC_DCHECK(stream_);
1331 return stream_->GetStats(); 1331 return stream_->GetStats();
1332 } 1332 }
1333 1333
1334 int channel() const { 1334 int channel() const {
1335 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1335 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1336 return config_.voe_channel_id; 1336 return config_.voe_channel_id;
1337 } 1337 }
1338 1338
1339 void SetRawAudioSink(rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { 1339 void SetRawAudioSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) {
1340 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1340 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1341 stream_->SetSink(rtc::ScopedToUnique(std::move(sink))); 1341 stream_->SetSink(std::move(sink));
1342 } 1342 }
1343 1343
1344 private: 1344 private:
1345 void RecreateAudioReceiveStream( 1345 void RecreateAudioReceiveStream(
1346 bool use_transport_cc, 1346 bool use_transport_cc,
1347 const std::vector<webrtc::RtpExtension>& extensions) { 1347 const std::vector<webrtc::RtpExtension>& extensions) {
1348 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1348 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1349 if (stream_) { 1349 if (stream_) {
1350 call_->DestroyAudioReceiveStream(stream_); 1350 call_->DestroyAudioReceiveStream(stream_);
1351 stream_ = nullptr; 1351 stream_ = nullptr;
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 StreamParams sp; 2255 StreamParams sp;
2256 sp.ssrcs.push_back(ssrc); 2256 sp.ssrcs.push_back(ssrc);
2257 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; 2257 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << ".";
2258 if (!AddRecvStream(sp)) { 2258 if (!AddRecvStream(sp)) {
2259 LOG(LS_WARNING) << "Could not create default receive stream."; 2259 LOG(LS_WARNING) << "Could not create default receive stream.";
2260 return; 2260 return;
2261 } 2261 }
2262 default_recv_ssrc_ = ssrc; 2262 default_recv_ssrc_ = ssrc;
2263 SetOutputVolume(default_recv_ssrc_, default_recv_volume_); 2263 SetOutputVolume(default_recv_ssrc_, default_recv_volume_);
2264 if (default_sink_) { 2264 if (default_sink_) {
2265 rtc::scoped_ptr<webrtc::AudioSinkInterface> proxy_sink( 2265 std::unique_ptr<webrtc::AudioSinkInterface> proxy_sink(
2266 new ProxySink(default_sink_.get())); 2266 new ProxySink(default_sink_.get()));
2267 SetRawAudioSink(default_recv_ssrc_, std::move(proxy_sink)); 2267 SetRawAudioSink(default_recv_ssrc_, std::move(proxy_sink));
2268 } 2268 }
2269 } 2269 }
2270 2270
2271 // Forward packet to Call. If the SSRC is unknown we'll return after this. 2271 // Forward packet to Call. If the SSRC is unknown we'll return after this.
2272 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, 2272 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp,
2273 packet_time.not_before); 2273 packet_time.not_before);
2274 webrtc::PacketReceiver::DeliveryStatus delivery_result = 2274 webrtc::PacketReceiver::DeliveryStatus delivery_result =
2275 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, 2275 call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 rinfo.decoding_plc_cng = stats.decoding_plc_cng; 2485 rinfo.decoding_plc_cng = stats.decoding_plc_cng;
2486 rinfo.capture_start_ntp_time_ms = stats.capture_start_ntp_time_ms; 2486 rinfo.capture_start_ntp_time_ms = stats.capture_start_ntp_time_ms;
2487 info->receivers.push_back(rinfo); 2487 info->receivers.push_back(rinfo);
2488 } 2488 }
2489 2489
2490 return true; 2490 return true;
2491 } 2491 }
2492 2492
2493 void WebRtcVoiceMediaChannel::SetRawAudioSink( 2493 void WebRtcVoiceMediaChannel::SetRawAudioSink(
2494 uint32_t ssrc, 2494 uint32_t ssrc,
2495 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { 2495 std::unique_ptr<webrtc::AudioSinkInterface> sink) {
2496 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2496 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2497 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::SetRawAudioSink: ssrc:" << ssrc 2497 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::SetRawAudioSink: ssrc:" << ssrc
2498 << " " << (sink ? "(ptr)" : "NULL"); 2498 << " " << (sink ? "(ptr)" : "NULL");
2499 if (ssrc == 0) { 2499 if (ssrc == 0) {
2500 if (default_recv_ssrc_ != -1) { 2500 if (default_recv_ssrc_ != -1) {
2501 rtc::scoped_ptr<webrtc::AudioSinkInterface> proxy_sink( 2501 std::unique_ptr<webrtc::AudioSinkInterface> proxy_sink(
2502 sink ? new ProxySink(sink.get()) : nullptr); 2502 sink ? new ProxySink(sink.get()) : nullptr);
2503 SetRawAudioSink(default_recv_ssrc_, std::move(proxy_sink)); 2503 SetRawAudioSink(default_recv_ssrc_, std::move(proxy_sink));
2504 } 2504 }
2505 default_sink_ = std::move(sink); 2505 default_sink_ = std::move(sink);
2506 return; 2506 return;
2507 } 2507 }
2508 const auto it = recv_streams_.find(ssrc); 2508 const auto it = recv_streams_.find(ssrc);
2509 if (it == recv_streams_.end()) { 2509 if (it == recv_streams_.end()) {
2510 LOG(LS_WARNING) << "SetRawAudioSink: no recv stream" << ssrc; 2510 LOG(LS_WARNING) << "SetRawAudioSink: no recv stream" << ssrc;
2511 return; 2511 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 } 2546 }
2547 } else { 2547 } else {
2548 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2548 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2549 engine()->voe()->base()->StopPlayout(channel); 2549 engine()->voe()->base()->StopPlayout(channel);
2550 } 2550 }
2551 return true; 2551 return true;
2552 } 2552 }
2553 } // namespace cricket 2553 } // namespace cricket
2554 2554
2555 #endif // HAVE_WEBRTC_VOICE 2555 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698