summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorThe Android Automerger <android-build@android.com>2011-08-30 12:45:34 -0700
committerThe Android Automerger <android-build@android.com>2011-08-30 12:45:34 -0700
commit514166986238c99e32995af204160b9d58805dc6 (patch)
tree3dce6ee437fc2372ff1d1787d2bd7b6dbfd3bea9 /media
parent04170bc2cf9d543b0ca6b87d24b2a256bf08e4d0 (diff)
downloadframeworks_av-514166986238c99e32995af204160b9d58805dc6.zip
frameworks_av-514166986238c99e32995af204160b9d58805dc6.tar.gz
frameworks_av-514166986238c99e32995af204160b9d58805dc6.tar.bz2
merge in ics-release history after reset to master
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/StagefrightPlayer.cpp6
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp6
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp45
-rw-r--r--media/libstagefright/ACodec.cpp26
-rw-r--r--media/libstagefright/AwesomePlayer.cpp27
-rw-r--r--media/libstagefright/include/AwesomePlayer.h6
6 files changed, 37 insertions, 79 deletions
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index cd4b1ef..40e055c 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -72,14 +72,16 @@ status_t StagefrightPlayer::setDataSource(const sp<IStreamSource> &source) {
status_t StagefrightPlayer::setVideoSurface(const sp<Surface> &surface) {
LOGV("setVideoSurface");
- return mPlayer->setSurface(surface);
+ mPlayer->setSurface(surface);
+ return OK;
}
status_t StagefrightPlayer::setVideoSurfaceTexture(
const sp<ISurfaceTexture> &surfaceTexture) {
LOGV("setVideoSurfaceTexture");
- return mPlayer->setSurfaceTexture(surfaceTexture);
+ mPlayer->setSurfaceTexture(surfaceTexture);
+ return OK;
}
status_t StagefrightPlayer::prepare() {
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 1f08a91..7fb141a 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -316,11 +316,9 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
&cropLeft, &cropTop, &cropRight, &cropBottom));
LOGV("Video output format changed to %d x %d "
- "(crop: %d x %d @ (%d, %d))",
+ "(crop: %d, %d, %d, %d)",
width, height,
- (cropRight - cropLeft + 1),
- (cropBottom - cropTop + 1),
- cropLeft, cropTop);
+ cropLeft, cropTop, cropRight, cropBottom);
notifyListener(
MEDIA_SET_VIDEO_SIZE,
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 8f213da..35ed43f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -395,40 +395,29 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) {
postDrainVideoQueue();
}
- if (!mSyncQueues || mAudioQueue.empty() || mVideoQueue.empty()) {
- return;
- }
-
- sp<ABuffer> firstAudioBuffer = (*mAudioQueue.begin()).mBuffer;
- sp<ABuffer> firstVideoBuffer = (*mVideoQueue.begin()).mBuffer;
-
- if (firstAudioBuffer == NULL || firstVideoBuffer == NULL) {
- // EOS signalled on either queue.
- syncQueuesDone();
- return;
- }
+ if (mSyncQueues && !mAudioQueue.empty() && !mVideoQueue.empty()) {
+ int64_t firstAudioTimeUs;
+ int64_t firstVideoTimeUs;
+ CHECK((*mAudioQueue.begin()).mBuffer->meta()
+ ->findInt64("timeUs", &firstAudioTimeUs));
+ CHECK((*mVideoQueue.begin()).mBuffer->meta()
+ ->findInt64("timeUs", &firstVideoTimeUs));
- int64_t firstAudioTimeUs;
- int64_t firstVideoTimeUs;
- CHECK(firstAudioBuffer->meta()
- ->findInt64("timeUs", &firstAudioTimeUs));
- CHECK(firstVideoBuffer->meta()
- ->findInt64("timeUs", &firstVideoTimeUs));
+ int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
- int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
+ LOGV("queueDiff = %.2f secs", diff / 1E6);
- LOGV("queueDiff = %.2f secs", diff / 1E6);
+ if (diff > 100000ll) {
+ // Audio data starts More than 0.1 secs before video.
+ // Drop some audio.
- if (diff > 100000ll) {
- // Audio data starts More than 0.1 secs before video.
- // Drop some audio.
+ (*mAudioQueue.begin()).mNotifyConsumed->post();
+ mAudioQueue.erase(mAudioQueue.begin());
+ return;
+ }
- (*mAudioQueue.begin()).mNotifyConsumed->post();
- mAudioQueue.erase(mAudioQueue.begin());
- return;
+ syncQueuesDone();
}
-
- syncQueuesDone();
}
void NuPlayer::Renderer::syncQueuesDone() {
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index e9dc61c..5d91f6a 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1738,17 +1738,7 @@ ACodec::LoadedToIdleState::LoadedToIdleState(ACodec *codec)
void ACodec::LoadedToIdleState::stateEntered() {
LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
- status_t err;
- if ((err = allocateBuffers()) != OK) {
- LOGE("Failed to allocate buffers after transitioning to IDLE state "
- "(error 0x%08x)",
- err);
-
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorUndefined);
- notify->post();
- }
+ CHECK_EQ(allocateBuffers(), (status_t)OK);
}
status_t ACodec::LoadedToIdleState::allocateBuffers() {
@@ -2056,18 +2046,8 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(
mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput),
(status_t)OK);
- status_t err;
- if ((err = mCodec->allocateBuffersOnPort(
- kPortIndexOutput)) != OK) {
- LOGE("Failed to allocate output port buffers after "
- "port reconfiguration (error 0x%08x)",
- err);
-
- sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
- notify->setInt32("omx-error", OMX_ErrorUndefined);
- notify->post();
- }
+ CHECK_EQ(mCodec->allocateBuffersOnPort(kPortIndexOutput),
+ (status_t)OK);
return true;
} else if (data1 == (OMX_U32)OMX_CommandPortEnable) {
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 142dda0..bc42a42 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1152,26 +1152,22 @@ bool AwesomePlayer::isPlaying() const {
return (mFlags & PLAYING) || (mFlags & CACHE_UNDERRUN);
}
-status_t AwesomePlayer::setSurface(const sp<Surface> &surface) {
+void AwesomePlayer::setSurface(const sp<Surface> &surface) {
Mutex::Autolock autoLock(mLock);
mSurface = surface;
- return setNativeWindow_l(surface);
+ setNativeWindow_l(surface);
}
-status_t AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {
+void AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {
Mutex::Autolock autoLock(mLock);
mSurface.clear();
-
- status_t err;
if (surfaceTexture != NULL) {
- err = setNativeWindow_l(new SurfaceTextureClient(surfaceTexture));
+ setNativeWindow_l(new SurfaceTextureClient(surfaceTexture));
} else {
- err = setNativeWindow_l(NULL);
+ setNativeWindow_l(NULL);
}
-
- return err;
}
void AwesomePlayer::shutdownVideoDecoder_l() {
@@ -1194,11 +1190,11 @@ void AwesomePlayer::shutdownVideoDecoder_l() {
LOGI("video decoder shutdown completed");
}
-status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
+void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
mNativeWindow = native;
if (mVideoSource == NULL) {
- return OK;
+ return;
}
LOGI("attempting to reconfigure to use new surface");
@@ -1210,12 +1206,7 @@ status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
shutdownVideoDecoder_l();
- status_t err = initVideoDecoder();
-
- if (err != OK) {
- LOGE("failed to reinstantiate video decoder after surface change.");
- return err;
- }
+ CHECK_EQ(initVideoDecoder(), (status_t)OK);
if (mLastVideoTimeUs >= 0) {
mSeeking = SEEK;
@@ -1226,8 +1217,6 @@ status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
if (wasPlaying) {
play_l();
}
-
- return OK;
}
void AwesomePlayer::setAudioSink(
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 24cf77c..14476d3 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -84,8 +84,8 @@ struct AwesomePlayer {
bool isPlaying() const;
- status_t setSurface(const sp<Surface> &surface);
- status_t setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture);
+ void setSurface(const sp<Surface> &surface);
+ void setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture);
void setAudioSink(const sp<MediaPlayerBase::AudioSink> &audioSink);
status_t setLooping(bool shouldLoop);
@@ -298,7 +298,7 @@ private:
void postAudioSeekComplete_l();
void shutdownVideoDecoder_l();
- status_t setNativeWindow_l(const sp<ANativeWindow> &native);
+ void setNativeWindow_l(const sp<ANativeWindow> &native);
bool isStreamingHTTP() const;
void sendCacheStats();