| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/base/filter_host.h" | 5 #include "media/base/filter_host.h" |
| 6 #include "media/filters/audio_renderer_base.h" | 6 #include "media/filters/audio_renderer_base.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 // The maximum size of the queue, which also acts as the number of initial reads | 10 // The maximum size of the queue, which also acts as the number of initial reads |
| 11 // to perform for buffering. The size of the queue should never exceed this | 11 // to perform for buffering. The size of the queue should never exceed this |
| 12 // number since we read only after we've dequeued and released a buffer in | 12 // number since we read only after we've dequeued and released a buffer in |
| 13 // callback thread. | 13 // callback thread. |
| 14 // | 14 // |
| 15 // This is sort of a magic number, but for 44.1kHz stereo audio this will give | 15 // This is sort of a magic number, but for 44.1kHz stereo audio this will give |
| 16 // us enough data to fill approximately 4 complete callback buffers. | 16 // us enough data to fill approximately 4 complete callback buffers. |
| 17 const size_t AudioRendererBase::kDefaultMaxQueueSize = 16; | 17 const size_t AudioRendererBase::kDefaultMaxQueueSize = 16; |
| 18 | 18 |
| 19 AudioRendererBase::AudioRendererBase(size_t max_queue_size) | 19 AudioRendererBase::AudioRendererBase(size_t max_queue_size) |
| 20 : decoder_(NULL), | 20 : max_queue_size_(max_queue_size), |
| 21 max_queue_size_(max_queue_size), | |
| 22 data_offset_(0), | 21 data_offset_(0), |
| 23 initialized_(false), | 22 initialized_(false), |
| 24 stopped_(false) { | 23 stopped_(false) { |
| 25 } | 24 } |
| 26 | 25 |
| 27 AudioRendererBase::~AudioRendererBase() { | 26 AudioRendererBase::~AudioRendererBase() { |
| 28 // Stop() should have been called and OnReadComplete() should have stopped | 27 // Stop() should have been called and OnReadComplete() should have stopped |
| 29 // enqueuing data. | 28 // enqueuing data. |
| 30 DCHECK(stopped_); | 29 DCHECK(stopped_); |
| 31 DCHECK(queue_.empty()); | 30 DCHECK(queue_.empty()); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // TODO(scherkus): might be handy to support NULL parameters. | 228 // TODO(scherkus): might be handy to support NULL parameters. |
| 230 std::string mime_type; | 229 std::string mime_type; |
| 231 return media_format.GetAsString(MediaFormat::kMimeType, &mime_type) && | 230 return media_format.GetAsString(MediaFormat::kMimeType, &mime_type) && |
| 232 media_format.GetAsInteger(MediaFormat::kChannels, channels_out) && | 231 media_format.GetAsInteger(MediaFormat::kChannels, channels_out) && |
| 233 media_format.GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) && | 232 media_format.GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) && |
| 234 media_format.GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) && | 233 media_format.GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) && |
| 235 mime_type.compare(mime_type::kUncompressedAudio) == 0; | 234 mime_type.compare(mime_type::kUncompressedAudio) == 0; |
| 236 } | 235 } |
| 237 | 236 |
| 238 } // namespace media | 237 } // namespace media |
| OLD | NEW |