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

Commit 226c9b91 authored by Chong Zhang's avatar Chong Zhang
Browse files

fix crash due to no output format available

Output format should arrive before we get first frame, but if
it doesn't, better fail it than crash.

bug: 69924594
Change-Id: If70082bd9901d52f20d63d92fd6c2b34d4cee830
parent 9c036d8c
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -419,8 +419,11 @@ status_t VideoFrameDecoder::onOutputReceived(

    *done = (++mNumFramesDecoded >= mNumFrames);

    if (outputFormat == NULL) {
        return ERROR_MALFORMED;
    }

    int32_t width, height;
    CHECK(outputFormat != NULL);
    CHECK(outputFormat->findInt32("width", &width));
    CHECK(outputFormat->findInt32("height", &height));

@@ -540,8 +543,11 @@ sp<AMessage> ImageDecoder::onGetFormatAndSeekOptions(
status_t ImageDecoder::onOutputReceived(
        const sp<MediaCodecBuffer> &videoFrameBuffer,
        const sp<AMessage> &outputFormat, int64_t /*timeUs*/, bool *done) {
    if (outputFormat == NULL) {
        return ERROR_MALFORMED;
    }

    int32_t width, height;
    CHECK(outputFormat != NULL);
    CHECK(outputFormat->findInt32("width", &width));
    CHECK(outputFormat->findInt32("height", &height));