Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Side by Side Diff: content/renderer/media/android/audio_decoder_android.cc

Issue 195043002: Remove unnecassary parameter "sampleRate" for loadAudioResource(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 496 }
497 497
498 // To decode audio data, we want to use the Android MediaCodec class. 498 // To decode audio data, we want to use the Android MediaCodec class.
499 // But this can't run in a sandboxed process so we need initiate the 499 // But this can't run in a sandboxed process so we need initiate the
500 // request to MediaCodec in the browser. To do this, we create a 500 // request to MediaCodec in the browser. To do this, we create a
501 // shared memory buffer that holds the audio data. We send a message 501 // shared memory buffer that holds the audio data. We send a message
502 // to the browser to start the decoder using this buffer and one end 502 // to the browser to start the decoder using this buffer and one end
503 // of a pipe. The MediaCodec class will decode the data from the 503 // of a pipe. The MediaCodec class will decode the data from the
504 // shared memory and write the PCM samples back to us over a pipe. 504 // shared memory and write the PCM samples back to us over a pipe.
505 bool DecodeAudioFileData(blink::WebAudioBus* destination_bus, const char* data, 505 bool DecodeAudioFileData(blink::WebAudioBus* destination_bus, const char* data,
506 size_t data_size, double sample_rate, 506 size_t data_size,
507 scoped_refptr<ThreadSafeSender> sender) { 507 scoped_refptr<ThreadSafeSender> sender) {
508 // Try to decode the data as a WAVE file first. If it can't be 508 // Try to decode the data as a WAVE file first. If it can't be
509 // decoded, use MediaCodec. See crbug.com/259048. 509 // decoded, use MediaCodec. See crbug.com/259048.
510 if (TryWAVEFileDecoder( 510 if (TryWAVEFileDecoder(
511 destination_bus, reinterpret_cast<const uint8_t*>(data), data_size)) { 511 destination_bus, reinterpret_cast<const uint8_t*>(data), data_size)) {
512 return true; 512 return true;
513 } 513 }
514 514
515 AudioDecoderIO audio_decoder(data, data_size); 515 AudioDecoderIO audio_decoder(data, data_size);
516 516
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 BufferAndCopyPcmDataToBus(input_fd, 574 BufferAndCopyPcmDataToBus(input_fd,
575 destination_bus, 575 destination_bus,
576 number_of_channels, 576 number_of_channels,
577 file_sample_rate); 577 file_sample_rate);
578 } 578 }
579 579
580 return true; 580 return true;
581 } 581 }
582 582
583 } // namespace content 583 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/audio_decoder_android.h ('k') | content/renderer/media/audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698