Added a commandline option to "stagefright" that limits decoding to a maximum number of frames per iteration.
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 @@
MediaSource::ReadOptions options;
while (numIterationsLeft-- > 0) {
+ long numFrames = 0;
+
MediaBuffer *buffer;
for (;;) {
@@ -92,6 +95,11 @@
buffer->release();
buffer = NULL;
+
+ ++numFrames;
+ if (gMaxNumFrames > 0 && numFrames == gMaxNumFrames) {
+ break;
+ }
}
printf("$");
@@ -115,6 +123,7 @@
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 @@
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 @@
break;
}
+ case 'm':
case 'n':
{
char *end;
@@ -148,7 +159,11 @@
x = 1;
}
- gNumRepetitions = x;
+ if (res == 'n') {
+ gNumRepetitions = x;
+ } else {
+ gMaxNumFrames = x;
+ }
break;
}