| 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/audio_decoder.h" | 5 #include "content/renderer/media/audio_decoder.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // Decode in-memory audio file data. | 27 // Decode in-memory audio file data. |
| 28 bool DecodeAudioFileData( | 28 bool DecodeAudioFileData( |
| 29 blink::WebAudioBus* destination_bus, | 29 blink::WebAudioBus* destination_bus, |
| 30 const char* data, size_t data_size) { | 30 const char* data, size_t data_size) { |
| 31 DCHECK(destination_bus); | 31 DCHECK(destination_bus); |
| 32 if (!destination_bus) | 32 if (!destination_bus) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 #if defined(MEDIA_DISABLE_FFMPEG) | 35 #if defined(MEDIA_DISABLE_FFMPEG) |
| 36 return false | 36 return false; |
| 37 #else | 37 #else |
| 38 // Uses the FFmpeg library for audio file reading. | 38 // Uses the FFmpeg library for audio file reading. |
| 39 InMemoryUrlProtocol url_protocol(reinterpret_cast<const uint8_t*>(data), | 39 InMemoryUrlProtocol url_protocol(reinterpret_cast<const uint8_t*>(data), |
| 40 data_size, false); | 40 data_size, false); |
| 41 AudioFileReader reader(&url_protocol); | 41 AudioFileReader reader(&url_protocol); |
| 42 | 42 |
| 43 if (!reader.Open()) | 43 if (!reader.Open()) |
| 44 return false; | 44 return false; |
| 45 | 45 |
| 46 size_t number_of_channels = reader.channels(); | 46 size_t number_of_channels = reader.channels(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 << ", estimated frames (if available): " | 85 << ", estimated frames (if available): " |
| 86 << (reader.HasKnownDuration() ? reader.GetNumberOfFrames() : 0) | 86 << (reader.HasKnownDuration() ? reader.GetNumberOfFrames() : 0) |
| 87 << ", sample rate: " << file_sample_rate | 87 << ", sample rate: " << file_sample_rate |
| 88 << ", number of channels: " << number_of_channels; | 88 << ", number of channels: " << number_of_channels; |
| 89 | 89 |
| 90 return number_of_frames > 0; | 90 return number_of_frames > 0; |
| 91 #endif // defined(MEDIA_DISABLE_FFMPEG) | 91 #endif // defined(MEDIA_DISABLE_FFMPEG) |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace content | 94 } // namespace content |
| OLD | NEW |