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

Commit 2497451c authored by Ian Baker's avatar Ian Baker
Browse files

Revert "Faster sniffing for MIDIExtractor"

This reverts commit 309ee9d2.

Reason for revert: Fails CTS b/262896125

Bug: 262896125
Bug: 181040054

Change-Id: Ia43a923b76d31fe6897b80a1ca8da6995f7e210a
parent 309ee9d2
Loading
Loading
Loading
Loading
+5 −22
Original line number Diff line number Diff line
@@ -327,29 +327,12 @@ media_status_t MidiExtractor::getMetaData(AMediaFormat *meta)

bool SniffMidi(CDataSource *source, float *confidence)
{
    // look for standard prefix / magic number info in the files.
    // "MThd" for midi
    // "XMF_"
    // this will be very fast.
    //
    char hdr_magic[4];
    if (source->readAt(source->handle, 0, hdr_magic, sizeof(hdr_magic)) == sizeof(hdr_magic)) {
        if (memcmp(hdr_magic,"MThd", sizeof(hdr_magic)) == 0) {
            *confidence = 0.85;
            ALOGV("SniffMidi: yes, MThd");
    MidiEngine p(source, NULL, NULL);
    if (p.initCheck() == OK) {
        *confidence = 0.8;
        ALOGV("SniffMidi: yes");
        return true;
    }
        if (memcmp(hdr_magic,"XMF_", sizeof(hdr_magic)) == 0) {
            *confidence = 0.85;
            ALOGV("SniffMidi: yes, XMF_");
            return true;
        }
    }

    // alternatives:
    // instantiate MidiEngine, (expensively) parsing the entire file to decide.


    ALOGV("SniffMidi: no");
    return false;