OLD | NEW |
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 Loading... |
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 |
OLD | NEW |