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

Side by Side Diff: media/audio/audio_input_controller.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/android/audio_manager_android.cc ('k') | media/audio/audio_input_unittest.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 #include "media/audio/audio_input_controller.h" 5 #include "media/audio/audio_input_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 10
(...skipping 25 matching lines...) Expand all
36 DCHECK(kClosed == state_ || kCreated == state_ || kEmpty == state_); 36 DCHECK(kClosed == state_ || kCreated == state_ || kEmpty == state_);
37 } 37 }
38 38
39 // static 39 // static
40 scoped_refptr<AudioInputController> AudioInputController::Create( 40 scoped_refptr<AudioInputController> AudioInputController::Create(
41 AudioManager* audio_manager, 41 AudioManager* audio_manager,
42 EventHandler* event_handler, 42 EventHandler* event_handler,
43 const AudioParameters& params) { 43 const AudioParameters& params) {
44 DCHECK(audio_manager); 44 DCHECK(audio_manager);
45 45
46 if (!params.IsValid() || (params.channels > kMaxInputChannels)) 46 if (!params.IsValid() || (params.channels() > kMaxInputChannels))
47 return NULL; 47 return NULL;
48 48
49 if (factory_) 49 if (factory_)
50 return factory_->Create(audio_manager, event_handler, params); 50 return factory_->Create(audio_manager, event_handler, params);
51 51
52 scoped_refptr<AudioInputController> controller(new AudioInputController( 52 scoped_refptr<AudioInputController> controller(new AudioInputController(
53 event_handler, NULL)); 53 event_handler, NULL));
54 54
55 controller->message_loop_ = audio_manager->GetMessageLoop(); 55 controller->message_loop_ = audio_manager->GetMessageLoop();
56 56
(...skipping 12 matching lines...) Expand all
69 // static 69 // static
70 scoped_refptr<AudioInputController> AudioInputController::CreateLowLatency( 70 scoped_refptr<AudioInputController> AudioInputController::CreateLowLatency(
71 AudioManager* audio_manager, 71 AudioManager* audio_manager,
72 EventHandler* event_handler, 72 EventHandler* event_handler,
73 const AudioParameters& params, 73 const AudioParameters& params,
74 const std::string& device_id, 74 const std::string& device_id,
75 SyncWriter* sync_writer) { 75 SyncWriter* sync_writer) {
76 DCHECK(audio_manager); 76 DCHECK(audio_manager);
77 DCHECK(sync_writer); 77 DCHECK(sync_writer);
78 78
79 if (!params.IsValid() || (params.channels > kMaxInputChannels)) 79 if (!params.IsValid() || (params.channels() > kMaxInputChannels))
80 return NULL; 80 return NULL;
81 81
82 // Create the AudioInputController object and ensure that it runs on 82 // Create the AudioInputController object and ensure that it runs on
83 // the audio-manager thread. 83 // the audio-manager thread.
84 scoped_refptr<AudioInputController> controller(new AudioInputController( 84 scoped_refptr<AudioInputController> controller(new AudioInputController(
85 event_handler, sync_writer)); 85 event_handler, sync_writer));
86 controller->message_loop_ = audio_manager->GetMessageLoop(); 86 controller->message_loop_ = audio_manager->GetMessageLoop();
87 87
88 // Create and open a new audio input stream from the existing 88 // Create and open a new audio input stream from the existing
89 // audio-device thread. Use the provided audio-input device. 89 // audio-device thread. Use the provided audio-input device.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 stream_->Close(); 229 stream_->Close();
230 stream_ = NULL; 230 stream_ = NULL;
231 } 231 }
232 232
233 // Should be last in the method, do not touch "this" from here on. 233 // Should be last in the method, do not touch "this" from here on.
234 if (done != NULL) 234 if (done != NULL)
235 done->Signal(); 235 done->Signal();
236 } 236 }
237 237
238 } // namespace media 238 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/android/audio_manager_android.cc ('k') | media/audio/audio_input_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698