Loading media/libmediaplayerservice/StagefrightPlayer.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -72,16 +72,14 @@ status_t StagefrightPlayer::setDataSource(const sp<IStreamSource> &source) { status_t StagefrightPlayer::setVideoSurface(const sp<Surface> &surface) { LOGV("setVideoSurface"); mPlayer->setSurface(surface); return OK; return mPlayer->setSurface(surface); } status_t StagefrightPlayer::setVideoSurfaceTexture( const sp<ISurfaceTexture> &surfaceTexture) { LOGV("setVideoSurfaceTexture"); mPlayer->setSurfaceTexture(surfaceTexture); return OK; return mPlayer->setSurfaceTexture(surfaceTexture); } status_t StagefrightPlayer::prepare() { Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -316,9 +316,11 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { &cropLeft, &cropTop, &cropRight, &cropBottom)); LOGV("Video output format changed to %d x %d " "(crop: %d, %d, %d, %d)", "(crop: %d x %d @ (%d, %d))", width, height, cropLeft, cropTop, cropRight, cropBottom); (cropRight - cropLeft + 1), (cropBottom - cropTop + 1), cropLeft, cropTop); notifyListener( MEDIA_SET_VIDEO_SIZE, Loading media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +28 −17 Original line number Diff line number Diff line Loading @@ -395,12 +395,24 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) { postDrainVideoQueue(); } if (mSyncQueues && !mAudioQueue.empty() && !mVideoQueue.empty()) { 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; } int64_t firstAudioTimeUs; int64_t firstVideoTimeUs; CHECK((*mAudioQueue.begin()).mBuffer->meta() CHECK(firstAudioBuffer->meta() ->findInt64("timeUs", &firstAudioTimeUs)); CHECK((*mVideoQueue.begin()).mBuffer->meta() CHECK(firstVideoBuffer->meta() ->findInt64("timeUs", &firstVideoTimeUs)); int64_t diff = firstVideoTimeUs - firstAudioTimeUs; Loading @@ -418,7 +430,6 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) { syncQueuesDone(); } } void NuPlayer::Renderer::syncQueuesDone() { if (!mSyncQueues) { Loading media/libstagefright/ACodec.cpp +23 −3 Original line number Diff line number Diff line Loading @@ -1738,7 +1738,17 @@ ACodec::LoadedToIdleState::LoadedToIdleState(ACodec *codec) void ACodec::LoadedToIdleState::stateEntered() { LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str()); CHECK_EQ(allocateBuffers(), (status_t)OK); 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(); } } status_t ACodec::LoadedToIdleState::allocateBuffers() { Loading Loading @@ -2046,8 +2056,18 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent( mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput), (status_t)OK); CHECK_EQ(mCodec->allocateBuffersOnPort(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(); } return true; } else if (data1 == (OMX_U32)OMX_CommandPortEnable) { Loading media/libstagefright/AwesomePlayer.cpp +19 −8 Original line number Diff line number Diff line Loading @@ -1152,22 +1152,26 @@ bool AwesomePlayer::isPlaying() const { return (mFlags & PLAYING) || (mFlags & CACHE_UNDERRUN); } void AwesomePlayer::setSurface(const sp<Surface> &surface) { status_t AwesomePlayer::setSurface(const sp<Surface> &surface) { Mutex::Autolock autoLock(mLock); mSurface = surface; setNativeWindow_l(surface); return setNativeWindow_l(surface); } void AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) { status_t AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) { Mutex::Autolock autoLock(mLock); mSurface.clear(); status_t err; if (surfaceTexture != NULL) { setNativeWindow_l(new SurfaceTextureClient(surfaceTexture)); err = setNativeWindow_l(new SurfaceTextureClient(surfaceTexture)); } else { setNativeWindow_l(NULL); err = setNativeWindow_l(NULL); } return err; } void AwesomePlayer::shutdownVideoDecoder_l() { Loading @@ -1190,11 +1194,11 @@ void AwesomePlayer::shutdownVideoDecoder_l() { LOGI("video decoder shutdown completed"); } void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { mNativeWindow = native; if (mVideoSource == NULL) { return; return OK; } LOGI("attempting to reconfigure to use new surface"); Loading @@ -1206,7 +1210,12 @@ void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { shutdownVideoDecoder_l(); CHECK_EQ(initVideoDecoder(), (status_t)OK); status_t err = initVideoDecoder(); if (err != OK) { LOGE("failed to reinstantiate video decoder after surface change."); return err; } if (mLastVideoTimeUs >= 0) { mSeeking = SEEK; Loading @@ -1217,6 +1226,8 @@ void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { if (wasPlaying) { play_l(); } return OK; } void AwesomePlayer::setAudioSink( Loading Loading
media/libmediaplayerservice/StagefrightPlayer.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -72,16 +72,14 @@ status_t StagefrightPlayer::setDataSource(const sp<IStreamSource> &source) { status_t StagefrightPlayer::setVideoSurface(const sp<Surface> &surface) { LOGV("setVideoSurface"); mPlayer->setSurface(surface); return OK; return mPlayer->setSurface(surface); } status_t StagefrightPlayer::setVideoSurfaceTexture( const sp<ISurfaceTexture> &surfaceTexture) { LOGV("setVideoSurfaceTexture"); mPlayer->setSurfaceTexture(surfaceTexture); return OK; return mPlayer->setSurfaceTexture(surfaceTexture); } status_t StagefrightPlayer::prepare() { Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -316,9 +316,11 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { &cropLeft, &cropTop, &cropRight, &cropBottom)); LOGV("Video output format changed to %d x %d " "(crop: %d, %d, %d, %d)", "(crop: %d x %d @ (%d, %d))", width, height, cropLeft, cropTop, cropRight, cropBottom); (cropRight - cropLeft + 1), (cropBottom - cropTop + 1), cropLeft, cropTop); notifyListener( MEDIA_SET_VIDEO_SIZE, Loading
media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +28 −17 Original line number Diff line number Diff line Loading @@ -395,12 +395,24 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) { postDrainVideoQueue(); } if (mSyncQueues && !mAudioQueue.empty() && !mVideoQueue.empty()) { 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; } int64_t firstAudioTimeUs; int64_t firstVideoTimeUs; CHECK((*mAudioQueue.begin()).mBuffer->meta() CHECK(firstAudioBuffer->meta() ->findInt64("timeUs", &firstAudioTimeUs)); CHECK((*mVideoQueue.begin()).mBuffer->meta() CHECK(firstVideoBuffer->meta() ->findInt64("timeUs", &firstVideoTimeUs)); int64_t diff = firstVideoTimeUs - firstAudioTimeUs; Loading @@ -418,7 +430,6 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) { syncQueuesDone(); } } void NuPlayer::Renderer::syncQueuesDone() { if (!mSyncQueues) { Loading
media/libstagefright/ACodec.cpp +23 −3 Original line number Diff line number Diff line Loading @@ -1738,7 +1738,17 @@ ACodec::LoadedToIdleState::LoadedToIdleState(ACodec *codec) void ACodec::LoadedToIdleState::stateEntered() { LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str()); CHECK_EQ(allocateBuffers(), (status_t)OK); 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(); } } status_t ACodec::LoadedToIdleState::allocateBuffers() { Loading Loading @@ -2046,8 +2056,18 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent( mCodec->mNode, OMX_CommandPortEnable, kPortIndexOutput), (status_t)OK); CHECK_EQ(mCodec->allocateBuffersOnPort(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(); } return true; } else if (data1 == (OMX_U32)OMX_CommandPortEnable) { Loading
media/libstagefright/AwesomePlayer.cpp +19 −8 Original line number Diff line number Diff line Loading @@ -1152,22 +1152,26 @@ bool AwesomePlayer::isPlaying() const { return (mFlags & PLAYING) || (mFlags & CACHE_UNDERRUN); } void AwesomePlayer::setSurface(const sp<Surface> &surface) { status_t AwesomePlayer::setSurface(const sp<Surface> &surface) { Mutex::Autolock autoLock(mLock); mSurface = surface; setNativeWindow_l(surface); return setNativeWindow_l(surface); } void AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) { status_t AwesomePlayer::setSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) { Mutex::Autolock autoLock(mLock); mSurface.clear(); status_t err; if (surfaceTexture != NULL) { setNativeWindow_l(new SurfaceTextureClient(surfaceTexture)); err = setNativeWindow_l(new SurfaceTextureClient(surfaceTexture)); } else { setNativeWindow_l(NULL); err = setNativeWindow_l(NULL); } return err; } void AwesomePlayer::shutdownVideoDecoder_l() { Loading @@ -1190,11 +1194,11 @@ void AwesomePlayer::shutdownVideoDecoder_l() { LOGI("video decoder shutdown completed"); } void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { mNativeWindow = native; if (mVideoSource == NULL) { return; return OK; } LOGI("attempting to reconfigure to use new surface"); Loading @@ -1206,7 +1210,12 @@ void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { shutdownVideoDecoder_l(); CHECK_EQ(initVideoDecoder(), (status_t)OK); status_t err = initVideoDecoder(); if (err != OK) { LOGE("failed to reinstantiate video decoder after surface change."); return err; } if (mLastVideoTimeUs >= 0) { mSeeking = SEEK; Loading @@ -1217,6 +1226,8 @@ void AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) { if (wasPlaying) { play_l(); } return OK; } void AwesomePlayer::setAudioSink( Loading