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

Commit 0b123d54 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6374687 from 081d066c to rvc-release

Change-Id: I0bf2b197f33949ad7e7c6b9054b4f8cff95e3b76
parents 67e8fee1 081d066c
Loading
Loading
Loading
Loading
+2 −11
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ constexpr size_t kMinInputBufferSize = 2 * 1024 * 1024;
constexpr char COMPONENT_NAME[] = "c2.android.avc.decoder";
constexpr char COMPONENT_NAME[] = "c2.android.avc.decoder";
constexpr uint32_t kDefaultOutputDelay = 8;
constexpr uint32_t kDefaultOutputDelay = 8;
constexpr uint32_t kMaxOutputDelay = 16;
constexpr uint32_t kMaxOutputDelay = 16;
constexpr uint32_t kMinInputBytes = 4;
}  // namespace
}  // namespace


class C2SoftAvcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
class C2SoftAvcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
@@ -817,7 +818,7 @@ void C2SoftAvcDec::process(
          inSize, (int)work->input.ordinal.timestamp.peeku(),
          inSize, (int)work->input.ordinal.timestamp.peeku(),
          (int)work->input.ordinal.frameIndex.peeku(), work->input.flags);
          (int)work->input.ordinal.frameIndex.peeku(), work->input.flags);
    size_t inPos = 0;
    size_t inPos = 0;
    while (inPos < inSize) {
    while (inPos < inSize && inSize - inPos >= kMinInputBytes) {
        if (C2_OK != ensureDecoderState(pool)) {
        if (C2_OK != ensureDecoderState(pool)) {
            mSignalledError = true;
            mSignalledError = true;
            work->workletsProcessed = 1u;
            work->workletsProcessed = 1u;
@@ -904,7 +905,6 @@ void C2SoftAvcDec::process(
                work->result = C2_CORRUPTED;
                work->result = C2_CORRUPTED;
                return;
                return;
            }
            }
            continue;
        }
        }
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
        if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) {
            if (mHeaderDecoded == false) {
            if (mHeaderDecoded == false) {
@@ -937,16 +937,7 @@ void C2SoftAvcDec::process(
        if (s_decode_op.u4_output_present) {
        if (s_decode_op.u4_output_present) {
            finishWork(s_decode_op.u4_ts, work);
            finishWork(s_decode_op.u4_ts, work);
        }
        }
        if (0 == s_decode_op.u4_num_bytes_consumed) {
            ALOGD("Bytes consumed is zero. Ignoring remaining bytes");
            break;
        }
        inPos += s_decode_op.u4_num_bytes_consumed;
        inPos += s_decode_op.u4_num_bytes_consumed;
        if (hasPicture && (inSize - inPos)) {
            ALOGD("decoded frame in current access nal, ignoring further trailing bytes %d",
                  (int)inSize - (int)inPos);
            break;
        }
    }
    }
    if (eos) {
    if (eos) {
        drainInternal(DRAIN_COMPONENT_WITH_EOS, pool, work);
        drainInternal(DRAIN_COMPONENT_WITH_EOS, pool, work);
+14 −3
Original line number Original line Diff line number Diff line
@@ -2896,7 +2896,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return ERROR_MALFORMED;
                return ERROR_MALFORMED;
            }
            }


            parseID3v2MetaData(data_offset + 6);
            parseID3v2MetaData(data_offset + 6, chunk_data_size - 6);


            break;
            break;
        }
        }
@@ -4167,8 +4167,19 @@ status_t MPEG4Extractor::parse3GPPMetaData(off64_t offset, size_t size, int dept
    return OK;
    return OK;
}
}


void MPEG4Extractor::parseID3v2MetaData(off64_t offset) {
void MPEG4Extractor::parseID3v2MetaData(off64_t offset, uint64_t size) {
    ID3 id3(mDataSource, true /* ignorev1 */, offset);
    uint8_t *buffer = new (std::nothrow) uint8_t[size];
    if (buffer == NULL) {
        return;
    }
    if (mDataSource->readAt(offset, buffer, size) != (ssize_t)size) {
        delete[] buffer;
        buffer = NULL;
        return;
    }

    ID3 id3(buffer, size, true /* ignorev1 */);
    delete[] buffer;


    if (id3.isValid()) {
    if (id3.isValid()) {
        struct Map {
        struct Map {
+1 −1
Original line number Original line Diff line number Diff line
@@ -161,7 +161,7 @@ private:
    status_t parseITunesMetaData(off64_t offset, size_t size);
    status_t parseITunesMetaData(off64_t offset, size_t size);
    status_t parseColorInfo(off64_t offset, size_t size);
    status_t parseColorInfo(off64_t offset, size_t size);
    status_t parse3GPPMetaData(off64_t offset, size_t size, int depth);
    status_t parse3GPPMetaData(off64_t offset, size_t size, int depth);
    void parseID3v2MetaData(off64_t offset);
    void parseID3v2MetaData(off64_t offset, uint64_t size);
    status_t parseQTMetaKey(off64_t data_offset, size_t data_size);
    status_t parseQTMetaKey(off64_t data_offset, size_t data_size);
    status_t parseQTMetaVal(int32_t keyId, off64_t data_offset, size_t data_size);
    status_t parseQTMetaVal(int32_t keyId, off64_t data_offset, size_t data_size);


+2 −2
Original line number Original line Diff line number Diff line
@@ -208,11 +208,11 @@ static inline constexpr const char *BUNDLE_PROPERTY_COUNT = "_propertyCount";


template<size_t N>
template<size_t N>
static inline bool startsWith(const std::string &s, const char (&comp)[N]) {
static inline bool startsWith(const std::string &s, const char (&comp)[N]) {
    return !strncmp(s.c_str(), comp, N - 1);
    return !strncmp(s.c_str(), comp, N - 1); // last char is null termination
}
}


static inline bool startsWith(const std::string& s, const std::string& comp) {
static inline bool startsWith(const std::string& s, const std::string& comp) {
    return !strncmp(s.c_str(), comp.c_str(), comp.size() - 1);
    return !strncmp(s.c_str(), comp.c_str(), comp.size());
}
}


/**
/**
+17 −4
Original line number Original line Diff line number Diff line
@@ -41,12 +41,25 @@ sp<DeviceDescriptor> findPreferredDevice(
        IoDescriptor& desc, Filter filter, bool& active, const DeviceVector& devices)
        IoDescriptor& desc, Filter filter, bool& active, const DeviceVector& devices)
{
{
    auto activeClients = desc->clientsList(true /*activeOnly*/);
    auto activeClients = desc->clientsList(true /*activeOnly*/);
    active = activeClients.size() > 0;

    if (active) {
        // On MMAP IOs, the preferred device is selected by the first client (virtual client
        // created when the mmap stream is opened). This client is never active.
        // On non MMAP IOs, the preferred device is honored only if all active clients have
        // a preferred device in which case the first client drives the selection.
        if (desc->getPolicyAudioPort()->isMmap()) {
            // The client list is never empty on a MMAP IO
            return devices.getDeviceFromId(
                    desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId());
        } else {
            auto activeClientsWithRoute =
            auto activeClientsWithRoute =
                desc->clientsList(true /*activeOnly*/, filter, true /*preferredDevice*/);
                desc->clientsList(true /*activeOnly*/, filter, true /*preferredDevice*/);
    active = activeClients.size() > 0;
            if (activeClients.size() == activeClientsWithRoute.size()) {
    if (active && activeClients.size() == activeClientsWithRoute.size()) {
                return devices.getDeviceFromId(activeClientsWithRoute[0]->preferredDeviceId());
                return devices.getDeviceFromId(activeClientsWithRoute[0]->preferredDeviceId());
            }
            }
        }
    }
    return nullptr;
    return nullptr;
}
}


Loading