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

Side by Side Diff: services/media/audio/platform/linux/alsa_output_tinyalsa.cc

Issue 1902183002: Motown: Change media type (stream type) representation (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changes per review feedback. Created 4 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #include <tinyalsa/asoundlib.h> 5 #include <tinyalsa/asoundlib.h>
6 6
7 #include "services/media/audio/platform/linux/alsa_output.h" 7 #include "services/media/audio/platform/linux/alsa_output.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 namespace media { 10 namespace media {
(...skipping 28 matching lines...) Expand all
39 void AlsaOutput::AlsaClose() { 39 void AlsaOutput::AlsaClose() {
40 pcm* alsa_device = static_cast<pcm*>(alsa_device_); 40 pcm* alsa_device = static_cast<pcm*>(alsa_device_);
41 41
42 if (alsa_device) { 42 if (alsa_device) {
43 pcm_close(alsa_device); 43 pcm_close(alsa_device);
44 alsa_device_ = nullptr; 44 alsa_device_ = nullptr;
45 } 45 }
46 } 46 }
47 47
48 MediaResult AlsaOutput::AlsaSelectFormat( 48 MediaResult AlsaOutput::AlsaSelectFormat(
49 const LpcmMediaTypeDetailsPtr& config) { 49 const AudioMediaTypeDetailsPtr& config) {
50 switch (config->sample_format) { 50 switch (config->sample_format) {
51 case LpcmSampleFormat::SIGNED_16: 51 case AudioSampleFormat::SIGNED_16:
52 alsa_format_ = PCM_FORMAT_S16_LE; 52 alsa_format_ = PCM_FORMAT_S16_LE;
53 break; 53 break;
54 54
55 // tinyalsa does not support unsigned LPCM formats 55 // tinyalsa does not support unsigned LPCM formats
56 case LpcmSampleFormat::UNSIGNED_8: 56 case AudioSampleFormat::UNSIGNED_8:
57 case LpcmSampleFormat::SIGNED_24_IN_32: 57 case AudioSampleFormat::SIGNED_24_IN_32:
58 default: 58 default:
59 return MediaResult::UNSUPPORTED_CONFIG; 59 return MediaResult::UNSUPPORTED_CONFIG;
60 } 60 }
61 61
62 return MediaResult::OK; 62 return MediaResult::OK;
63 } 63 }
64 64
65 int AlsaOutput::AlsaWrite(const void* data, uint32_t frames) { 65 int AlsaOutput::AlsaWrite(const void* data, uint32_t frames) {
66 DCHECK(alsa_device_); 66 DCHECK(alsa_device_);
67 DCHECK(output_formatter_); 67 DCHECK(output_formatter_);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return 0; 121 return 0;
122 } 122 }
123 123
124 return err_code; 124 return err_code;
125 } 125 }
126 126
127 127
128 } // namespace audio 128 } // namespace audio
129 } // namespace media 129 } // namespace media
130 } // namespace mojo 130 } // namespace mojo
OLDNEW
« no previous file with comments | « services/media/audio/platform/linux/alsa_output_desktop.cc ('k') | services/media/factory_service/media_demux_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698