OLD | NEW |
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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } | 348 } |
349 | 349 |
350 virtual ~StreamWrapper() {} | 350 virtual ~StreamWrapper() {} |
351 | 351 |
352 // Creates an Audio[Input|Output]Stream stream object using default | 352 // Creates an Audio[Input|Output]Stream stream object using default |
353 // parameters. | 353 // parameters. |
354 StreamType* Create() { | 354 StreamType* Create() { |
355 return CreateStream(); | 355 return CreateStream(); |
356 } | 356 } |
357 | 357 |
358 // Creates Audio[Input|Output]Stream object using non-default | |
359 // parameters where the frame size is modified. | |
360 StreamType* Create(int samples_per_packet) { | |
361 samples_per_packet_ = samples_per_packet; | |
362 return CreateStream(); | |
363 } | |
364 | |
365 AudioParameters::Format format() const { return format_; } | |
366 int channels() const { | 358 int channels() const { |
367 return ChannelLayoutToChannelCount(channel_layout_); | 359 return ChannelLayoutToChannelCount(channel_layout_); |
368 } | 360 } |
369 int bits_per_sample() const { return bits_per_sample_; } | 361 int bits_per_sample() const { return bits_per_sample_; } |
370 int sample_rate() const { return sample_rate_; } | 362 int sample_rate() const { return sample_rate_; } |
371 int samples_per_packet() const { return samples_per_packet_; } | 363 int samples_per_packet() const { return samples_per_packet_; } |
372 | 364 |
373 private: | 365 private: |
374 StreamType* CreateStream() { | 366 StreamType* CreateStream() { |
375 StreamType* stream = StreamTraits::CreateStream(audio_manager_, | 367 StreamType* stream = StreamTraits::CreateStream(audio_manager_, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 449 |
458 // All Close() operations that run on the mocked audio thread, | 450 // All Close() operations that run on the mocked audio thread, |
459 // should be synchronous and not post additional close tasks to | 451 // should be synchronous and not post additional close tasks to |
460 // mocked the audio thread. Hence, there is no need to call | 452 // mocked the audio thread. Hence, there is no need to call |
461 // message_loop()->RunAllPending() after the Close() methods. | 453 // message_loop()->RunAllPending() after the Close() methods. |
462 aos->Close(); | 454 aos->Close(); |
463 ais->Close(); | 455 ais->Close(); |
464 } | 456 } |
465 | 457 |
466 } // namespace media | 458 } // namespace media |
OLD | NEW |