am c27bff91: Merge change 22774 into eclair

Merge commit 'c27bff913a2c9c4a1f42b00951740cf139cb19ad' into eclair-plus-aosp

* commit 'c27bff913a2c9c4a1f42b00951740cf139cb19ad':
  Added a commandline option to "stagefright" that limits decoding to a maximum number of frames per iteration.
This commit is contained in:
Andreas Huber
2009-08-26 10:32:51 -07:00
committed by Android Git Automerger

View File

@@ -40,6 +40,7 @@
using namespace android; using namespace android;
static long gNumRepetitions; static long gNumRepetitions;
static long gMaxNumFrames; // 0 means decode all available.
static int64_t getNowUs() { static int64_t getNowUs() {
struct timeval tv; struct timeval tv;
@@ -74,6 +75,8 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
MediaSource::ReadOptions options; MediaSource::ReadOptions options;
while (numIterationsLeft-- > 0) { while (numIterationsLeft-- > 0) {
long numFrames = 0;
MediaBuffer *buffer; MediaBuffer *buffer;
for (;;) { for (;;) {
@@ -92,6 +95,11 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
buffer->release(); buffer->release();
buffer = NULL; buffer = NULL;
++numFrames;
if (gMaxNumFrames > 0 && numFrames == gMaxNumFrames) {
break;
}
} }
printf("$"); printf("$");
@@ -115,6 +123,7 @@ static void usage(const char *me) {
fprintf(stderr, " -a(udio)\n"); fprintf(stderr, " -a(udio)\n");
fprintf(stderr, " -n repetitions\n"); fprintf(stderr, " -n repetitions\n");
fprintf(stderr, " -l(ist) components\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) { int main(int argc, char **argv) {
@@ -123,9 +132,10 @@ int main(int argc, char **argv) {
bool audioOnly = false; bool audioOnly = false;
bool listComponents = false; bool listComponents = false;
gNumRepetitions = 1; gNumRepetitions = 1;
gMaxNumFrames = 0;
int res; int res;
while ((res = getopt(argc, argv, "han:l")) >= 0) { while ((res = getopt(argc, argv, "han:lm:")) >= 0) {
switch (res) { switch (res) {
case 'a': case 'a':
{ {
@@ -139,6 +149,7 @@ int main(int argc, char **argv) {
break; break;
} }
case 'm':
case 'n': case 'n':
{ {
char *end; char *end;
@@ -148,7 +159,11 @@ int main(int argc, char **argv) {
x = 1; x = 1;
} }
gNumRepetitions = x; if (res == 'n') {
gNumRepetitions = x;
} else {
gMaxNumFrames = x;
}
break; break;
} }