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 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 AutoLock auto_lock(lock_); | 87 AutoLock auto_lock(lock_); |
88 // Loop until the buffer has been filled. | 88 // Loop until the buffer has been filled. |
89 while (len > 0) { | 89 while (len > 0) { |
90 if (queue_.empty()) { | 90 if (queue_.empty()) { |
91 // TODO(scherkus): consider blocking here until more data arrives. | 91 // TODO(scherkus): consider blocking here until more data arrives. |
92 break; | 92 break; |
93 } | 93 } |
94 Buffer* buffer = queue_.front(); | 94 Buffer* buffer = queue_.front(); |
95 | 95 |
96 // Determine how much to copy. | 96 // Determine how much to copy. |
97 const char* data = buffer->GetData() + data_offset_; | 97 const uint8* data = buffer->GetData() + data_offset_; |
98 size_t data_len = buffer->GetDataSize() - data_offset_; | 98 size_t data_len = buffer->GetDataSize() - data_offset_; |
99 data_len = std::min(len, data_len); | 99 data_len = std::min(len, data_len); |
100 | 100 |
101 // Copy into buffer. | 101 // Copy into buffer. |
102 memcpy(dest, data, data_len); | 102 memcpy(dest, data, data_len); |
103 len -= data_len; | 103 len -= data_len; |
104 dest += data_len; | 104 dest += data_len; |
105 data_offset_ += data_len; | 105 data_offset_ += data_len; |
106 result += data_len; | 106 result += data_len; |
107 | 107 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // TODO(scherkus): might be handy to support NULL parameters. | 145 // TODO(scherkus): might be handy to support NULL parameters. |
146 std::string mime_type; | 146 std::string mime_type; |
147 return media_format->GetAsString(MediaFormat::kMimeType, &mime_type) && | 147 return media_format->GetAsString(MediaFormat::kMimeType, &mime_type) && |
148 media_format->GetAsInteger(MediaFormat::kChannels, channels_out) && | 148 media_format->GetAsInteger(MediaFormat::kChannels, channels_out) && |
149 media_format->GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) && | 149 media_format->GetAsInteger(MediaFormat::kSampleRate, sample_rate_out) && |
150 media_format->GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) && | 150 media_format->GetAsInteger(MediaFormat::kSampleBits, sample_bits_out) && |
151 mime_type.compare(mime_type::kUncompressedAudio) == 0; | 151 mime_type.compare(mime_type::kUncompressedAudio) == 0; |
152 } | 152 } |
153 | 153 |
154 } // namespace media | 154 } // namespace media |
OLD | NEW |