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

Side by Side Diff: content/renderer/media/webrtc_audio_device_impl.cc

Issue 8659040: There is a racing between SyncSocket::Receive in audio_thread_ and SyncSocket::Close in renderer ... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: update Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webrtc_audio_device_impl.h" 5 #include "content/renderer/media/webrtc_audio_device_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "content/renderer/media/audio_hardware.h" 10 #include "content/renderer/media/audio_hardware.h"
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 return 0; 590 return 0;
591 } 591 }
592 592
593 int32_t WebRtcAudioDeviceImpl::StopPlayout() { 593 int32_t WebRtcAudioDeviceImpl::StopPlayout() {
594 DVLOG(1) << "StopPlayout()"; 594 DVLOG(1) << "StopPlayout()";
595 DCHECK(audio_output_device_); 595 DCHECK(audio_output_device_);
596 if (!playing_) { 596 if (!playing_) {
597 // webrtc::VoiceEngine assumes that it is OK to call Stop() just in case. 597 // webrtc::VoiceEngine assumes that it is OK to call Stop() just in case.
598 return 0; 598 return 0;
599 } 599 }
600 playing_ = !audio_output_device_->Stop(); 600 audio_output_device_->Stop();
601 return (!playing_ ? 0 : -1); 601 playing_ = false;
602 return 0;
602 } 603 }
603 604
604 bool WebRtcAudioDeviceImpl::Playing() const { 605 bool WebRtcAudioDeviceImpl::Playing() const {
605 return playing_; 606 return playing_;
606 } 607 }
607 608
608 int32_t WebRtcAudioDeviceImpl::StartRecording() { 609 int32_t WebRtcAudioDeviceImpl::StartRecording() {
609 DVLOG(1) << "StartRecording()"; 610 DVLOG(1) << "StartRecording()";
610 #if defined(OS_MACOSX) 611 #if defined(OS_MACOSX)
611 DLOG(WARNING) << "Real-time recording is not yet fully supported on Mac OS X"; 612 DLOG(WARNING) << "Real-time recording is not yet fully supported on Mac OS X";
(...skipping 27 matching lines...) Expand all
639 640
640 int32_t WebRtcAudioDeviceImpl::StopRecording() { 641 int32_t WebRtcAudioDeviceImpl::StopRecording() {
641 DVLOG(1) << "StopRecording()"; 642 DVLOG(1) << "StopRecording()";
642 DCHECK(audio_input_device_); 643 DCHECK(audio_input_device_);
643 644
644 base::AutoLock auto_lock(lock_); 645 base::AutoLock auto_lock(lock_);
645 if (!recording_) { 646 if (!recording_) {
646 // webrtc::VoiceEngine assumes that it is OK to call Stop() just in case. 647 // webrtc::VoiceEngine assumes that it is OK to call Stop() just in case.
647 return 0; 648 return 0;
648 } 649 }
649 recording_ = !audio_input_device_->Stop(); 650 audio_input_device_->Stop();
650 return (!recording_ ? 0 : -1); 651 recording_ = false;
652 return 0;
651 } 653 }
652 654
653 bool WebRtcAudioDeviceImpl::Recording() const { 655 bool WebRtcAudioDeviceImpl::Recording() const {
654 return recording_; 656 return recording_;
655 } 657 }
656 658
657 int32_t WebRtcAudioDeviceImpl::SetAGC(bool enable) { 659 int32_t WebRtcAudioDeviceImpl::SetAGC(bool enable) {
658 DVLOG(2) << "WARNING: WebRtcAudioDeviceImpl::SetAGC() " << "NOT IMPLEMENTED"; 660 DVLOG(2) << "WARNING: WebRtcAudioDeviceImpl::SetAGC() " << "NOT IMPLEMENTED";
659 return -1; 661 return -1;
660 } 662 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } 966 }
965 967
966 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { 968 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const {
967 NOTIMPLEMENTED(); 969 NOTIMPLEMENTED();
968 return -1; 970 return -1;
969 } 971 }
970 972
971 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { 973 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) {
972 session_id_ = session_id; 974 session_id_ = session_id;
973 } 975 }
OLDNEW
« no previous file with comments | « content/renderer/media/audio_input_device.cc ('k') | content/renderer/renderer_webaudiodevice_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698