diff options
author | Andreas Huber <andih@google.com> | 2010-10-04 11:20:21 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-04 11:20:21 -0700 |
commit | 7fa693740756123fa9d05e62fb47aae5d703c71d (patch) | |
tree | ee95a8c12cce6c7c8e02472a2d29b17094a52b88 | |
parent | 30f572956ef92e8636772be7bd5d0150cf7fd1fc (diff) | |
parent | 1913c1aeabc1ff8d288c2be269fc50f010ad5f0f (diff) | |
download | frameworks_base-7fa693740756123fa9d05e62fb47aae5d703c71d.zip frameworks_base-7fa693740756123fa9d05e62fb47aae5d703c71d.tar.gz frameworks_base-7fa693740756123fa9d05e62fb47aae5d703c71d.tar.bz2 |
Merge "Don't retrieve metadata unless necessary for ogg-vorbis ringtone auto-looping." into gingerbread
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index c955ac3..3975866 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -317,11 +317,17 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) { setAudioSource(extractor->getTrack(i)); haveAudio = true; - sp<MetaData> fileMeta = extractor->getMetaData(); - int32_t loop; - if (fileMeta != NULL - && fileMeta->findInt32(kKeyAutoLoop, &loop) && loop != 0) { - mFlags |= AUTO_LOOPING; + 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 + && fileMeta->findInt32(kKeyAutoLoop, &loop) && loop != 0) { + mFlags |= AUTO_LOOPING; + } } } |