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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 // Decode in-memory audio file data. | 26 // Decode in-memory audio file data. |
27 bool DecodeAudioFileData( | 27 bool DecodeAudioFileData( |
28 blink::WebAudioBus* destination_bus, | 28 blink::WebAudioBus* destination_bus, |
29 const char* data, size_t data_size) { | 29 const char* data, size_t data_size) { |
30 DCHECK(destination_bus); | 30 DCHECK(destination_bus); |
31 if (!destination_bus) | 31 if (!destination_bus) |
32 return false; | 32 return false; |
33 | 33 |
34 #if !defined(MEDIA_DISABLE_FFMPEG) | |
34 // Uses the FFmpeg library for audio file reading. | 35 // Uses the FFmpeg library for audio file reading. |
35 InMemoryUrlProtocol url_protocol(reinterpret_cast<const uint8*>(data), | 36 InMemoryUrlProtocol url_protocol(reinterpret_cast<const uint8*>(data), |
36 data_size, false); | 37 data_size, false); |
37 AudioFileReader reader(&url_protocol); | 38 AudioFileReader reader(&url_protocol); |
38 | 39 |
39 if (!reader.Open()) | 40 if (!reader.Open()) |
40 return false; | 41 return false; |
41 | 42 |
42 size_t number_of_channels = reader.channels(); | 43 size_t number_of_channels = reader.channels(); |
43 double file_sample_rate = reader.sample_rate(); | 44 double file_sample_rate = reader.sample_rate(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 | 83 |
83 DVLOG(1) << "Decoded file data -" | 84 DVLOG(1) << "Decoded file data -" |
84 << " data: " << data | 85 << " data: " << data |
85 << " data size: " << data_size | 86 << " data size: " << data_size |
86 << " duration: " << duration | 87 << " duration: " << duration |
87 << " number of frames: " << actual_frames | 88 << " number of frames: " << actual_frames |
88 << " sample rate: " << file_sample_rate | 89 << " sample rate: " << file_sample_rate |
89 << " number of channels: " << number_of_channels; | 90 << " number of channels: " << number_of_channels; |
90 | 91 |
91 return actual_frames > 0; | 92 return actual_frames > 0; |
93 #else | |
94 return false; | |
95 #endif | |
xhwang
2015/11/02 18:11:51
#endif // !defined(MEDIA_DISABLE_FFMPEG)
Julien Isorce Samsung
2015/11/03 16:02:27
Acknowledged.
| |
92 } | 96 } |
93 | 97 |
94 } // namespace content | 98 } // namespace content |
OLD | NEW |