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

Commit 3fb6102d authored by Harish Mahendrakar's avatar Harish Mahendrakar
Browse files

C2SoftMp3Dec: Treat timestamps as signed values

As first timestamp can be negative, treat the timestamp
values as signed.

Bug: 190629272
Test: poc in bug

Change-Id: I4ea40397a3f57b19984c4a397258c364a13be759
parent 039bbd44
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

//#define LOG_NDEBUG 0
#define LOG_TAG "C2SoftMp3Dec"
#include <inttypes.h>
#include <log/log.h>

#include <numeric>
@@ -485,10 +486,10 @@ void C2SoftMP3::process(
        }
    }

    uint64_t outTimeStamp = mProcessedSamples * 1000000ll / samplingRate;
    int64_t outTimeStamp = mProcessedSamples * 1000000ll / samplingRate;
    mProcessedSamples += ((outSize - outOffset) / (numChannels * sizeof(int16_t)));
    ALOGV("out buffer attr. offset %d size %d timestamp %u", outOffset, outSize - outOffset,
          (uint32_t)(mAnchorTimeStamp + outTimeStamp));
    ALOGV("out buffer attr. offset %d size %d timestamp %" PRId64 " ", outOffset,
          outSize - outOffset, mAnchorTimeStamp + outTimeStamp);
    decodedSizes.clear();
    work->worklets.front()->output.flags = work->input.flags;
    work->worklets.front()->output.buffers.clear();
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ private:
    bool mSignalledError;
    bool mSignalledOutputEos;
    bool mGaplessBytes;
    uint64_t mAnchorTimeStamp;
    int64_t mAnchorTimeStamp;
    uint64_t mProcessedSamples;

    status_t initDecoder();