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

Commit 26eca01c authored by Andy Hung's avatar Andy Hung
Browse files

Check for null codec from AMediaCodec_createDecoderByType

NULL codec can now occur if codec cannot be created.

Bug: 20566134
Change-Id: I08d54e733a01d0614313673dc49a6f5e702633ac
parent fe48e0df
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -514,7 +514,8 @@ static status_t decode(int fd, int64_t offset, int64_t length,
        if (strncmp(mime, "audio/", 6) == 0) {

            AMediaCodec *codec = AMediaCodec_createDecoderByType(mime);
            if (AMediaCodec_configure(codec, format,
            if (codec == NULL
                    || AMediaCodec_configure(codec, format,
                            NULL /* window */, NULL /* drm */, 0 /* flags */) != AMEDIA_OK
                    || AMediaCodec_start(codec) != AMEDIA_OK
                    || AMediaExtractor_selectTrack(ex, i) != AMEDIA_OK) {