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

Commit ba67d2fe authored by Marco Nelissen's avatar Marco Nelissen Committed by Android Git Automerger
Browse files

am 93eb5ecf: Merge "Prevent divide by zero in WAVExtractor"

* commit '93eb5ecf':
  Prevent divide by zero in WAVExtractor
parents c9a3ea62 93eb5ecf
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -311,9 +311,17 @@ status_t WAVExtractor::init() {
                        1000000LL * (mDataSize / 65 * 320) / 8000;
                } else {
                    size_t bytesPerSample = mBitsPerSample >> 3;

                    if (!bytesPerSample || !mNumChannels)
                        return ERROR_MALFORMED;

                    size_t num_samples = mDataSize / (mNumChannels * bytesPerSample);

                    if (!mSampleRate)
                        return ERROR_MALFORMED;

                    durationUs =
                        1000000LL * (mDataSize / (mNumChannels * bytesPerSample))
                            / mSampleRate;
                        1000000LL * num_samples / mSampleRate;
                }

                mTrackMeta->setInt64(kKeyDuration, durationUs);