diff options
author | rtoy@google.com <rtoy@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 01:58:12 +0000 |
---|---|---|
committer | rtoy@google.com <rtoy@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-03 01:58:12 +0000 |
commit | 8e08b1423631dd2bb761adecf6e67ca41e70c5c0 (patch) | |
tree | a477654e60460eb0968c93dd435c11b392c05084 /webkit/media | |
parent | ac8a8299a1123f7d2c9b9cd54b8f88fd26d946cb (diff) | |
download | chromium_src-8e08b1423631dd2bb761adecf6e67ca41e70c5c0.zip chromium_src-8e08b1423631dd2bb761adecf6e67ca41e70c5c0.tar.gz chromium_src-8e08b1423631dd2bb761adecf6e67ca41e70c5c0.tar.bz2 |
Handle decoding of vorbis files better on Android
BUG=227144
Send the data size to MediaCodec so we can get the duration length for ogg/vorbis files correctly instead of returning a huge number. With this information, we no longer need the is_vorbis flag since the duration is now correct, so we remove that code as well.
Review URL: https://chromiumcodereview.appspot.com/14522002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/media')
-rw-r--r-- | webkit/media/android/audio_decoder_android.cc | 18 | ||||
-rw-r--r-- | webkit/media/audio_decoder.h | 4 |
2 files changed, 12 insertions, 10 deletions
diff --git a/webkit/media/android/audio_decoder_android.cc b/webkit/media/android/audio_decoder_android.cc index 6cc52c9..017837c 100644 --- a/webkit/media/android/audio_decoder_android.cc +++ b/webkit/media/android/audio_decoder_android.cc @@ -16,6 +16,7 @@ #include "base/logging.h" #include "base/posix/eintr_wrapper.h" #include "base/shared_memory.h" +#include "media/base/android/webaudio_media_codec_info.h" #include "media/base/audio_bus.h" #include "media/base/limits.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebAudioBus.h" @@ -118,7 +119,7 @@ bool DecodeAudioFileData(WebKit::WebAudioBus* destination_bus, const char* data, // encoded_data_handle for our shared memory and write the decoded // PCM samples (16-bit integer) to our pipe. - runner.Run(encoded_data_handle, fd); + runner.Run(encoded_data_handle, fd, data_size); // First, read the number of channels, the sample rate, and the // number of frames and a flag indicating if the file is an @@ -131,21 +132,20 @@ bool DecodeAudioFileData(WebKit::WebAudioBus* destination_bus, const char* data, // the bus. int input_fd = audio_decoder.read_fd(); - unsigned long info[4]; + struct media::WebAudioMediaCodecInfo info; DVLOG(1) << "Reading audio file info from fd " << input_fd; - ssize_t nread = HANDLE_EINTR(read(input_fd, info, sizeof(info))); + ssize_t nread = HANDLE_EINTR(read(input_fd, &info, sizeof(info))); DVLOG(1) << "read: " << nread << " bytes:\n" - << " 0: number of channels = " << info[0] << "\n" - << " 1: sample rate = " << info[1] << "\n" - << " 2: number of frames = " << info[2] << "\n" - << " 3: is vorbis = " << info[3]; + << " 0: number of channels = " << info.channel_count << "\n" + << " 1: sample rate = " << info.sample_rate << "\n" + << " 2: number of frames = " << info.number_of_frames << "\n"; if (nread != sizeof(info)) return false; - unsigned number_of_channels = info[0]; - double file_sample_rate = static_cast<double>(info[1]); + unsigned number_of_channels = info.channel_count; + double file_sample_rate = static_cast<double>(info.sample_rate); // Sanity checks if (!number_of_channels || diff --git a/webkit/media/audio_decoder.h b/webkit/media/audio_decoder.h index fec049d..6ec6886 100644 --- a/webkit/media/audio_decoder.h +++ b/webkit/media/audio_decoder.h @@ -24,7 +24,9 @@ bool DecodeAudioFileData(WebKit::WebAudioBus* destination_bus, const char* data, size_t data_size, double sample_rate); #else -typedef base::Callback<void (base::SharedMemoryHandle, base::FileDescriptor)> +typedef base::Callback<void (base::SharedMemoryHandle, + base::FileDescriptor, + size_t)> WebAudioMediaCodecRunner; bool DecodeAudioFileData(WebKit::WebAudioBus* destination_bus, const char* data, |