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

Unified Diff: media/base/audio_bus.h

Issue 388563005: Add a ref counted audio bus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/audio_bus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_bus.h
diff --git a/media/base/audio_bus.h b/media/base/audio_bus.h
index c5b161f0236082728db2bd97b25ba9de7a9e1c60..c78486e5e00aa5f00ce567275f0025681778ec21 100644
--- a/media/base/audio_bus.h
+++ b/media/base/audio_bus.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/memory/aligned_memory.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "media/base/media_export.h"
@@ -110,12 +111,13 @@ class MEDIA_EXPORT AudioBus {
virtual ~AudioBus();
- private:
+ protected:
AudioBus(int channels, int frames);
AudioBus(int channels, int frames, float* data);
AudioBus(int frames, const std::vector<float*>& channel_data);
explicit AudioBus(int channels);
+ private:
// Helper method for building |channel_data_| from a block of memory. |data|
// must be at least BlockSize() bytes in size.
void BuildChannelData(int channels, int aligned_frame, float* data);
@@ -132,6 +134,24 @@ class MEDIA_EXPORT AudioBus {
DISALLOW_COPY_AND_ASSIGN(AudioBus);
};
+// RefCounted version of AudioBus. This is not meant for general use. Only use
+// this when your lifetime requirements make it impossible to use an
+// AudioBus scoped_ptr.
+class MEDIA_EXPORT AudioBusRefCounted
+ : public media::AudioBus,
+ public base::RefCountedThreadSafe<AudioBusRefCounted> {
+ public:
+ static scoped_refptr<AudioBusRefCounted> Create(int channels, int frames);
+
+ private:
+ friend class base::RefCountedThreadSafe<AudioBusRefCounted>;
+
+ AudioBusRefCounted(int channels, int frames);
+ virtual ~AudioBusRefCounted();
+
+ DISALLOW_COPY_AND_ASSIGN(AudioBusRefCounted);
+};
+
} // namespace media
#endif // MEDIA_BASE_AUDIO_BUS_H_
« no previous file with comments | « no previous file | media/base/audio_bus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698