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

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

Merge "Handle opus v0 and v1"

parents 107fd5a1 99c60f86
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1062,8 +1062,15 @@ media_status_t MyOpusExtractor::verifyOpusHeader(MediaBufferHelper *buffer) {
    size_t size = buffer->range_length();

    if (size < kOpusHeaderSize
            || memcmp(data, "OpusHead", 8)
            || /* version = */ data[8] != 1) {
            || memcmp(data, "OpusHead", 8)) {
        return AMEDIA_ERROR_MALFORMED;
    }
    // allow both version 0 and 1. Per the opus specification:
    // An earlier draft of the specification described a version 0, but the only difference
    // between version 1 and version 0 is that version 0 did not specify the semantics for
    // handling the version field
    if ( /* version = */ data[8] > 1) {
        ALOGW("no support for opus version %d", data[8]);
        return AMEDIA_ERROR_MALFORMED;
    }