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

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: Thread checking. Created 4 years 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 <unordered_set>
9
10 #include "base/atomic_ref_count.h"
11 #include "base/macros.h"
12 #include "base/threading/thread_checker.h"
13 #include "content/browser/renderer_host/media/audio_stream_registry.h"
14 #include "content/common/content_export.h"
15
16 namespace content {
17
18 class CONTENT_EXPORT AudioStreamRegistryImpl : public AudioStreamRegistry {
19 public:
20 explicit AudioStreamRegistryImpl(int render_process_id);
21 ~AudioStreamRegistryImpl() override;
22
23 // Indicates whether there is an output stream currently playing.
24 // May be called from any thread.
25 bool HasActiveAudio();
26
27 // TODO(maxmorin): Enable/disable debug recording for all tracked streams.
28 /*void EnableDebugRecording();
29 void DisableDebugRecording();*/
30
31 // Streams must be removed before this object is destructed.
32 // void RegisterInputStream(Stream* stream) override;
33 void RegisterOutputStream(Stream* stream) override;
34 // void DeregisterInputStream(Stream* stream) override;
35 void DeregisterOutputStream(Stream* stream) override;
36
37 void OutputStreamStateChanged(bool playing) override;
38
39 private:
40 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.
41
42 const int render_process_id_;
43 size_t max_simultaneous_output_streams_ = 0;
44 base::AtomicRefCount num_playing_output_streams_ = 0;
45 // StreamSet input_streams_;
46 StreamSet output_streams_;
47
48 DISALLOW_COPY_AND_ASSIGN(AudioStreamRegistryImpl);
49 };
50
51 } // namespace content
52
53 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_STREAM_REGISTRY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698