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

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

Issue 2670183005: Change order of tear down/create of default audio stream, to avoid starting/stopping audio card pla… (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 (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 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 } 2492 }
2493 2493
2494 // Create a default receive stream for this unsignalled and previously not 2494 // Create a default receive stream for this unsignalled and previously not
2495 // received ssrc. If there already is a default receive stream, delete it. 2495 // received ssrc. If there already is a default receive stream, delete it.
2496 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5208 2496 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5208
2497 uint32_t ssrc = 0; 2497 uint32_t ssrc = 0;
2498 if (!GetRtpSsrc(packet->cdata(), packet->size(), &ssrc)) { 2498 if (!GetRtpSsrc(packet->cdata(), packet->size(), &ssrc)) {
2499 return; 2499 return;
2500 } 2500 }
2501 2501
2502 if (default_recv_ssrc_ != -1) {
2503 LOG(LS_INFO) << "Removing default receive stream with ssrc "
2504 << default_recv_ssrc_;
2505 RTC_DCHECK_NE(ssrc, default_recv_ssrc_);
2506 RemoveRecvStream(default_recv_ssrc_);
2507 default_recv_ssrc_ = -1;
2508 }
2509
2510 StreamParams sp; 2502 StreamParams sp;
2511 sp.ssrcs.push_back(ssrc); 2503 sp.ssrcs.push_back(ssrc);
2512 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << "."; 2504 LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << ".";
2513 if (!AddRecvStream(sp)) { 2505 if (!AddRecvStream(sp)) {
2514 LOG(LS_WARNING) << "Could not create default receive stream."; 2506 LOG(LS_WARNING) << "Could not create default receive stream.";
2515 return; 2507 return;
2516 } 2508 }
2509 if (default_recv_ssrc_ != -1) {
2510 LOG(LS_INFO) << "Removing default receive stream with ssrc "
2511 << default_recv_ssrc_;
2512 RTC_DCHECK_NE(ssrc, default_recv_ssrc_);
2513 RemoveRecvStream(default_recv_ssrc_);
2514 }
2517 default_recv_ssrc_ = ssrc; 2515 default_recv_ssrc_ = ssrc;
2516
2518 SetOutputVolume(default_recv_ssrc_, default_recv_volume_); 2517 SetOutputVolume(default_recv_ssrc_, default_recv_volume_);
2519 if (default_sink_) { 2518 if (default_sink_) {
2520 std::unique_ptr<webrtc::AudioSinkInterface> proxy_sink( 2519 std::unique_ptr<webrtc::AudioSinkInterface> proxy_sink(
2521 new ProxySink(default_sink_.get())); 2520 new ProxySink(default_sink_.get()));
2522 SetRawAudioSink(default_recv_ssrc_, std::move(proxy_sink)); 2521 SetRawAudioSink(default_recv_ssrc_, std::move(proxy_sink));
2523 } 2522 }
2524 delivery_result = call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO, 2523 delivery_result = call_->Receiver()->DeliverPacket(webrtc::MediaType::AUDIO,
2525 packet->cdata(), 2524 packet->cdata(),
2526 packet->size(), 2525 packet->size(),
2527 webrtc_packet_time); 2526 webrtc_packet_time);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2719 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2721 const auto it = send_streams_.find(ssrc); 2720 const auto it = send_streams_.find(ssrc);
2722 if (it != send_streams_.end()) { 2721 if (it != send_streams_.end()) {
2723 return it->second->channel(); 2722 return it->second->channel();
2724 } 2723 }
2725 return -1; 2724 return -1;
2726 } 2725 }
2727 } // namespace cricket 2726 } // namespace cricket
2728 2727
2729 #endif // HAVE_WEBRTC_VOICE 2728 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698