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

Commit a9480af5 authored by Wei Jia's avatar Wei Jia Committed by android-build-merger
Browse files

NuPlayer: return error when neither audio nor video source has metadata. am:...

NuPlayer: return error when neither audio nor video source has metadata. am: 1de83d5a am: bd6081a6
am: 3079cc4a

Change-Id: I7e8cf8dc466c642c71f3ca92db8e81c9b83c61a8
parents 038295e6 3079cc4a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1340,7 +1340,16 @@ void NuPlayer::onStart(int64_t startPositionUs) {
    }

    sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */);
    sp<MetaData> videoMeta = mSource->getFormatMeta(false /* audio */);
    if (audioMeta == NULL && videoMeta == NULL) {
        ALOGE("no metadata for either audio or video source");
        mSource->stop();
        mSourceStarted = false;
        notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_MALFORMED);
        return;
    }
    ALOGV_IF(audioMeta == NULL, "no metadata for audio source");  // video only stream

    audio_stream_type_t streamType = AUDIO_STREAM_MUSIC;
    if (mAudioSink != NULL) {
        streamType = mAudioSink->getAudioStreamType();