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

Commit 8c95fa91 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Signal that IDR frames are sync frames

Change-Id: Iaf77edc0572cae38935fd9d94367adbfcb370985
parent 308ca621
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -278,6 +278,10 @@ status_t FragmentedMPEG4Source::read(
    sp<AMessage> meta = parseBuffer->meta();
    sp<AMessage> meta = parseBuffer->meta();
    int64_t timeUs;
    int64_t timeUs;
    CHECK(meta->findInt64("timeUs", &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->meta_data()->setInt64(kKeyTime, timeUs);
    buffer->set_range(0, parseBuffer->size());
    buffer->set_range(0, parseBuffer->size());
    memcpy(buffer->data(), parseBuffer->data(), parseBuffer->size());
    memcpy(buffer->data(), parseBuffer->data(), parseBuffer->size());
+10 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,11 @@ status_t convertMetaDataToMessage(
        msg->setInt64("durationUs", durationUs);
        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)) {
    if (!strncasecmp("video/", mime, 6)) {
        int32_t width, height;
        int32_t width, height;
        CHECK(meta->findInt32(kKeyWidth, &width));
        CHECK(meta->findInt32(kKeyWidth, &width));
@@ -370,6 +375,11 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
        meta->setInt64(kKeyDuration, durationUs);
        meta->setInt64(kKeyDuration, durationUs);
    }
    }


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

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


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


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

        return OK;
        return OK;
    }
    }


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


    return OK;
    return OK;
}
}