summaryrefslogtreecommitdiffstats
path: root/cmds/stagefright/stagefright.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2009-08-26 10:11:50 -0700
committerAndreas Huber <andih@google.com>2009-08-26 10:11:50 -0700
commit38b610fe53bb27946826d3f175f6fbe613f270da (patch)
tree1a3a551d870a5390cb3f7a9d7dcaf17db787f8c7 /cmds/stagefright/stagefright.cpp
parentea7d15629752256f6ea1d5c6ea796e59aefd030f (diff)
downloadframeworks_av-38b610fe53bb27946826d3f175f6fbe613f270da.zip
frameworks_av-38b610fe53bb27946826d3f175f6fbe613f270da.tar.gz
frameworks_av-38b610fe53bb27946826d3f175f6fbe613f270da.tar.bz2
Added a commandline option to "stagefright" that limits decoding to a maximum number of frames per iteration.
Diffstat (limited to 'cmds/stagefright/stagefright.cpp')
-rw-r--r--cmds/stagefright/stagefright.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 6b2d8ad..ac6fb36 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -40,6 +40,7 @@
using namespace android;
static long gNumRepetitions;
+static long gMaxNumFrames; // 0 means decode all available.
static int64_t getNowUs() {
struct timeval tv;
@@ -74,6 +75,8 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
MediaSource::ReadOptions options;
while (numIterationsLeft-- > 0) {
+ long numFrames = 0;
+
MediaBuffer *buffer;
for (;;) {
@@ -92,6 +95,11 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
buffer->release();
buffer = NULL;
+
+ ++numFrames;
+ if (gMaxNumFrames > 0 && numFrames == gMaxNumFrames) {
+ break;
+ }
}
printf("$");
@@ -115,6 +123,7 @@ static void usage(const char *me) {
fprintf(stderr, " -a(udio)\n");
fprintf(stderr, " -n repetitions\n");
fprintf(stderr, " -l(ist) components\n");
+ fprintf(stderr, " -m max-number-of-frames-to-decode in each pass\n");
}
int main(int argc, char **argv) {
@@ -123,9 +132,10 @@ int main(int argc, char **argv) {
bool audioOnly = false;
bool listComponents = false;
gNumRepetitions = 1;
+ gMaxNumFrames = 0;
int res;
- while ((res = getopt(argc, argv, "han:l")) >= 0) {
+ while ((res = getopt(argc, argv, "han:lm:")) >= 0) {
switch (res) {
case 'a':
{
@@ -139,6 +149,7 @@ int main(int argc, char **argv) {
break;
}
+ case 'm':
case 'n':
{
char *end;
@@ -148,7 +159,11 @@ int main(int argc, char **argv) {
x = 1;
}
- gNumRepetitions = x;
+ if (res == 'n') {
+ gNumRepetitions = x;
+ } else {
+ gMaxNumFrames = x;
+ }
break;
}