diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-17 14:46:45 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-17 14:46:45 -0400 |
commit | 3065a3cad069b847165c99a38a251c072950d07f (patch) | |
tree | f72c5fd08f53ae31b48445028ed9d22af1ee505b /cmds | |
parent | c2912a662d984e2f23187fa31e7e71122d9472d9 (diff) | |
parent | 1a77b68e90537047da8249b742fa062375b4ea4e (diff) | |
download | frameworks_base-3065a3cad069b847165c99a38a251c072950d07f.zip frameworks_base-3065a3cad069b847165c99a38a251c072950d07f.tar.gz frameworks_base-3065a3cad069b847165c99a38a251c072950d07f.tar.bz2 |
Merge change 25528 into eclair
* changes:
Another stagefright test-case and ignore end-of-stream notifications while we're flushing.
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/stagefright/stagefright.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index 73215d3..5397a69 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -61,6 +61,66 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) { decoder->start(); + if (gReproduceBug == 3) { + status_t err; + MediaBuffer *buffer; + MediaSource::ReadOptions options; + int64_t seekTimeUs = -1; + for (;;) { + err = decoder->read(&buffer, &options); + options.clearSeekTo(); + + bool shouldSeek = false; + if (err != OK) { + printf("reached EOF.\n"); + + 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; + + bool failed = false; + if (seekTimeUs >= 0) { + int64_t diff = timestamp - seekTimeUs; + + if (diff > 500000) { + printf("ERROR: "); + failed = true; + } + } + + printf("buffer has timestamp %lld us (%.2f secs)\n", + timestamp, timestamp / 1E6); + + buffer->release(); + buffer = NULL; + + if (failed) { + break; + } + + shouldSeek = ((double)rand() / RAND_MAX) < 0.1; + shouldSeek = false; + } + + seekTimeUs = -1; + + if (shouldSeek) { + seekTimeUs = (rand() * 30E6) / RAND_MAX; + options.setSeekTo(seekTimeUs); + + printf("seeking to %lld us (%.2f secs)\n", + seekTimeUs, seekTimeUs / 1E6); + } + } + + decoder->stop(); + + return; + } + int n = 0; int64_t startTime = getNowUs(); |