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

Commit bf7927a0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Send audio-presentation metadata in access units"

parents fff6fb6d c6148a6a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -734,6 +734,9 @@ media_status_t MPEG2PSExtractor::Track::read(
    if (inMeta.findData(kKeySEI, &bufType, &bufData, &bufSize)) {
        AMediaFormat_setBuffer(outMeta, AMEDIAFORMAT_KEY_SEI, bufData, bufSize);
    }
    if (inMeta.findData(kKeyAudioPresentationInfo, &bufType, &bufData, &bufSize)) {
        AMediaFormat_setBuffer(outMeta, AMEDIAFORMAT_KEY_AUDIO_PRESENTATION_INFO, bufData, bufSize);
    }
    mbuf->release();
    return AMEDIA_OK;
}
+3 −0
Original line number Diff line number Diff line
@@ -224,6 +224,9 @@ media_status_t MPEG2TSSource::read(
    if (inMeta.findData(kKeySEI, &bufType, &bufData, &bufSize)) {
        AMediaFormat_setBuffer(outMeta, AMEDIAFORMAT_KEY_SEI, bufData, bufSize);
    }
    if (inMeta.findData(kKeyAudioPresentationInfo, &bufType, &bufData, &bufSize)) {
        AMediaFormat_setBuffer(outMeta, AMEDIAFORMAT_KEY_AUDIO_PRESENTATION_INFO, bufData, bufSize);
    }
    mbuf->release();
    return AMEDIA_OK;
}
+4 −0
Original line number Diff line number Diff line
@@ -172,6 +172,10 @@ status_t MediaTrackCUnwrapper::read(MediaBufferBase **buffer, const ReadOptions
            meta.setData(kKeySEI,
                    MetaDataBase::Type::TYPE_NONE, valbuf->data(), valbuf->size());
        }
        if (format->mFormat->findBuffer("audio-presentation-info", &valbuf)) {
            meta.setData(kKeyAudioPresentationInfo,
                    MetaDataBase::Type::TYPE_NONE, valbuf->data(), valbuf->size());
        }
    } else {
        *buffer = nullptr;
    }
+20 −16
Original line number Diff line number Diff line
@@ -795,21 +795,21 @@ bool NuMediaExtractor::getCachedDuration(
}

// Return OK if we have received an audio presentation info.
// Return ERROR_END_OF_STREAM if no tracks are available.
// Return ERROR_UNSUPPORTED if the track has no audio presentation.
// Return INVALID_OPERATION if audio presentation metadata version does not match.
status_t NuMediaExtractor::getAudioPresentations(
        size_t trackIndex, AudioPresentationCollection *presentations) const {
        size_t trackIndex, AudioPresentationCollection *presentations) {
    Mutex::Autolock autoLock(mLock);

    if (mImpl == NULL) {
        return -EINVAL;
    }

    if (trackIndex >= mImpl->countTracks()) {
        return -ERANGE;
    ssize_t minIndex = fetchAllTrackSamples();
    if (minIndex < 0) {
        return ERROR_END_OF_STREAM;
    }
    for (size_t i = 0; i < mSelectedTracks.size(); ++i) {
        TrackInfo *info = &mSelectedTracks.editItemAt(i);

    sp<MetaData> meta = mImpl->getTrackMetaData(trackIndex);
        if (info->mTrackIndex == trackIndex) {
            sp<MetaData> meta = new MetaData(info->mSamples.begin()->mBuffer->meta_data());

            uint32_t type;
            const void *data;
@@ -818,7 +818,11 @@ status_t NuMediaExtractor::getAudioPresentations(
                std::istringstream inStream(std::string(static_cast<const char*>(data), size));
                return deserializeAudioPresentations(&inStream, presentations);
            }
    ALOGE("Source does not contain any audio presentation");
            ALOGV("Track %zu does not contain any audio presentation", trackIndex);
            return ERROR_UNSUPPORTED;
        }
    }
    ALOGV("Source does not contain any audio presentation");
    return ERROR_UNSUPPORTED;
}

+1 −2
Original line number Diff line number Diff line
@@ -96,8 +96,7 @@ struct NuMediaExtractor : public RefBase {

    bool getCachedDuration(int64_t *durationUs, bool *eos) const;

    status_t getAudioPresentations(size_t trackIdx,
            AudioPresentationCollection *presentations) const;
    status_t getAudioPresentations(size_t trackIdx, AudioPresentationCollection *presentations);

protected:
    virtual ~NuMediaExtractor();
Loading