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

Side by Side Diff: media/audio/virtual_audio_output_stream.cc

Issue 1897953003: Unmute Tab Audio For Desktop Share (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 6 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/audio/virtual_audio_output_stream.h" 5 #include "media/audio/virtual_audio_output_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/audio/virtual_audio_input_stream.h" 10 #include "media/audio/virtual_audio_input_stream.h"
(...skipping 19 matching lines...) Expand all
30 30
31 bool VirtualAudioOutputStream::Open() { 31 bool VirtualAudioOutputStream::Open() {
32 DCHECK(thread_checker_.CalledOnValidThread()); 32 DCHECK(thread_checker_.CalledOnValidThread());
33 return true; 33 return true;
34 } 34 }
35 35
36 void VirtualAudioOutputStream::Start(AudioSourceCallback* callback) { 36 void VirtualAudioOutputStream::Start(AudioSourceCallback* callback) {
37 DCHECK(thread_checker_.CalledOnValidThread()); 37 DCHECK(thread_checker_.CalledOnValidThread());
38 DCHECK(!callback_); 38 DCHECK(!callback_);
39 callback_ = callback; 39 callback_ = callback;
40 target_input_stream_->AddOutputStream(this, params_); 40 target_input_stream_->AddInputProvider(this, params_);
41 } 41 }
42 42
43 void VirtualAudioOutputStream::Stop() { 43 void VirtualAudioOutputStream::Stop() {
44 DCHECK(thread_checker_.CalledOnValidThread()); 44 DCHECK(thread_checker_.CalledOnValidThread());
45 if (callback_) { 45 if (callback_) {
46 target_input_stream_->RemoveOutputStream(this, params_); 46 target_input_stream_->RemoveInputProvider(this, params_);
47 callback_ = NULL; 47 callback_ = NULL;
48 } 48 }
49 } 49 }
50 50
51 void VirtualAudioOutputStream::Close() { 51 void VirtualAudioOutputStream::Close() {
52 DCHECK(thread_checker_.CalledOnValidThread()); 52 DCHECK(thread_checker_.CalledOnValidThread());
53 53
54 Stop(); 54 Stop();
55 55
56 // If a non-null AfterCloseCallback was provided to the constructor, invoke it 56 // If a non-null AfterCloseCallback was provided to the constructor, invoke it
(...skipping 26 matching lines...) Expand all
83 params_.GetBytesPerFrame() * frames_delayed; 83 params_.GetBytesPerFrame() * frames_delayed;
84 const int frames = 84 const int frames =
85 callback_->OnMoreData(audio_bus, upstream_delay_in_bytes, 0); 85 callback_->OnMoreData(audio_bus, upstream_delay_in_bytes, 0);
86 if (frames < audio_bus->frames()) 86 if (frames < audio_bus->frames())
87 audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames); 87 audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames);
88 88
89 return frames > 0 ? volume_ : 0; 89 return frames > 0 ? volume_ : 0;
90 } 90 }
91 91
92 } // namespace media 92 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/virtual_audio_input_stream.cc ('k') | media/audio/virtual_audio_output_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698