Skip to content

Commit 1388ace

Browse files
theandi666Android (Google) Code Review
authored andcommitted
Merge "Fix a reference to a stale pointer in AwesomePlayer." into ics-mr1
2 parents 12f9900 + d2b76d7 commit 1388ace

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

media/libstagefright/AwesomePlayer.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,12 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
385385
for (size_t i = 0; i < extractor->countTracks(); ++i) {
386386
sp<MetaData> meta = extractor->getTrackMetaData(i);
387387

388-
const char *mime;
389-
CHECK(meta->findCString(kKeyMIMEType, &mime));
388+
const char *_mime;
389+
CHECK(meta->findCString(kKeyMIMEType, &_mime));
390390

391-
if (!haveVideo && !strncasecmp(mime, "video/", 6)) {
391+
String8 mime = String8(_mime);
392+
393+
if (!haveVideo && !strncasecmp(mime.string(), "video/", 6)) {
392394
setVideoSource(extractor->getTrack(i));
393395
haveVideo = true;
394396

@@ -409,9 +411,9 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
409411
mStats.mTracks.push();
410412
TrackStat *stat =
411413
&mStats.mTracks.editItemAt(mStats.mVideoTrackIndex);
412-
stat->mMIME = mime;
414+
stat->mMIME = mime.string();
413415
}
414-
} else if (!haveAudio && !strncasecmp(mime, "audio/", 6)) {
416+
} else if (!haveAudio && !strncasecmp(mime.string(), "audio/", 6)) {
415417
setAudioSource(extractor->getTrack(i));
416418
haveAudio = true;
417419

@@ -421,10 +423,10 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
421423
mStats.mTracks.push();
422424
TrackStat *stat =
423425
&mStats.mTracks.editItemAt(mStats.mAudioTrackIndex);
424-
stat->mMIME = mime;
426+
stat->mMIME = mime.string();
425427
}
426428

427-
if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) {
429+
if (!strcasecmp(mime.string(), MEDIA_MIMETYPE_AUDIO_VORBIS)) {
428430
// Only do this for vorbis audio, none of the other audio
429431
// formats even support this ringtone specific hack and
430432
// retrieving the metadata on some extractors may turn out
@@ -436,7 +438,7 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
436438
modifyFlags(AUTO_LOOPING, SET);
437439
}
438440
}
439-
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP)) {
441+
} else if (!strcasecmp(mime.string(), MEDIA_MIMETYPE_TEXT_3GPP)) {
440442
addTextSource(extractor->getTrack(i));
441443
}
442444
}

0 commit comments

Comments
 (0)