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

Commit 7fa66613 authored by Ray Essick's avatar Ray Essick
Browse files

Clean upMP3Extractor member data initialization

move member default initialization to declaration of the member data
instead of as an argument in the constructor.

Bug: 155171907
Test: Mp3DecoderTest, re-fuzzing
Change-Id: I316210b1cc5d185cb8760835b5cd2c958bbcc085
parent 199012b0
Loading
Loading
Loading
Loading
+14 −22
Original line number Diff line number Diff line
@@ -227,17 +227,17 @@ protected:

private:
    static const size_t kMaxFrameSize;
    AMediaFormat *mMeta;
    DataSourceHelper *mDataSource;
    off64_t mFirstFramePos;
    uint32_t mFixedHeader;
    off64_t mCurrentPos;
    int64_t mCurrentTimeUs;
    bool mStarted;
    MP3Seeker *mSeeker;

    int64_t mBasisTimeUs;
    int64_t mSamplesRead;
    AMediaFormat *mMeta = NULL;
    DataSourceHelper *mDataSource = NULL;
    off64_t mFirstFramePos = 0;
    uint32_t mFixedHeader = 0;
    off64_t mCurrentPos = 0;
    int64_t mCurrentTimeUs = 0;
    bool mStarted = false;
    MP3Seeker *mSeeker = NULL;

    int64_t mBasisTimeUs = 0;
    int64_t mSamplesRead = 0;

    MP3Source(const MP3Source &);
    MP3Source &operator=(const MP3Source &);
@@ -251,11 +251,7 @@ struct Mp3Meta {

MP3Extractor::MP3Extractor(
        DataSourceHelper *source, Mp3Meta *meta)
    : mInitCheck(NO_INIT),
      mDataSource(source),
      mFirstFramePos(-1),
      mFixedHeader(0),
      mSeeker(NULL) {
    : mDataSource(source) {

    off64_t pos = 0;
    off64_t post_id3_pos;
@@ -442,6 +438,7 @@ media_status_t MP3Extractor::getTrackMetaData(
//  (8000 samples/sec * 8 bits/byte)) + 1 padding byte/frame = 2881 bytes/frame.
// Set our max frame size to the nearest power of 2 above this size (aka, 4kB)
const size_t MP3Source::kMaxFrameSize = (1 << 12); /* 4096 bytes */

MP3Source::MP3Source(
        AMediaFormat *meta, DataSourceHelper *source,
        off64_t first_frame_pos, uint32_t fixed_header,
@@ -450,12 +447,7 @@ MP3Source::MP3Source(
      mDataSource(source),
      mFirstFramePos(first_frame_pos),
      mFixedHeader(fixed_header),
      mCurrentPos(0),
      mCurrentTimeUs(0),
      mStarted(false),
      mSeeker(seeker),
      mBasisTimeUs(0),
      mSamplesRead(0) {
      mSeeker(seeker) {
}

MP3Source::~MP3Source() {
+6 −6
Original line number Diff line number Diff line
@@ -45,13 +45,13 @@ public:
    virtual const char * name() { return "MP3Extractor"; }

private:
    status_t mInitCheck;
    status_t mInitCheck = NO_INIT;

    DataSourceHelper *mDataSource;
    off64_t mFirstFramePos;
    AMediaFormat *mMeta;
    uint32_t mFixedHeader;
    MP3Seeker *mSeeker;
    DataSourceHelper *mDataSource = NULL;
    off64_t mFirstFramePos = -1;
    AMediaFormat *mMeta = NULL;
    uint32_t mFixedHeader = 0;
    MP3Seeker *mSeeker = NULL;

    MP3Extractor(const MP3Extractor &);
    MP3Extractor &operator=(const MP3Extractor &);