OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/media/capture/web_contents_audio_muter.h" | 5 #include "content/browser/media/capture/web_contents_audio_muter.h" |
6 | 6 |
| 7 #include <memory> |
| 8 #include <set> |
| 9 |
7 #include "base/bind.h" | 10 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/time/time.h" |
10 #include "content/browser/media/capture/audio_mirroring_manager.h" | 14 #include "content/browser/media/capture/audio_mirroring_manager.h" |
11 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
13 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
14 #include "media/audio/audio_io.h" | 18 #include "media/audio/audio_io.h" |
15 #include "media/audio/audio_manager.h" | 19 #include "media/audio/audio_manager.h" |
16 #include "media/audio/fake_audio_worker.h" | 20 #include "media/audio/fake_audio_worker.h" |
17 #include "media/base/bind_to_current_loop.h" | 21 #include "media/base/bind_to_current_loop.h" |
18 | 22 |
19 namespace content { | 23 namespace content { |
(...skipping 23 matching lines...) Expand all Loading... |
43 } | 47 } |
44 void Stop() override { worker_.Stop(); } | 48 void Stop() override { worker_.Stop(); } |
45 void SetVolume(double volume) override {} | 49 void SetVolume(double volume) override {} |
46 void GetVolume(double* volume) override { *volume = 0; } | 50 void GetVolume(double* volume) override { *volume = 0; } |
47 void Close() override { delete this; } | 51 void Close() override { delete this; } |
48 | 52 |
49 private: | 53 private: |
50 ~AudioDiscarder() override {} | 54 ~AudioDiscarder() override {} |
51 | 55 |
52 void FetchAudioData(AudioSourceCallback* callback) { | 56 void FetchAudioData(AudioSourceCallback* callback) { |
53 callback->OnMoreData(audio_bus_.get(), 0, 0); | 57 callback->OnMoreData(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 58 audio_bus_.get()); |
54 } | 59 } |
55 | 60 |
56 // Calls FetchAudioData() at regular intervals and discards the data. | 61 // Calls FetchAudioData() at regular intervals and discards the data. |
57 media::FakeAudioWorker worker_; | 62 media::FakeAudioWorker worker_; |
58 std::unique_ptr<media::AudioBus> audio_bus_; | 63 std::unique_ptr<media::AudioBus> audio_bus_; |
59 | 64 |
60 DISALLOW_COPY_AND_ASSIGN(AudioDiscarder); | 65 DISALLOW_COPY_AND_ASSIGN(AudioDiscarder); |
61 }; | 66 }; |
62 | 67 |
63 } // namespace | 68 } // namespace |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return; | 156 return; |
152 is_muting_ = false; | 157 is_muting_ = false; |
153 BrowserThread::PostTask( | 158 BrowserThread::PostTask( |
154 BrowserThread::IO, FROM_HERE, | 159 BrowserThread::IO, FROM_HERE, |
155 base::Bind(&AudioMirroringManager::StopMirroring, | 160 base::Bind(&AudioMirroringManager::StopMirroring, |
156 base::Unretained(AudioMirroringManager::GetInstance()), | 161 base::Unretained(AudioMirroringManager::GetInstance()), |
157 base::RetainedRef(destination_))); | 162 base::RetainedRef(destination_))); |
158 } | 163 } |
159 | 164 |
160 } // namespace content | 165 } // namespace content |
OLD | NEW |