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

Side by Side Diff: content/browser/renderer_host/media/audio_stream_registry_impl.h

Issue 2578983003: Add AudioStreamRegistry. Move stream counting logic (Closed)
Patch Set: . Created 3 years, 11 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
(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);
DaleCurtis 2017/01/12 19:22:12 Typically we don't expose both a normal constructo
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 };
DaleCurtis 2017/01/12 19:22:12 DISALLOW_COPY_AND_ASSIGN
46
47 } // namespace content
48
49 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698