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

Commit 049ccd84 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [2686743, 2686091, 2686092, 2686125, 2686126, 2686127,...

Merge cherrypicks of [2686743, 2686091, 2686092, 2686125, 2686126, 2686127, 2686744, 2686745, 2686543, 2686746, 2686747, 2686748, 2686749, 2686750, 2686751, 2686544, 2686545, 2686546, 2686547, 2686548, 2686549, 2686550, 2686821, 2686242, 2686243, 2686128, 2686754, 2686755, 2686551, 2686244, 2686552, 2686756, 2686265, 2686245, 2686246, 2686266, 2686096, 2686757, 2686758, 2686759, 2686900, 2686901, 2686902, 2686903, 2686904] into oc-r3-release

Change-Id: I054ea6b2ad08b1d45972854e939426b245204036
parents 3e0e9138 d49a2a9d
Loading
Loading
Loading
Loading
+34 −8
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@
#include "HTTPBase.h"
#include "RemoteDisplay.h"

static const int kDumpLockRetries = 50;
static const int kDumpLockSleepUs = 20000;

namespace {
using android::media::Metadata;
using android::status_t;
@@ -392,12 +395,32 @@ status_t MediaPlayerService::Client::dump(int fd, const Vector<String16>& args)
    snprintf(buffer, 255, "  pid(%d), connId(%d), status(%d), looping(%s)\n",
            mPid, mConnId, mStatus, mLoop?"true": "false");
    result.append(buffer);

    sp<MediaPlayerBase> p;
    sp<AudioOutput> audioOutput;
    bool locked = false;
    for (int i = 0; i < kDumpLockRetries; ++i) {
        if (mLock.tryLock() == NO_ERROR) {
            locked = true;
            break;
        }
        usleep(kDumpLockSleepUs);
    }

    if (locked) {
        p = mPlayer;
        audioOutput = mAudioOutput;
        mLock.unlock();
    } else {
        result.append("  lock is taken, no dump from player and audio output\n");
    }
    write(fd, result.string(), result.size());
    if (mPlayer != NULL) {
        mPlayer->dump(fd, args);

    if (p != NULL) {
        p->dump(fd, args);
    }
    if (mAudioOutput != 0) {
        mAudioOutput->dump(fd, args);
    if (audioOutput != 0) {
        audioOutput->dump(fd, args);
    }
    write(fd, "\n", 1);
    return NO_ERROR;
@@ -577,7 +600,10 @@ MediaPlayerService::Client::Client(
MediaPlayerService::Client::~Client()
{
    ALOGV("Client(%d) destructor pid = %d", mConnId, mPid);
    {
        Mutex::Autolock l(mLock);
        mAudioOutput.clear();
    }
    wp<Client> client(this);
    disconnect();
    mService->removeClient(client);
@@ -597,9 +623,8 @@ void MediaPlayerService::Client::disconnect()
        Mutex::Autolock l(mLock);
        p = mPlayer;
        mClient.clear();
    }

        mPlayer.clear();
    }

    // clear the notification to prevent callbacks to dead client
    // and reset the player. We assume the player will serialize
@@ -621,7 +646,7 @@ void MediaPlayerService::Client::disconnect()
sp<MediaPlayerBase> MediaPlayerService::Client::createPlayer(player_type playerType)
{
    // determine if we have the right player type
    sp<MediaPlayerBase> p = mPlayer;
    sp<MediaPlayerBase> p = getPlayer();
    if ((p != NULL) && (p->playerType() != playerType)) {
        ALOGV("delete player");
        p.clear();
@@ -772,6 +797,7 @@ void MediaPlayerService::Client::setDataSource_post(
    }

    if (mStatus == OK) {
        Mutex::Autolock l(mLock);
        mPlayer = p;
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -970,6 +970,14 @@ void CameraSource::releaseRecordingFrame(const sp<IMemory>& frame) {
        }

        if (handle != nullptr) {
            ssize_t offset;
            size_t size;
            sp<IMemoryHeap> heap = frame->getMemory(&offset, &size);
            if (heap->getHeapID() != mMemoryHeapBase->getHeapID()) {
                ALOGE("%s: Mismatched heap ID, ignoring release (got %x, expected %x)",
		     __FUNCTION__, heap->getHeapID(), mMemoryHeapBase->getHeapID());
                return;
            }
            uint32_t batchSize = 0;
            {
                Mutex::Autolock autoLock(mBatchLock);
+9 −4
Original line number Diff line number Diff line
@@ -89,10 +89,10 @@ SoftMPEG2::~SoftMPEG2() {
}


static size_t getMinTimestampIdx(OMX_S64 *pNTimeStamp, bool *pIsTimeStampValid) {
static ssize_t getMinTimestampIdx(OMX_S64 *pNTimeStamp, bool *pIsTimeStampValid) {
    OMX_S64 minTimeStamp = LLONG_MAX;
    int idx = -1;
    for (size_t i = 0; i < MAX_TIME_STAMPS; i++) {
    ssize_t idx = -1;
    for (ssize_t i = 0; i < MAX_TIME_STAMPS; i++) {
        if (pIsTimeStampValid[i]) {
            if (pNTimeStamp[i] < minTimeStamp) {
                minTimeStamp = pNTimeStamp[i];
@@ -788,10 +788,15 @@ void SoftMPEG2::onQueueFilled(OMX_U32 portIndex) {
            }

            if (s_dec_op.u4_output_present) {
                size_t timeStampIdx;
                ssize_t timeStampIdx;
                outHeader->nFilledLen = (mWidth * mHeight * 3) / 2;

                timeStampIdx = getMinTimestampIdx(mTimeStamps, mTimeStampsValid);
                if (timeStampIdx < 0) {
                    ALOGE("b/62872863, Invalid timestamp index!");
                    android_errorWriteLog(0x534e4554, "62872863");
                    return;
                }
                outHeader->nTimeStamp = mTimeStamps[timeStampIdx];
                mTimeStampsValid[timeStampIdx] = false;

+5 −0
Original line number Diff line number Diff line
@@ -892,6 +892,11 @@ sp<ABuffer> ElementaryStreamQueue::dequeueAccessUnitAAC() {
        bits.skipBits(2);

        unsigned aac_frame_length = bits.getBits(13);
        if (aac_frame_length == 0){
            ALOGE("b/62673179, Invalid AAC frame length!");
            android_errorWriteLog(0x534e4554, "62673179");
            return NULL;
        }

        bits.skipBits(11);  // adts_buffer_fullness

+18 −0
Original line number Diff line number Diff line
@@ -1334,6 +1334,24 @@ status_t AudioFlinger::EffectHandle::command(uint32_t cmdCode,
    ALOGVV("command(), cmdCode: %d, mHasControl: %d, mEffect: %p",
            cmdCode, mHasControl, mEffect.unsafe_get());

    // reject commands reserved for internal use by audio framework if coming from outside
    // of audioserver
    switch(cmdCode) {
        case EFFECT_CMD_ENABLE:
        case EFFECT_CMD_DISABLE:
        case EFFECT_CMD_SET_PARAM:
        case EFFECT_CMD_SET_PARAM_DEFERRED:
        case EFFECT_CMD_SET_PARAM_COMMIT:
        case EFFECT_CMD_GET_PARAM:
            break;
        default:
            if (cmdCode >= EFFECT_CMD_FIRST_PROPRIETARY) {
                break;
            }
            android_errorWriteLog(0x534e4554, "62019992");
            return BAD_VALUE;
    }

    if (cmdCode == EFFECT_CMD_ENABLE) {
        if (*replySize < sizeof(int)) {
            android_errorWriteLog(0x534e4554, "32095713");