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

Commit 6cb243cd authored by Chong Zhang's avatar Chong Zhang
Browse files

fix crash due to no output format available -- DO NOT MERGE

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

bug: 69924594
bug: 75978033
Change-Id: I057ba49c8f83b9a301d409510717039ad894c391
parent 237f9034
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -494,13 +494,18 @@ static VideoFrame *extractVideoFrame(
                    ALOGV("Timed-out waiting for output.. retries left = %zu", retriesLeft);
                    err = OK;
                } else if (err == OK) {
	            if (outputFormat == NULL) {
                        decoder->releaseOutputBuffer(index);
                        err = ERROR_MALFORMED;
                        break;
                    }

                    // If we're seeking with CLOSEST option and obtained a valid targetTimeUs
                    // from the extractor, decode to the specified frame. Otherwise we're done.
                    ALOGV("Received an output buffer, timeUs=%lld", (long long)timeUs);
                    sp<MediaCodecBuffer> videoFrameBuffer = outputBuffers.itemAt(index);

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