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

Side by Side Diff: media/audio/audio_streams_tracker.h

Issue 2578983003: Add AudioStreamRegistry. Move stream counting logic (Closed)
Patch Set: Remove active audio tracking from ARH to see what tests break. 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
« no previous file with comments | « content/test/BUILD.gn ('k') | media/audio/audio_streams_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_
6 #define MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_ 6 #define MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 // Tracks the maximum number of simultaneous streams that was ever registered. 17 // Tracks the maximum number of simultaneous streams that was ever registered.
18 // All functions must be called on the same thread. 18 // All functions must be called on the same thread.
19 class MEDIA_EXPORT AudioStreamsTracker { 19 class MEDIA_EXPORT AudioStreamsTracker {
20 public: 20 public:
21 AudioStreamsTracker(); 21 AudioStreamsTracker();
22 ~AudioStreamsTracker(); 22 ~AudioStreamsTracker();
23 23
24 // Increases/decreases current stream count. Updates max stream count if 24 // Increases/decreases current stream count. Updates max stream count if
25 // current count is larger. 25 // current count is larger.
26 void IncreaseStreamCount(); 26 void IncreaseStreamCount();
27 void DecreaseStreamCount(size_t count = 1); 27 void DecreaseStreamCount();
28 28
29 // Resets the max stream count, i.e. sets it to the current stream count. 29 // Resets the max stream count, i.e. sets it to the current stream count.
30 void ResetMaxStreamCount(); 30 void ResetMaxStreamCount();
31 31
32 size_t max_stream_count() const; 32 size_t max_stream_count() const;
33 33
34 private: 34 private:
35 FRIEND_TEST_ALL_PREFIXES(AudioStreamsTrackerTest, IncreaseAndDecreaseOnce); 35 FRIEND_TEST_ALL_PREFIXES(AudioStreamsTrackerTest, IncreaseAndDecreaseOnce);
36 FRIEND_TEST_ALL_PREFIXES(AudioStreamsTrackerTest, 36 FRIEND_TEST_ALL_PREFIXES(AudioStreamsTrackerTest,
37 IncreaseAndDecreaseMultiple); 37 IncreaseAndDecreaseMultiple);
38 38
39 // Confirms single-threaded access. 39 // Confirms single-threaded access.
40 base::ThreadChecker thread_checker_; 40 base::ThreadChecker thread_checker_;
41 41
42 // Stores the current and maximum number of streams. 42 // Stores the current and maximum number of streams.
43 size_t current_stream_count_; 43 size_t current_stream_count_;
44 size_t max_stream_count_; 44 size_t max_stream_count_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(AudioStreamsTracker); 46 DISALLOW_COPY_AND_ASSIGN(AudioStreamsTracker);
47 }; 47 };
48 48
49 } // namespace media 49 } // namespace media
50 50
51 #endif // MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_ 51 #endif // MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_
OLDNEW
« no previous file with comments | « content/test/BUILD.gn ('k') | media/audio/audio_streams_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698