OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <memory> |
| 10 #include <set> |
| 11 |
| 12 #include "base/atomic_ref_count.h" |
| 13 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" |
| 15 #include "base/threading/thread_checker.h" |
| 16 #include "content/browser/renderer_host/media/audio_stream_registry.h" |
| 17 #include "content/common/content_export.h" |
| 18 #include "content/public/browser/browser_thread.h" |
| 19 |
| 20 namespace content { |
| 21 |
| 22 class CONTENT_EXPORT AudioStreamRegistryImpl : public AudioStreamRegistry { |
| 23 public: |
| 24 explicit AudioStreamRegistryImpl(int render_process_id); |
| 25 ~AudioStreamRegistryImpl() override; |
| 26 |
| 27 using UniquePtr = |
| 28 std::unique_ptr<AudioStreamRegistryImpl, BrowserThread::DeleteOnIOThread>; |
| 29 |
| 30 static UniquePtr Create(int render_process_id); |
| 31 |
| 32 // Indicates whether there is an output stream currently playing. |
| 33 // May be called from any thread. |
| 34 bool HasActiveAudio(); |
| 35 |
| 36 void RegisterStream() override; |
| 37 void DeregisterStream() override; |
| 38 void StreamStateChanged(bool playing) override; |
| 39 |
| 40 private: |
| 41 int32_t num_output_streams_ = 0; |
| 42 int32_t max_simultaneous_output_streams_ = 0; |
| 43 base::AtomicRefCount num_playing_output_streams_ = 0; |
| 44 const int render_process_id_; |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_ |
OLD | NEW |