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

Commit 1913c1ae authored by Andreas Huber's avatar Andreas Huber
Browse files

Don't retrieve metadata unless necessary for ogg-vorbis ringtone auto-looping.

Change-Id: Iaf5880bb3376f9cbf22aefe198878eaf6f3f08c7
related-to-bug: 3037389
parent 106950f2
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -317,6 +317,11 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
            setAudioSource(extractor->getTrack(i));
            haveAudio = true;

            if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) {
                // Only do this for vorbis audio, none of the other audio
                // formats even support this ringtone specific hack and
                // retrieving the metadata on some extractors may turn out
                // to be very expensive.
                sp<MetaData> fileMeta = extractor->getMetaData();
                int32_t loop;
                if (fileMeta != NULL
@@ -324,6 +329,7 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
                    mFlags |= AUTO_LOOPING;
                }
            }
        }

        if (haveAudio && haveVideo) {
            break;