| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/audio_decoder_android.h" | 5 #include "content/renderer/media/android/audio_decoder_android.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <limits.h> | 9 #include <limits.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool WAVEDecoder::CopyDataChunkToBus(blink::WebAudioBus* destination_bus) { | 304 bool WAVEDecoder::CopyDataChunkToBus(blink::WebAudioBus* destination_bus) { |
| 305 // The data chunk contains the audio data itself. | 305 // The data chunk contains the audio data itself. |
| 306 if (!bytes_per_sample_ || bytes_per_sample_ > kMaximumBytesPerSample) { | 306 if (!bytes_per_sample_ || bytes_per_sample_ > kMaximumBytesPerSample) { |
| 307 DVLOG(1) << "WARNING: data chunk without preceeding fmt chunk," | 307 DVLOG(1) << "WARNING: data chunk without preceeding fmt chunk," |
| 308 << " or invalid bytes per sample."; | 308 << " or invalid bytes per sample."; |
| 309 return false; | 309 return false; |
| 310 } | 310 } |
| 311 | 311 |
| 312 VLOG(0) << "Decoding WAVE file: " << number_of_channels_ << " channels, " | 312 DVLOG(0) << "Decoding WAVE file: " << number_of_channels_ << " channels, " |
| 313 << sample_rate_ << " kHz, " | 313 << sample_rate_ << " kHz, " |
| 314 << chunk_size_ / bytes_per_sample_ / number_of_channels_ | 314 << chunk_size_ / bytes_per_sample_ / number_of_channels_ |
| 315 << " frames, " << 8 * bytes_per_sample_ << " bits/sample"; | 315 << " frames, " << 8 * bytes_per_sample_ << " bits/sample"; |
| 316 | 316 |
| 317 // Create the destination bus of the appropriate size and then decode | 317 // Create the destination bus of the appropriate size and then decode |
| 318 // the data into the bus. | 318 // the data into the bus. |
| 319 size_t number_of_frames = | 319 size_t number_of_frames = |
| 320 chunk_size_ / bytes_per_sample_ / number_of_channels_; | 320 chunk_size_ / bytes_per_sample_ / number_of_channels_; |
| 321 | 321 |
| 322 destination_bus->initialize( | 322 destination_bus->initialize( |
| 323 number_of_channels_, number_of_frames, sample_rate_); | 323 number_of_channels_, number_of_frames, sample_rate_); |
| 324 | 324 |
| 325 for (size_t m = 0; m < number_of_frames; ++m) { | 325 for (size_t m = 0; m < number_of_frames; ++m) { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 BufferAndCopyPcmDataToBus(input_fd, | 582 BufferAndCopyPcmDataToBus(input_fd, |
| 583 destination_bus, | 583 destination_bus, |
| 584 number_of_channels, | 584 number_of_channels, |
| 585 file_sample_rate); | 585 file_sample_rate); |
| 586 } | 586 } |
| 587 | 587 |
| 588 return true; | 588 return true; |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace content | 591 } // namespace content |
| OLD | NEW |