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

Commit 665df6f7 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

StagefrightMetadataRetriever: handle mSource being NULL

Bug: 28071699
Change-Id: I480c803b73774e1db332b6ce981ea1b448ca1ff8
parent 0fd0d0c1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -61,8 +61,10 @@ StagefrightMetadataRetriever::StagefrightMetadataRetriever()
StagefrightMetadataRetriever::~StagefrightMetadataRetriever() {
    ALOGV("~StagefrightMetadataRetriever()");
    clearMetadata();
    if (mSource != NULL) {
        mSource->close();
    }
}

status_t StagefrightMetadataRetriever::setDataSource(
        const sp<IMediaHTTPService> &httpService,
@@ -704,7 +706,7 @@ void StagefrightMetadataRetriever::parseMetaData() {
        mMetaData.add(METADATA_KEY_BITRATE, String8(tmp));
    } else {
        off64_t sourceSize;
        if (mSource->getSize(&sourceSize) == OK) {
        if (mSource != NULL && mSource->getSize(&sourceSize) == OK) {
            int64_t avgBitRate = (int64_t)(sourceSize * 8E6 / maxDurationUs);

            sprintf(tmp, "%" PRId64, avgBitRate);