summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-10-16 18:13:19 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-10-16 18:13:19 -0400
commita3b28504ad5e5d1a6265d385031f2aaba01cec76 (patch)
treed35cf310274dee42fdc15af5ea32fc37db403403
parent7b9d6a92534fd712c465b5ffcc4e7631f0147c1c (diff)
parentaf6757c1de099b5352a52b8ed4a67af40f49fc78 (diff)
downloadframeworks_av-a3b28504ad5e5d1a6265d385031f2aaba01cec76.zip
frameworks_av-a3b28504ad5e5d1a6265d385031f2aaba01cec76.tar.gz
frameworks_av-a3b28504ad5e5d1a6265d385031f2aaba01cec76.tar.bz2
Merge change I11ebbfd9 into eclair
* changes: A few more testcases for the vendor to reproduce issues with their decoder. Not part of the shipping image.
-rw-r--r--cmds/stagefright/stagefright.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 5397a69..f8bb3c8 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -52,6 +52,13 @@ static int64_t getNowUs() {
static void playSource(OMXClient *client, const sp<MediaSource> &source) {
sp<MetaData> meta = source->getFormat();
+ int32_t durationUnits;
+ int32_t timeScale;
+ CHECK(meta->findInt32(kKeyDuration, &durationUnits));
+ CHECK(meta->findInt32(kKeyTimeScale, &timeScale));
+
+ int64_t durationUs = ((int64_t)durationUnits * 1000000) / timeScale;
+
sp<OMXCodec> decoder = OMXCodec::Create(
client->interface(), meta, false /* createEncoder */, source);
@@ -61,7 +68,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
decoder->start();
- if (gReproduceBug == 3) {
+ if (gReproduceBug >= 3 && gReproduceBug <= 5) {
status_t err;
MediaBuffer *buffer;
MediaSource::ReadOptions options;
@@ -76,23 +83,31 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
shouldSeek = true;
} else {
- int32_t units, scale;
- CHECK(buffer->meta_data()->findInt32(kKeyTimeUnits, &units));
- CHECK(buffer->meta_data()->findInt32(kKeyTimeScale, &scale));
- int64_t timestamp = ((OMX_TICKS)units * 1000000) / scale;
+ int32_t timestampUnits;
+ CHECK(buffer->meta_data()->findInt32(kKeyTimeUnits, &timestampUnits));
+
+ int64_t timestampUs = ((int64_t)timestampUnits * 1000000) / timeScale;
bool failed = false;
+
if (seekTimeUs >= 0) {
- int64_t diff = timestamp - seekTimeUs;
+ int64_t diff = timestampUs - seekTimeUs;
+ if (diff < 0) {
+ diff = -diff;
+ }
+
+ if ((gReproduceBug == 4 && diff > 500000)
+ || (gReproduceBug == 5 && timestampUs < 0)) {
+ printf("wanted: %.2f secs, got: %.2f secs\n",
+ seekTimeUs / 1E6, timestampUs / 1E6);
- if (diff > 500000) {
printf("ERROR: ");
failed = true;
}
}
printf("buffer has timestamp %lld us (%.2f secs)\n",
- timestamp, timestamp / 1E6);
+ timestampUs, timestampUs / 1E6);
buffer->release();
buffer = NULL;
@@ -102,13 +117,16 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
}
shouldSeek = ((double)rand() / RAND_MAX) < 0.1;
- shouldSeek = false;
+
+ if (gReproduceBug == 3) {
+ shouldSeek = false;
+ }
}
seekTimeUs = -1;
if (shouldSeek) {
- seekTimeUs = (rand() * 30E6) / RAND_MAX;
+ seekTimeUs = (rand() * (float)durationUs) / RAND_MAX;
options.setSeekTo(seekTimeUs);
printf("seeking to %lld us (%.2f secs)\n",
@@ -138,6 +156,7 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
if (err != OK) {
CHECK_EQ(buffer, NULL);
+
break;
}