Merge branch 'eclair' into eclair-release
This commit is contained in:
@@ -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, ×tampUnits));
|
||||
|
||||
int64_t timestampUs = ((int64_t)timestampUnits * 1000000) / timeScale;
|
||||
|
||||
bool failed = false;
|
||||
if (seekTimeUs >= 0) {
|
||||
int64_t diff = timestamp - seekTimeUs;
|
||||
|
||||
if (diff > 500000) {
|
||||
if (seekTimeUs >= 0) {
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -228,17 +228,17 @@ public class SimpleMesh extends BaseObj {
|
||||
mVtxData[mVtxCount++] = mB;
|
||||
mVtxData[mVtxCount++] = mA;
|
||||
}
|
||||
if ((mFlags & TEXTURE_0) != 0) {
|
||||
makeSpace(2);
|
||||
mVtxData[mVtxCount++] = mS0;
|
||||
mVtxData[mVtxCount++] = mT0;
|
||||
}
|
||||
if ((mFlags & NORMAL) != 0) {
|
||||
makeSpace(3);
|
||||
mVtxData[mVtxCount++] = mNX;
|
||||
mVtxData[mVtxCount++] = mNY;
|
||||
mVtxData[mVtxCount++] = mNZ;
|
||||
}
|
||||
if ((mFlags & TEXTURE_0) != 0) {
|
||||
makeSpace(2);
|
||||
mVtxData[mVtxCount++] = mS0;
|
||||
mVtxData[mVtxCount++] = mT0;
|
||||
}
|
||||
}
|
||||
|
||||
public void addVertex(float x, float y) {
|
||||
|
||||
@@ -309,6 +309,8 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase<Medi
|
||||
}
|
||||
|
||||
public boolean validateMemoryResult (int startPid, int startMemory, Writer output) throws Exception {
|
||||
//Wait for 10 seconds to make sure the memory settle.
|
||||
Thread.sleep(10000);
|
||||
mEndPid = getMediaserverPid();
|
||||
mEndMemory = getMediaserverVsize();
|
||||
Log.v(TAG, "End Memory " + mEndMemory);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<Medi
|
||||
private static final int NUMBER_OF_RANDOM_REPOSITION_AND_PLAY = 10;
|
||||
private static final int NUMBER_OF_RANDOM_REPOSITION_AND_PLAY_SHORT = 5;
|
||||
private static final int NUMBER_OF_STRESS_LOOPS = 500;
|
||||
private static final int PLAYBACK_END_TOLERANCE = 5000;
|
||||
private static final int PLAYBACK_END_TOLERANCE = 30000;
|
||||
private static final int WAIT_UNTIL_PLAYBACK_FINISH = 515000 ;
|
||||
|
||||
public MediaPlayerStressTest() {
|
||||
@@ -112,10 +112,11 @@ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<Medi
|
||||
if (random_no_of_seek == 0) {
|
||||
random_no_of_seek = 1;
|
||||
}
|
||||
// Random seek and play
|
||||
Log.v(TAG, "random_seek = " + random_no_of_seek);
|
||||
// Play for 10 seconds then random seekTo
|
||||
for (int j = 0; j < random_no_of_seek; j++) {
|
||||
random_play_time =
|
||||
generator.nextInt(video_duration / 2);
|
||||
generator.nextInt(video_duration / 100);
|
||||
Log.v(TAG, "Play time = " + random_play_time);
|
||||
Thread.sleep(random_play_time);
|
||||
random_seek_time =
|
||||
@@ -123,12 +124,13 @@ public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<Medi
|
||||
Log.v(TAG, "Seek time = " + random_seek_time);
|
||||
mp.seekTo(random_seek_time);
|
||||
}
|
||||
//wait until the movie finish and check the current position
|
||||
//Make sure the wait time is long enough
|
||||
long wait_until_playback_finish = video_duration - random_seek_time + PLAYBACK_END_TOLERANCE * 2;
|
||||
Thread.sleep(wait_until_playback_finish);
|
||||
//Seek to 10s from the end of the video
|
||||
mp.seekTo(video_duration - 10000);
|
||||
//After reposition, play 30 seconds the video should be finished.
|
||||
Thread.sleep(PLAYBACK_END_TOLERANCE);
|
||||
Log.v(TAG, "CurrentPosition = " + mp.getCurrentPosition());
|
||||
if ( mp.isPlaying() || mp.getCurrentPosition() > (video_duration + PLAYBACK_END_TOLERANCE)){
|
||||
if ( mp.isPlaying() || mp.getCurrentPosition()
|
||||
> (video_duration)){
|
||||
assertTrue("Current PlayTime greater than duration", false);
|
||||
}
|
||||
mp.release();
|
||||
|
||||
Reference in New Issue
Block a user