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

Commit 87e441bb authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Make change and version bump to r_aml_300800800 for mainline module file: apex/manifest_codec.json

Change-Id: I6f82ae42887b7afa6dec9f39f0782cf58acc9460
parents d2227cec d32a71bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
  "name": "com.android.media",
  "version": 300800500
  "version": 300800800
}
+1 −1
Original line number Diff line number Diff line
{
  "name": "com.android.media.swcodec",
  "version": 300800500
  "version": 300800800
}
+19 −10
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public:
        do {
            closeAudioStream();
            if (mOpenDelayMillis) usleep(mOpenDelayMillis * 1000);
            openAudioStream(mDirection);
            openAudioStream(mDirection, mRequestedSharingMode);
            // It is possible for the stream to be disconnected, or stolen between the time
            // it is opened and when it is started. If that happens then try again.
            // If it was stolen then it should succeed the second time because there will already be
@@ -136,11 +136,13 @@ public:
        return AAUDIO_CALLBACK_RESULT_CONTINUE;
    }

    aaudio_result_t openAudioStream(aaudio_direction_t direction) {
    aaudio_result_t openAudioStream(aaudio_direction_t direction,
            aaudio_sharing_mode_t requestedSharingMode) {
        std::lock_guard<std::mutex> lock(mLock);

        AAudioStreamBuilder *builder = nullptr;
        mDirection = direction;
        mRequestedSharingMode = requestedSharingMode;

        // Use an AAudioStreamBuilder to contain requested parameters.
        aaudio_result_t result = AAudio_createStreamBuilder(&builder);
@@ -153,7 +155,7 @@ public:
        // Request stream properties.
        AAudioStreamBuilder_setFormat(builder, AAUDIO_FORMAT_PCM_FLOAT);
        AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
        AAudioStreamBuilder_setSharingMode(builder, AAUDIO_SHARING_MODE_EXCLUSIVE);
        AAudioStreamBuilder_setSharingMode(builder, mRequestedSharingMode);
        AAudioStreamBuilder_setDirection(builder, direction);
        AAudioStreamBuilder_setDataCallback(builder, s_myDataCallbackProc, this);
        AAudioStreamBuilder_setErrorCallback(builder, s_myErrorCallbackProc, this);
@@ -280,6 +282,7 @@ private:

    AAudioStream       *mStream = nullptr;
    aaudio_direction_t  mDirection = AAUDIO_DIRECTION_OUTPUT;
    aaudio_sharing_mode_t mRequestedSharingMode = AAUDIO_UNSPECIFIED;
    std::mutex          mLock;
    std::string         mName;
    int                 mMaxRetries = 1;
@@ -316,10 +319,11 @@ static void s_myErrorCallbackProc(
}

static void s_usage() {
    printf("test_steal_exclusive [-i] [-r{maxRetries}] [-d{delay}]\n");
    printf("test_steal_exclusive [-i] [-r{maxRetries}] [-d{delay}] -s\n");
    printf("     -i direction INPUT, otherwise OUTPUT\n");
    printf("     -d delay open by milliseconds, default = 0\n");
    printf("     -r max retries in the error callback, default = 1\n");
    printf("     -s try to open in SHARED mode\n");
}

int main(int argc, char ** argv) {
@@ -330,12 +334,13 @@ int main(int argc, char ** argv) {
    int errorCount = 0;
    int maxRetries = 1;
    int openDelayMillis = 0;
    aaudio_sharing_mode_t requestedSharingMode = AAUDIO_SHARING_MODE_EXCLUSIVE;

    // Make printf print immediately so that debug info is not stuck
    // in a buffer if we hang or crash.
    setvbuf(stdout, nullptr, _IONBF, (size_t) 0);

    printf("Test Stealing an EXCLUSIVE stream V1.0\n");
    printf("Test interaction between streams V1.1\n");
    printf("\n");

    for (int i = 1; i < argc; i++) {
@@ -352,6 +357,9 @@ int main(int argc, char ** argv) {
                case 'r':
                    maxRetries = atoi(&arg[2]);
                    break;
                case 's':
                    requestedSharingMode = AAUDIO_SHARING_MODE_SHARED;
                    break;
                default:
                    s_usage();
                    exit(EXIT_FAILURE);
@@ -369,17 +377,18 @@ int main(int argc, char ** argv) {
    victim.setMaxRetries(maxRetries);
    thief.setMaxRetries(maxRetries);

    result = victim.openAudioStream(direction);
    result = victim.openAudioStream(direction, requestedSharingMode);
    if (result != AAUDIO_OK) {
        printf("s_OpenAudioStream victim returned %s\n",
               AAudio_convertResultToText(result));
        errorCount++;
    }

    if (victim.sharingMode == AAUDIO_SHARING_MODE_EXCLUSIVE) {
        printf("Victim modes is EXCLUSIVE => OK\n");
    if (victim.sharingMode == requestedSharingMode) {
        printf("Victim modes is %s => OK\n", s_sharingModeToText(requestedSharingMode));
    } else {
        printf("Victim modes should be EXCLUSIVE => test not valid!\n");
        printf("Victim modes should be %s => test not valid!\n",
                s_sharingModeToText(requestedSharingMode));
        goto onerror;
    }

@@ -406,7 +415,7 @@ int main(int argc, char ** argv) {
    }

    printf("Trying to start the THIEF stream, which may steal the VICTIM MMAP resource -----\n");
    result = thief.openAudioStream(direction);
    result = thief.openAudioStream(direction, requestedSharingMode);
    if (result != AAUDIO_OK) {
        printf("s_OpenAudioStream victim returned %s\n",
               AAudio_convertResultToText(result));
+39 −10
Original line number Diff line number Diff line
@@ -22,11 +22,14 @@

#include <C2Buffer.h>

#include <Codec2BufferUtils.h>

#include <android/hardware/cas/native/1.0/IDescrambler.h>
#include <android/hardware/drm/1.0/types.h>
#include <binder/MemoryDealer.h>
#include <hidlmemory/FrameworkUtils.h>
#include <media/openmax/OMX_Core.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/foundation/AUtils.h>
#include <media/stagefright/MediaCodec.h>
@@ -91,15 +94,27 @@ ACodecBufferChannel::ACodecBufferChannel(
}

status_t ACodecBufferChannel::queueInputBuffer(const sp<MediaCodecBuffer> &buffer) {
    if (mDealer != nullptr) {
        return -ENOSYS;
    }
    std::shared_ptr<const std::vector<const BufferInfo>> array(
            std::atomic_load(&mInputBuffers));
    BufferInfoIterator it = findClientBuffer(array, buffer);
    if (it == array->end()) {
        return -ENOENT;
    }
    if (it->mClientBuffer != it->mCodecBuffer) {
        // Copy metadata from client to codec buffer.
        it->mCodecBuffer->meta()->clear();
        int64_t timeUs;
        CHECK(it->mClientBuffer->meta()->findInt64("timeUs", &timeUs));
        it->mCodecBuffer->meta()->setInt64("timeUs", timeUs);
        int32_t eos;
        if (it->mClientBuffer->meta()->findInt32("eos", &eos)) {
            it->mCodecBuffer->meta()->setInt32("eos", eos);
        }
        int32_t csd;
        if (it->mClientBuffer->meta()->findInt32("csd", &csd)) {
            it->mCodecBuffer->meta()->setInt32("csd", csd);
        }
    }
    ALOGV("queueInputBuffer #%d", it->mBufferId);
    sp<AMessage> msg = mInputBufferFilled->dup();
    msg->setObject("buffer", it->mCodecBuffer);
@@ -267,17 +282,31 @@ status_t ACodecBufferChannel::attachBuffer(
            }
            C2ConstLinearBlock block{c2Buffer->data().linearBlocks().front()};
            C2ReadView view{block.map().get()};
            if (view.capacity() > buffer->capacity()) {
                return -ENOSYS;
            }
            memcpy(buffer->base(), view.data(), view.capacity());
            buffer->setRange(0, view.capacity());
            size_t copyLength = std::min(size_t(view.capacity()), buffer->capacity());
            ALOGV_IF(view.capacity() > buffer->capacity(),
                    "view.capacity() = %zu, buffer->capacity() = %zu",
                    view.capacity(), buffer->capacity());
            memcpy(buffer->base(), view.data(), copyLength);
            buffer->setRange(0, copyLength);
            break;
        }
        case C2BufferData::GRAPHIC: {
            // TODO
            sp<ABuffer> imageData;
            if (!buffer->format()->findBuffer("image-data", &imageData)) {
                return -ENOSYS;
            }
            if (c2Buffer->data().graphicBlocks().size() != 1u) {
                return -ENOSYS;
            }
            C2ConstGraphicBlock block{c2Buffer->data().graphicBlocks().front()};
            const C2GraphicView view{block.map().get()};
            status_t err = ImageCopy(
                    buffer->base(), (const MediaImage2 *)(imageData->base()), view);
            if (err != OK) {
                return err;
            }
            break;
        }
        case C2BufferData::LINEAR_CHUNKS:  [[fallthrough]];
        case C2BufferData::GRAPHIC_CHUNKS: [[fallthrough]];
        default:
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ cc_library {
        "libutils",
        "libmedia_helper",
        "libsfplugin_ccodec",
        "libsfplugin_ccodec_utils",
        "libstagefright_codecbase",
        "libstagefright_foundation",
        "libstagefright_omx_utils",
Loading