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

Commit 396b737e authored by Steve Kondik's avatar Steve Kondik
Browse files

stagefright: Allocate only what is needed for FLAC decoding

 * Choose buffer size based on bit depth

Change-Id: Ic3aef0ac77f330896dfcfe4cccfc5113925d28b1
parent 45e93804
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -559,7 +559,8 @@ void FLACParser::allocateBuffers()
    CHECK(mGroup == NULL);
    CHECK(mGroup == NULL);
    mGroup = new MediaBufferGroup;
    mGroup = new MediaBufferGroup;
    // allocate enough to hold 24-bits (packed in 32 bits)
    // allocate enough to hold 24-bits (packed in 32 bits)
    mMaxBufferSize = getMaxBlockSize() * getChannels() * 4;
    unsigned int bytesPerSample = getBitsPerSample() > 16 ? 4 : 2;
    mMaxBufferSize = getMaxBlockSize() * getChannels() * bytesPerSample;
    mGroup->add_buffer(new MediaBuffer(mMaxBufferSize));
    mGroup->add_buffer(new MediaBuffer(mMaxBufferSize));
}
}