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

Unified Diff: media/audio/linux/alsa_wrapper.h

Issue 160497: Reimplement the AlsaPcmOutputStream and fix the threading issues. (Closed)
Patch Set: Address Andrew's comments. Diff aginst Patch 8 please. Created 11 years, 4 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 | « media/audio/linux/alsa_output_unittest.cc ('k') | media/audio/linux/alsa_wrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/linux/alsa_wrapper.h
diff --git a/media/audio/linux/alsa_wrapper.h b/media/audio/linux/alsa_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3dafbb97acc015b0aca0b441d5f58935f826def
--- /dev/null
+++ b/media/audio/linux/alsa_wrapper.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2009 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.
+//
+// AlsaWrapper is a simple stateless class that wraps the alsa library commands
+// we want to use. It's purpose is to allow injection of a mock so that the
+// higher level code is testable.
+
+#include <alsa/asoundlib.h>
+
+#include "base/basictypes.h"
+
+class AlsaWrapper {
+ public:
+ AlsaWrapper();
+ virtual ~AlsaWrapper();
+
+ virtual int PcmOpen(snd_pcm_t** handle, const char* name,
+ snd_pcm_stream_t stream, int mode);
+ virtual int PcmClose(snd_pcm_t* handle);
+ virtual int PcmPrepare(snd_pcm_t* handle);
+ virtual int PcmDrop(snd_pcm_t* handle);
+ virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle,
+ const void* buffer,
+ snd_pcm_uframes_t size);
+ virtual int PcmRecover(snd_pcm_t* handle, int err, int silent);
+ virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format,
+ snd_pcm_access_t access, unsigned int channels,
+ unsigned int rate, int soft_resample,
+ unsigned int latency);
+ virtual const char* PcmName(snd_pcm_t* handle);
+ virtual snd_pcm_sframes_t PcmAvailUpdate(snd_pcm_t* handle);
+
+ virtual const char* StrError(int errnum);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AlsaWrapper);
+};
« no previous file with comments | « media/audio/linux/alsa_output_unittest.cc ('k') | media/audio/linux/alsa_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698