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

Side by Side Diff: media/audio/linux/alsa_wrapper.h

Issue 10413075: alsa_output: Drain and pause pcm when stopping. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: whitespace only. Created 8 years, 7 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 | « media/audio/linux/alsa_output_unittest.cc ('k') | media/audio/linux/alsa_wrapper.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // AlsaWrapper is a simple stateless class that wraps the alsa library commands 5 // AlsaWrapper is a simple stateless class that wraps the alsa library commands
6 // we want to use. It's purpose is to allow injection of a mock so that the 6 // we want to use. It's purpose is to allow injection of a mock so that the
7 // higher level code is testable. 7 // higher level code is testable.
8 8
9 #include <alsa/asoundlib.h> 9 #include <alsa/asoundlib.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 class MEDIA_EXPORT AlsaWrapper { 16 class MEDIA_EXPORT AlsaWrapper {
17 public: 17 public:
18 AlsaWrapper(); 18 AlsaWrapper();
19 virtual ~AlsaWrapper(); 19 virtual ~AlsaWrapper();
20 20
21 virtual int DeviceNameHint(int card, const char* iface, void*** hints); 21 virtual int DeviceNameHint(int card, const char* iface, void*** hints);
22 virtual char* DeviceNameGetHint(const void* hint, const char* id); 22 virtual char* DeviceNameGetHint(const void* hint, const char* id);
23 virtual int DeviceNameFreeHint(void** hints); 23 virtual int DeviceNameFreeHint(void** hints);
24 virtual int CardNext(int* rcard); 24 virtual int CardNext(int* rcard);
25 25
26 virtual int PcmOpen(snd_pcm_t** handle, const char* name, 26 virtual int PcmOpen(snd_pcm_t** handle, const char* name,
27 snd_pcm_stream_t stream, int mode); 27 snd_pcm_stream_t stream, int mode);
28 virtual int PcmClose(snd_pcm_t* handle); 28 virtual int PcmClose(snd_pcm_t* handle);
29 virtual int PcmPrepare(snd_pcm_t* handle); 29 virtual int PcmPrepare(snd_pcm_t* handle);
30 virtual int PcmDrain(snd_pcm_t* handle);
30 virtual int PcmDrop(snd_pcm_t* handle); 31 virtual int PcmDrop(snd_pcm_t* handle);
31 virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay); 32 virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay);
32 virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle, 33 virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle,
33 const void* buffer, 34 const void* buffer,
34 snd_pcm_uframes_t size); 35 snd_pcm_uframes_t size);
35 virtual snd_pcm_sframes_t PcmReadi(snd_pcm_t* handle, 36 virtual snd_pcm_sframes_t PcmReadi(snd_pcm_t* handle,
36 void* buffer, 37 void* buffer,
37 snd_pcm_uframes_t size); 38 snd_pcm_uframes_t size);
38 virtual int PcmRecover(snd_pcm_t* handle, int err, int silent); 39 virtual int PcmRecover(snd_pcm_t* handle, int err, int silent);
39 virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format, 40 virtual int PcmSetParams(snd_pcm_t* handle, snd_pcm_format_t format,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 private: 74 private:
74 int ConfigureHwParams(snd_pcm_t* handle, snd_pcm_hw_params_t* hw_params, 75 int ConfigureHwParams(snd_pcm_t* handle, snd_pcm_hw_params_t* hw_params,
75 snd_pcm_format_t format, snd_pcm_access_t access, 76 snd_pcm_format_t format, snd_pcm_access_t access,
76 unsigned int channels, unsigned int rate, 77 unsigned int channels, unsigned int rate,
77 int soft_resample, unsigned int latency); 78 int soft_resample, unsigned int latency);
78 DISALLOW_COPY_AND_ASSIGN(AlsaWrapper); 79 DISALLOW_COPY_AND_ASSIGN(AlsaWrapper);
79 }; 80 };
80 81
81 } // namespace media 82 } // namespace media
OLDNEW
« 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