Loading media/libmediaplayerservice/nuplayer/GenericSource.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -192,9 +192,26 @@ status_t NuPlayer::GenericSource::setBuffers( } NuPlayer::GenericSource::~GenericSource() { if (mLooper != NULL) { mLooper->unregisterHandler(id()); mLooper->stop(); } } void NuPlayer::GenericSource::prepareAsync() { if (mLooper == NULL) { mLooper = new ALooper; mLooper->setName("generic"); mLooper->start(); mLooper->registerHandler(this); } sp<AMessage> msg = new AMessage(kWhatPrepareAsync, id()); msg->post(); } void NuPlayer::GenericSource::onPrepareAsync() { // delayed data source creation AString sniffedMIME; sp<DataSource> dataSource; Loading Loading @@ -267,6 +284,11 @@ status_t NuPlayer::GenericSource::feedMoreTSData() { void NuPlayer::GenericSource::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatPrepareAsync: { onPrepareAsync(); break; } case kWhatFetchSubtitleData: { fetchTextData(kWhatSendSubtitleData, MEDIA_TRACK_TYPE_SUBTITLE, Loading media/libmediaplayerservice/nuplayer/GenericSource.h +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ protected: private: enum { kWhatPrepareAsync, kWhatFetchSubtitleData, kWhatFetchTimedTextData, kWhatSendSubtitleData, Loading Loading @@ -104,12 +105,17 @@ private: int64_t mOffset; int64_t mLength; sp<ALooper> mLooper; void resetDataSource(); status_t initFromDataSource( const sp<DataSource> &dataSource, const char *mime); void onPrepareAsync(); void fetchTextData( uint32_t what, media_track_type type, int32_t curGen, sp<AnotherPacketSource> packets, sp<AMessage> msg); Loading media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -62,18 +62,25 @@ NuPlayer::HTTPLiveSource::HTTPLiveSource( NuPlayer::HTTPLiveSource::~HTTPLiveSource() { if (mLiveSession != NULL) { mLiveSession->disconnect(); mLiveSession.clear(); mLiveLooper->unregisterHandler(mLiveSession->id()); mLiveLooper->unregisterHandler(id()); mLiveLooper->stop(); mLiveSession.clear(); mLiveLooper.clear(); } } void NuPlayer::HTTPLiveSource::prepareAsync() { if (mLiveLooper == NULL) { mLiveLooper = new ALooper; mLiveLooper->setName("http live"); mLiveLooper->start(); mLiveLooper->registerHandler(this); } sp<AMessage> notify = new AMessage(kWhatSessionNotify, id()); mLiveSession = new LiveSession( Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +0 −10 Original line number Diff line number Diff line Loading @@ -373,7 +373,6 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { CHECK(msg->findObject("source", &obj)); if (obj != NULL) { mSource = static_cast<Source *>(obj.get()); looper()->registerHandler(mSource); } else { err = UNKNOWN_ERROR; } Loading Loading @@ -1707,8 +1706,6 @@ void NuPlayer::performReset() { if (mSource != NULL) { mSource->stop(); looper()->unregisterHandler(mSource->id()); mSource.clear(); } Loading Loading @@ -1741,13 +1738,6 @@ void NuPlayer::performSetSurface(const sp<NativeWindowWrapper> &wrapper) { // XXX - ignore error from setVideoScalingMode for now setVideoScalingMode(mVideoScalingMode); if (mDriver != NULL) { sp<NuPlayerDriver> driver = mDriver.promote(); if (driver != NULL) { driver->notifySetSurfaceComplete(); } } } void NuPlayer::onSourceNotify(const sp<AMessage> &msg) { Loading media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +0 −20 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ NuPlayerDriver::NuPlayerDriver() : mState(STATE_IDLE), mIsAsyncPrepare(false), mAsyncResult(UNKNOWN_ERROR), mSetSurfaceInProgress(false), mDurationUs(-1), mPositionUs(-1), mNumFramesTotal(0), Loading Loading @@ -135,10 +134,6 @@ status_t NuPlayerDriver::setVideoSurfaceTexture( const sp<IGraphicBufferProducer> &bufferProducer) { Mutex::Autolock autoLock(mLock); if (mSetSurfaceInProgress) { return INVALID_OPERATION; } switch (mState) { case STATE_SET_DATASOURCE_PENDING: case STATE_RESET_IN_PROGRESS: Loading @@ -148,14 +143,8 @@ status_t NuPlayerDriver::setVideoSurfaceTexture( break; } mSetSurfaceInProgress = true; mPlayer->setVideoSurfaceTextureAsync(bufferProducer); while (mSetSurfaceInProgress) { mCondition.wait(mLock); } return OK; } Loading Loading @@ -483,15 +472,6 @@ void NuPlayerDriver::notifyResetComplete() { mCondition.broadcast(); } void NuPlayerDriver::notifySetSurfaceComplete() { Mutex::Autolock autoLock(mLock); CHECK(mSetSurfaceInProgress); mSetSurfaceInProgress = false; mCondition.broadcast(); } void NuPlayerDriver::notifyDuration(int64_t durationUs) { Mutex::Autolock autoLock(mLock); mDurationUs = durationUs; Loading Loading
media/libmediaplayerservice/nuplayer/GenericSource.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -192,9 +192,26 @@ status_t NuPlayer::GenericSource::setBuffers( } NuPlayer::GenericSource::~GenericSource() { if (mLooper != NULL) { mLooper->unregisterHandler(id()); mLooper->stop(); } } void NuPlayer::GenericSource::prepareAsync() { if (mLooper == NULL) { mLooper = new ALooper; mLooper->setName("generic"); mLooper->start(); mLooper->registerHandler(this); } sp<AMessage> msg = new AMessage(kWhatPrepareAsync, id()); msg->post(); } void NuPlayer::GenericSource::onPrepareAsync() { // delayed data source creation AString sniffedMIME; sp<DataSource> dataSource; Loading Loading @@ -267,6 +284,11 @@ status_t NuPlayer::GenericSource::feedMoreTSData() { void NuPlayer::GenericSource::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatPrepareAsync: { onPrepareAsync(); break; } case kWhatFetchSubtitleData: { fetchTextData(kWhatSendSubtitleData, MEDIA_TRACK_TYPE_SUBTITLE, Loading
media/libmediaplayerservice/nuplayer/GenericSource.h +6 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ protected: private: enum { kWhatPrepareAsync, kWhatFetchSubtitleData, kWhatFetchTimedTextData, kWhatSendSubtitleData, Loading Loading @@ -104,12 +105,17 @@ private: int64_t mOffset; int64_t mLength; sp<ALooper> mLooper; void resetDataSource(); status_t initFromDataSource( const sp<DataSource> &dataSource, const char *mime); void onPrepareAsync(); void fetchTextData( uint32_t what, media_track_type type, int32_t curGen, sp<AnotherPacketSource> packets, sp<AMessage> msg); Loading
media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -62,18 +62,25 @@ NuPlayer::HTTPLiveSource::HTTPLiveSource( NuPlayer::HTTPLiveSource::~HTTPLiveSource() { if (mLiveSession != NULL) { mLiveSession->disconnect(); mLiveSession.clear(); mLiveLooper->unregisterHandler(mLiveSession->id()); mLiveLooper->unregisterHandler(id()); mLiveLooper->stop(); mLiveSession.clear(); mLiveLooper.clear(); } } void NuPlayer::HTTPLiveSource::prepareAsync() { if (mLiveLooper == NULL) { mLiveLooper = new ALooper; mLiveLooper->setName("http live"); mLiveLooper->start(); mLiveLooper->registerHandler(this); } sp<AMessage> notify = new AMessage(kWhatSessionNotify, id()); mLiveSession = new LiveSession( Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +0 −10 Original line number Diff line number Diff line Loading @@ -373,7 +373,6 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { CHECK(msg->findObject("source", &obj)); if (obj != NULL) { mSource = static_cast<Source *>(obj.get()); looper()->registerHandler(mSource); } else { err = UNKNOWN_ERROR; } Loading Loading @@ -1707,8 +1706,6 @@ void NuPlayer::performReset() { if (mSource != NULL) { mSource->stop(); looper()->unregisterHandler(mSource->id()); mSource.clear(); } Loading Loading @@ -1741,13 +1738,6 @@ void NuPlayer::performSetSurface(const sp<NativeWindowWrapper> &wrapper) { // XXX - ignore error from setVideoScalingMode for now setVideoScalingMode(mVideoScalingMode); if (mDriver != NULL) { sp<NuPlayerDriver> driver = mDriver.promote(); if (driver != NULL) { driver->notifySetSurfaceComplete(); } } } void NuPlayer::onSourceNotify(const sp<AMessage> &msg) { Loading
media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +0 −20 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ NuPlayerDriver::NuPlayerDriver() : mState(STATE_IDLE), mIsAsyncPrepare(false), mAsyncResult(UNKNOWN_ERROR), mSetSurfaceInProgress(false), mDurationUs(-1), mPositionUs(-1), mNumFramesTotal(0), Loading Loading @@ -135,10 +134,6 @@ status_t NuPlayerDriver::setVideoSurfaceTexture( const sp<IGraphicBufferProducer> &bufferProducer) { Mutex::Autolock autoLock(mLock); if (mSetSurfaceInProgress) { return INVALID_OPERATION; } switch (mState) { case STATE_SET_DATASOURCE_PENDING: case STATE_RESET_IN_PROGRESS: Loading @@ -148,14 +143,8 @@ status_t NuPlayerDriver::setVideoSurfaceTexture( break; } mSetSurfaceInProgress = true; mPlayer->setVideoSurfaceTextureAsync(bufferProducer); while (mSetSurfaceInProgress) { mCondition.wait(mLock); } return OK; } Loading Loading @@ -483,15 +472,6 @@ void NuPlayerDriver::notifyResetComplete() { mCondition.broadcast(); } void NuPlayerDriver::notifySetSurfaceComplete() { Mutex::Autolock autoLock(mLock); CHECK(mSetSurfaceInProgress); mSetSurfaceInProgress = false; mCondition.broadcast(); } void NuPlayerDriver::notifyDuration(int64_t durationUs) { Mutex::Autolock autoLock(mLock); mDurationUs = durationUs; Loading