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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioBus.cpp

Issue 2085353008: Allow disabling of resampling in decodeAudioData Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/DecodeAudioDataOptions.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return AudioBus::createBySampleRateConverting(audioBus.get(), false, sampleR ate); 698 return AudioBus::createBySampleRateConverting(audioBus.get(), false, sampleR ate);
699 } 699 }
700 700
701 PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dat aSize, bool mixToMono, float sampleRate) 701 PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dat aSize, bool mixToMono, float sampleRate)
702 { 702 {
703 RefPtr<AudioBus> audioBus = decodeAudioFileData(static_cast<const char*>(dat a), dataSize); 703 RefPtr<AudioBus> audioBus = decodeAudioFileData(static_cast<const char*>(dat a), dataSize);
704 if (!audioBus.get()) 704 if (!audioBus.get())
705 return nullptr; 705 return nullptr;
706 706
707 // If the bus needs no conversion then return as is. 707 // If the bus needs no conversion then return as is.
708 if ((!mixToMono || audioBus->numberOfChannels() == 1) && audioBus->sampleRat e() == sampleRate) 708 if ((!mixToMono || audioBus->numberOfChannels() == 1)
709 && (audioBus->sampleRate() == sampleRate || sampleRate == 0))
709 return audioBus; 710 return audioBus;
710 711
711 return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono, sam pleRate); 712 return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono, sam pleRate);
712 } 713 }
713 714
714 } // namespace blink 715 } // namespace blink
715 716
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/DecodeAudioDataOptions.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698