Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7758e3ed authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Merge tag 'android-5.1.1_r23' into cm-12.1

Android 5.1.1 release 23

Conflicts:
	include/media/stagefright/ACodec.h
	media/libstagefright/MPEG4Extractor.cpp
	media/libstagefright/OMXCodec.cpp
	media/libstagefright/Utils.cpp
	media/libstagefright/codecs/amrwbenc/src/util.c

Change-Id: I89ea84e273f2ebb2046ef4eeab91d541e0b6d47e
parents 2cdeeb45 95130295
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ private:
    bool mSentFormat;
    bool mIsEncoder;
    bool mUseMetadataOnEncoderOutput;
    bool mFatalError;
    bool mEncoderComponent;
    bool mComponentAllocByName;
    bool mShutdownInProgress;
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ private:
            return mSize <= sizeof(u.reservoir);
        }

        void allocateStorage(size_t size);
        void *allocateStorage(size_t size);
        void freeStorage();

        void *storage() {
+36 −10
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ enum {
#endif
};

#define MAX_ITEMS_PER_LIST 1024

class BpAudioFlinger : public BpInterface<IAudioFlinger>
{
public:
@@ -1356,15 +1358,27 @@ status_t BnAudioFlinger::onTransact(
        } break;
        case LIST_AUDIO_PORTS: {
            CHECK_INTERFACE(IAudioFlinger, data, reply);
            unsigned int num_ports = data.readInt32();
            unsigned int numPortsReq = data.readInt32();
            if (numPortsReq > MAX_ITEMS_PER_LIST) {
                numPortsReq = MAX_ITEMS_PER_LIST;
            }
            unsigned int numPorts = numPortsReq;
            struct audio_port *ports =
                    (struct audio_port *)calloc(num_ports,
                    (struct audio_port *)calloc(numPortsReq,
                                                           sizeof(struct audio_port));
            status_t status = listAudioPorts(&num_ports, ports);
            if (ports == NULL) {
                reply->writeInt32(NO_MEMORY);
                reply->writeInt32(0);
                return NO_ERROR;
            }
            status_t status = listAudioPorts(&numPorts, ports);
            reply->writeInt32(status);
            reply->writeInt32(numPorts);
            if (status == NO_ERROR) {
                reply->writeInt32(num_ports);
                reply->write(&ports, num_ports * sizeof(struct audio_port));
                if (numPortsReq > numPorts) {
                    numPortsReq = numPorts;
                }
                reply->write(ports, numPortsReq * sizeof(struct audio_port));
            }
            free(ports);
            return NO_ERROR;
@@ -1403,15 +1417,27 @@ status_t BnAudioFlinger::onTransact(
        } break;
        case LIST_AUDIO_PATCHES: {
            CHECK_INTERFACE(IAudioFlinger, data, reply);
            unsigned int num_patches = data.readInt32();
            unsigned int numPatchesReq = data.readInt32();
            if (numPatchesReq > MAX_ITEMS_PER_LIST) {
                numPatchesReq = MAX_ITEMS_PER_LIST;
            }
            unsigned int numPatches = numPatchesReq;
            struct audio_patch *patches =
                    (struct audio_patch *)calloc(num_patches,
                    (struct audio_patch *)calloc(numPatchesReq,
                                                 sizeof(struct audio_patch));
            status_t status = listAudioPatches(&num_patches, patches);
            if (patches == NULL) {
                reply->writeInt32(NO_MEMORY);
                reply->writeInt32(0);
                return NO_ERROR;
            }
            status_t status = listAudioPatches(&numPatches, patches);
            reply->writeInt32(status);
            reply->writeInt32(numPatches);
            if (status == NO_ERROR) {
                reply->writeInt32(num_patches);
                reply->write(&patches, num_patches * sizeof(struct audio_patch));
                if (numPatchesReq > numPatches) {
                    numPatchesReq = numPatches;
                }
                reply->write(patches, numPatchesReq * sizeof(struct audio_patch));
            }
            free(patches);
            return NO_ERROR;
+3 −3
Original line number Diff line number Diff line
@@ -257,9 +257,9 @@ status_t BnCrypto::onTransact(
                    subSamples,
                    sizeof(CryptoPlugin::SubSample) * numSubSamples);

            void *dstPtr;
            void *secureBufferId, *dstPtr;
            if (secure) {
                dstPtr = reinterpret_cast<void *>(static_cast<uintptr_t>(data.readInt64()));
                secureBufferId = reinterpret_cast<void *>(static_cast<uintptr_t>(data.readInt64()));
            } else {
                dstPtr = malloc(totalSize);
            }
@@ -272,7 +272,7 @@ status_t BnCrypto::onTransact(
                    mode,
                    srcData,
                    subSamples, numSubSamples,
                    dstPtr,
                    secure ? secureBufferId : dstPtr,
                    &errorDetailMsg);

            reply->writeInt32(result);
+9 −0
Original line number Diff line number Diff line
@@ -468,6 +468,7 @@ ACodec::ACodec()
      mSentFormat(false),
      mIsEncoder(false),
      mUseMetadataOnEncoderOutput(false),
      mFatalError(false),
      mShutdownInProgress(false),
      mExplicitShutdown(false),
      mEncoderDelay(0),
@@ -1089,6 +1090,11 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() {
        return NULL;
    }

    if (mFatalError) {
        ALOGW("not dequeuing from native window due to fatal error");
        return NULL;
    }

    if (native_window_dequeue_buffer_and_wait(mNativeWindow.get(), &buf) != 0) {
        ALOGE("dequeueBuffer failed.");
        return NULL;
@@ -4261,6 +4267,9 @@ void ACodec::signalError(OMX_ERRORTYPE error, status_t internalError) {
            ALOGW("Invalid OMX error %#x", error);
        }
    }

    mFatalError = true;

    notify->setInt32("err", internalError);
    notify->setInt32("actionCode", ACTION_CODE_FATAL); // could translate from OMX error.
    notify->post();
Loading