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

Side by Side Diff: media/audio/mac/audio_input_mac.cc

Issue 9655018: Make AudioParameters a class instead of a struct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright years Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/linux/audio_manager_linux.cc ('k') | media/audio/mac/audio_low_latency_input_mac.h » ('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 #include "media/audio/mac/audio_input_mac.h" 5 #include "media/audio/mac/audio_input_mac.h"
6 6
7 #include <CoreServices/CoreServices.h> 7 #include <CoreServices/CoreServices.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 : manager_(manager), 23 : manager_(manager),
24 callback_(NULL), 24 callback_(NULL),
25 audio_queue_(NULL), 25 audio_queue_(NULL),
26 buffer_size_bytes_(0), 26 buffer_size_bytes_(0),
27 started_(false) { 27 started_(false) {
28 // We must have a manager. 28 // We must have a manager.
29 DCHECK(manager_); 29 DCHECK(manager_);
30 // A frame is one sample across all channels. In interleaved audio the per 30 // A frame is one sample across all channels. In interleaved audio the per
31 // frame fields identify the set of n |channels|. In uncompressed audio, a 31 // frame fields identify the set of n |channels|. In uncompressed audio, a
32 // packet is always one frame. 32 // packet is always one frame.
33 format_.mSampleRate = params.sample_rate; 33 format_.mSampleRate = params.sample_rate();
34 format_.mFormatID = kAudioFormatLinearPCM; 34 format_.mFormatID = kAudioFormatLinearPCM;
35 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked | 35 format_.mFormatFlags = kLinearPCMFormatFlagIsPacked |
36 kLinearPCMFormatFlagIsSignedInteger; 36 kLinearPCMFormatFlagIsSignedInteger;
37 format_.mBitsPerChannel = params.bits_per_sample; 37 format_.mBitsPerChannel = params.bits_per_sample();
38 format_.mChannelsPerFrame = params.channels; 38 format_.mChannelsPerFrame = params.channels();
39 format_.mFramesPerPacket = 1; 39 format_.mFramesPerPacket = 1;
40 format_.mBytesPerPacket = (params.bits_per_sample * params.channels) / 8; 40 format_.mBytesPerPacket = (params.bits_per_sample() * params.channels()) / 8;
41 format_.mBytesPerFrame = format_.mBytesPerPacket; 41 format_.mBytesPerFrame = format_.mBytesPerPacket;
42 format_.mReserved = 0; 42 format_.mReserved = 0;
43 43
44 buffer_size_bytes_ = params.GetPacketSize(); 44 buffer_size_bytes_ = params.GetBytesPerBuffer();
45 } 45 }
46 46
47 PCMQueueInAudioInputStream::~PCMQueueInAudioInputStream() { 47 PCMQueueInAudioInputStream::~PCMQueueInAudioInputStream() {
48 DCHECK(!callback_); 48 DCHECK(!callback_);
49 DCHECK(!audio_queue_); 49 DCHECK(!audio_queue_);
50 } 50 }
51 51
52 bool PCMQueueInAudioInputStream::Open() { 52 bool PCMQueueInAudioInputStream::Open() {
53 OSStatus err = AudioQueueNewInput(&format_, 53 OSStatus err = AudioQueueNewInput(&format_,
54 &HandleInputBufferStatic, 54 &HandleInputBufferStatic,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // TODO(joth): PCMQueueOutAudioOutputStream uses callback_ to provide an 200 // TODO(joth): PCMQueueOutAudioOutputStream uses callback_ to provide an
201 // extra guard for this situation, but it seems to introduce more 201 // extra guard for this situation, but it seems to introduce more
202 // complications than it solves (memory barrier issues accessing it from 202 // complications than it solves (memory barrier issues accessing it from
203 // multiple threads, looses the means to indicate OnClosed to client). 203 // multiple threads, looses the means to indicate OnClosed to client).
204 // Should determine if we need to do something equivalent here. 204 // Should determine if we need to do something equivalent here.
205 return; 205 return;
206 } 206 }
207 HandleError(err); 207 HandleError(err);
208 } 208 }
209 } 209 }
OLDNEW
« no previous file with comments | « media/audio/linux/audio_manager_linux.cc ('k') | media/audio/mac/audio_low_latency_input_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698