Chromium Code Reviews| Index: media/base/android/webaudio_media_codec_bridge.cc |
| diff --git a/media/base/android/webaudio_media_codec_bridge.cc b/media/base/android/webaudio_media_codec_bridge.cc |
| index 963d3b2cecc365e8d47aabc8829827e42aa0f905..617db8dc1ee3ccfcd2ad6041eaef7512cbc50bf3 100644 |
| --- a/media/base/android/webaudio_media_codec_bridge.cc |
| +++ b/media/base/android/webaudio_media_codec_bridge.cc |
| @@ -23,17 +23,20 @@ namespace media { |
| void WebAudioMediaCodecBridge::RunWebAudioMediaCodec( |
| base::SharedMemoryHandle encoded_audio_handle, |
| - base::FileDescriptor pcm_output) { |
| - WebAudioMediaCodecBridge bridge(encoded_audio_handle, pcm_output); |
| + base::FileDescriptor pcm_output, |
| + size_t data_size) { |
| + WebAudioMediaCodecBridge bridge(encoded_audio_handle, pcm_output, data_size); |
| bridge.DecodeInMemoryAudioFile(); |
| } |
| WebAudioMediaCodecBridge::WebAudioMediaCodecBridge( |
| base::SharedMemoryHandle encoded_audio_handle, |
| - base::FileDescriptor pcm_output) |
| + base::FileDescriptor pcm_output, |
| + size_t data_size) |
| : encoded_audio_handle_(encoded_audio_handle.fd), |
| - pcm_output_(pcm_output.fd) { |
| + pcm_output_(pcm_output.fd), |
| + data_size_(data_size) { |
| DVLOG(1) << "WebAudioMediaCodecBridge start **********************" |
| << "input fd = " << encoded_audio_handle_ |
| << " output fd = " << pcm_output.fd; |
| @@ -60,7 +63,8 @@ bool WebAudioMediaCodecBridge::DecodeInMemoryAudioFile() { |
| env, |
| base::android::GetApplicationContext(), |
| reinterpret_cast<intptr_t>(this), |
| - encoded_audio_handle_); |
| + encoded_audio_handle_, |
| + data_size_); |
| DVLOG(1) << "decoded = " << decoded; |
| return decoded; |
| @@ -71,27 +75,24 @@ void WebAudioMediaCodecBridge::InitializeDestination( |
| jobject /*java object*/, |
| jint channel_count, |
| jint sample_rate, |
| - jlong duration_microsec, |
| - jboolean is_vorbis) { |
| + jlong duration_microsec) { |
| // Send information about this audio file: number of channels, |
| // sample rate (Hz), number of frames, a flag indicating whether |
| // this file is an audio/vorbis file. Information is sent as a set of |
| // 4 longs. This must be coordinated with DecodeAudioFileData! |
| - unsigned long info[4] = {static_cast<unsigned long>(channel_count), |
| + unsigned long info[3] = {static_cast<unsigned long>(channel_count), |
|
DaleCurtis
2013/04/30 17:44:17
Can you just drop the 3 and let it auto size? All
Raymond Toy (Google)
2013/04/30 17:57:49
The static casts were added by benm@ to fix a WebV
|
| static_cast<unsigned long>(sample_rate), |
| // The number of frames is the duration of the file |
| // (in microseconds) times the sample rate. |
| static_cast<unsigned long>( |
| 0.5 + (duration_microsec * 0.000001 * |
| - sample_rate)), |
| - is_vorbis ? 1ul : 0ul}; |
| + sample_rate))}; |
| DVLOG(1) << "InitializeDestination:" |
| << " channel count = " << channel_count |
| << " rate = " << sample_rate |
| - << " duration = " << duration_microsec << " microsec" |
| - << " vorbis = " << (is_vorbis ? "yes" : "no"); |
| + << " duration = " << duration_microsec << " microsec"; |
| HANDLE_EINTR(write(pcm_output_, info, sizeof(info))); |
| } |