Merge "Fix issue 5373048: AudioCache decode errors"
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include <media/Metadata.h>
|
||||
#include <media/AudioTrack.h>
|
||||
#include <media/MemoryLeakTrackUtil.h>
|
||||
#include <media/stagefright/MediaErrors.h>
|
||||
|
||||
#include <system/audio.h>
|
||||
|
||||
@@ -1132,7 +1133,11 @@ sp<IMemory> MediaPlayerService::decode(const char* url, uint32_t *pSampleRate, i
|
||||
player->start();
|
||||
|
||||
LOGV("wait for playback complete");
|
||||
if (cache->wait() != NO_ERROR) goto Exit;
|
||||
cache->wait();
|
||||
// in case of error, return what was successfully decoded.
|
||||
if (cache->size() == 0) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
mem = new MemoryBase(cache->getHeap(), 0, cache->size());
|
||||
*pSampleRate = cache->sampleRate();
|
||||
@@ -1175,7 +1180,11 @@ sp<IMemory> MediaPlayerService::decode(int fd, int64_t offset, int64_t length, u
|
||||
player->start();
|
||||
|
||||
LOGV("wait for playback complete");
|
||||
if (cache->wait() != NO_ERROR) goto Exit;
|
||||
cache->wait();
|
||||
// in case of error, return what was successfully decoded.
|
||||
if (cache->size() == 0) {
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
mem = new MemoryBase(cache->getHeap(), 0, cache->size());
|
||||
*pSampleRate = cache->sampleRate();
|
||||
|
||||
Reference in New Issue
Block a user