From 1ee2a02ee471d8c5d7b3c3bd3ab720f3dcfea056 Mon Sep 17 00:00:00 2001 From: Shivaprasad Hongal Date: Thu, 30 Jul 2015 18:00:18 -0700 Subject: Stagefright: Enable custom allocation mode. Enable custom allocation mode Change-Id: Idf3f6c0eb9d17d361d2e5b6c36b1fe7586236565 --- media/libstagefright/ACodec.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'media/libstagefright/ACodec.cpp') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 97a0be0..238cd47 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -832,15 +832,11 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { : OMXCodec::kRequiresAllocateBufferOnOutputPorts; if ((portIndex == kPortIndexInput && (mFlags & kFlagIsSecure)) - || (portIndex == kPortIndexOutput && usingMetadataOnEncoderOutput())) { + || (portIndex == kPortIndexOutput && usingMetadataOnEncoderOutput()) + || canAllocateBuffer(portIndex)) { mem.clear(); - void *ptr; - err = mOMX->allocateBuffer( - mNode, portIndex, bufSize, &info.mBufferID, - &ptr); - - info.mData = new ABuffer(ptr, bufSize); + err = allocateBuffer(portIndex, bufSize, info); } else if (mQuirks & requiresAllocateBufferBit) { err = mOMX->allocateBufferWithBackup( mNode, portIndex, mem, &info.mBufferID, allottedSize); @@ -1643,6 +1639,8 @@ status_t ACodec::configureCodec( return err; } + enableCustomAllocationMode(msg); + int32_t bitRate = 0; // FLAC encoder doesn't need a bitrate, other encoders do if (encoder && strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_FLAC) @@ -6385,6 +6383,16 @@ sp ACodec::createObserver() { return observer; } +status_t ACodec::allocateBuffer( + OMX_U32 portIndex, size_t bufSize, BufferInfo &info) { + void *ptr; + status_t err = mOMX->allocateBuffer( + mNode, portIndex, bufSize, &info.mBufferID, &ptr); + + info.mData = new ABuffer(ptr, bufSize); + return err; +} + bool ACodec::ExecutingState::onOMXFrameRendered(int64_t mediaTimeUs, nsecs_t systemNano) { mCodec->onFrameRendered(mediaTimeUs, systemNano); return true; -- cgit v1.1