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

Commit 6b3efc8b authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Signal that IDR frames are sync frames"

parents 8cade496 8c95fa91
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -278,6 +278,10 @@ status_t FragmentedMPEG4Source::read(
    sp<AMessage> meta = parseBuffer->meta();
    int64_t timeUs;
    CHECK(meta->findInt64("timeUs", &timeUs));
    int32_t isSync;
    if (meta->findInt32("is-sync-frame", &isSync) && isSync != 0) {
        buffer->meta_data()->setInt32(kKeyIsSyncFrame, 1);
    }
    buffer->meta_data()->setInt64(kKeyTime, timeUs);
    buffer->set_range(0, parseBuffer->size());
    memcpy(buffer->data(), parseBuffer->data(), parseBuffer->size());
+10 −0
Original line number Diff line number Diff line
@@ -78,6 +78,11 @@ status_t convertMetaDataToMessage(
        msg->setInt64("durationUs", durationUs);
    }

    int32_t isSync;
    if (meta->findInt32(kKeyIsSyncFrame, &isSync) && isSync != 0) {
        msg->setInt32("is-sync-frame", 1);
    }

    if (!strncasecmp("video/", mime, 6)) {
        int32_t width, height;
        CHECK(meta->findInt32(kKeyWidth, &width));
@@ -370,6 +375,11 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
        meta->setInt64(kKeyDuration, durationUs);
    }

    int32_t isSync;
    if (msg->findInt32("is-sync-frame", &isSync) && isSync != 0) {
        meta->setInt32(kKeyIsSyncFrame, 1);
    }

    if (mime.startsWith("video/")) {
        int32_t width;
        int32_t height;
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "FragmentedMP4Parser"
#include <utils/Log.h>

#include "include/avc_utils.h"
#include "include/ESDS.h"
#include "include/FragmentedMP4Parser.h"
#include "TrackFragment.h"
@@ -961,6 +962,10 @@ status_t FragmentedMP4Parser::makeAccessUnit(
               sample.mSize);

        (*accessUnit)->meta()->setInt64("timeUs", presentationTimeUs);
        if (IsIDR(*accessUnit)) {
            (*accessUnit)->meta()->setInt32("is-sync-frame", 1);
        }

        return OK;
    }

@@ -1003,6 +1008,9 @@ status_t FragmentedMP4Parser::makeAccessUnit(
                    "timeUs", presentationTimeUs);
        }
    }
    if (IsIDR(*accessUnit)) {
        (*accessUnit)->meta()->setInt32("is-sync-frame", 1);
    }

    return OK;
}