Chromium Code Reviews| Index: content/browser/renderer_host/media/audio_stream_registry_impl.h |
| diff --git a/content/browser/renderer_host/media/audio_stream_registry_impl.h b/content/browser/renderer_host/media/audio_stream_registry_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7f93062051bf64de05ed4df90c138b7d892d8bc |
| --- /dev/null |
| +++ b/content/browser/renderer_host/media/audio_stream_registry_impl.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_ |
| +#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_ |
| + |
| +#include <unordered_set> |
| + |
| +#include "base/atomic_ref_count.h" |
| +#include "base/macros.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "content/browser/renderer_host/media/audio_stream_registry.h" |
| +#include "content/common/content_export.h" |
| + |
| +namespace content { |
| + |
| +class CONTENT_EXPORT AudioStreamRegistryImpl : public AudioStreamRegistry { |
| + public: |
| + explicit AudioStreamRegistryImpl(int render_process_id); |
| + ~AudioStreamRegistryImpl() override; |
| + |
| + // Indicates whether there is an output stream currently playing. |
| + // May be called from any thread. |
| + bool HasActiveAudio(); |
| + |
| + // TODO(maxmorin): Enable/disable debug recording for all tracked streams. |
| + /*void EnableDebugRecording(); |
| + void DisableDebugRecording();*/ |
| + |
| + // Streams must be removed before this object is destructed. |
| + // void RegisterInputStream(Stream* stream) override; |
| + void RegisterOutputStream(Stream* stream) override; |
| + // void DeregisterInputStream(Stream* stream) override; |
| + void DeregisterOutputStream(Stream* stream) override; |
| + |
| + void OutputStreamStateChanged(bool playing) override; |
| + |
| + private: |
| + using StreamSet = std::unordered_set<Stream*>; |
|
o1ka
2016/12/16 09:48:16
Have you considered using <set>? We hardly ever ha
Max Morin
2016/12/19 16:29:03
Done.
|
| + |
| + const int render_process_id_; |
| + size_t max_simultaneous_output_streams_ = 0; |
| + base::AtomicRefCount num_playing_output_streams_ = 0; |
| + // StreamSet input_streams_; |
| + StreamSet output_streams_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AudioStreamRegistryImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_ |