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 Original line Diff line number Diff line
@@ -227,17 +227,17 @@ protected:


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


    int64_t mBasisTimeUs;
    int64_t mBasisTimeUs = 0;
    int64_t mSamplesRead;
    int64_t mSamplesRead = 0;


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


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


    off64_t pos = 0;
    off64_t pos = 0;
    off64_t post_id3_pos;
    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.
//  (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)
// 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 */
const size_t MP3Source::kMaxFrameSize = (1 << 12); /* 4096 bytes */

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


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


private:
private:
    status_t mInitCheck;
    status_t mInitCheck = NO_INIT;


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


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