Loading include/media/stagefright/SurfaceMediaSource.h +2 −2 Original line number Diff line number Diff line Loading @@ -193,8 +193,8 @@ private: // Set to a default of 30 fps if not specified by the client side int32_t mFrameRate; // mStopped is a flag to check if the recording is going on bool mStopped; // mStarted is a flag to check if the recording is going on bool mStarted; // mNumFramesReceived indicates the number of frames recieved from // the client side Loading media/libstagefright/SurfaceMediaSource.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ SurfaceMediaSource::SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeig mNumPendingBuffers(0), mCurrentTimestamp(0), mFrameRate(30), mStopped(false), mStarted(false), mNumFramesReceived(0), mNumFramesEncoded(0), mFirstFrameTimestamp(0), Loading Loading @@ -80,7 +80,7 @@ SurfaceMediaSource::SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeig SurfaceMediaSource::~SurfaceMediaSource() { ALOGV("~SurfaceMediaSource"); CHECK(mStopped == true); CHECK(!mStarted); } nsecs_t SurfaceMediaSource::getTimestamp() { Loading Loading @@ -140,6 +140,8 @@ status_t SurfaceMediaSource::start(MetaData *params) Mutex::Autolock lock(mMutex); CHECK(!mStarted); mStartTimeNs = 0; int64_t startTimeUs; int32_t bufferCount = 0; Loading Loading @@ -171,6 +173,7 @@ status_t SurfaceMediaSource::start(MetaData *params) } mNumPendingBuffers = 0; mStarted = true; return OK; } Loading @@ -191,7 +194,7 @@ status_t SurfaceMediaSource::stop() ALOGV("stop"); Mutex::Autolock lock(mMutex); if (mStopped) { if (!mStarted) { return OK; } Loading @@ -208,7 +211,7 @@ status_t SurfaceMediaSource::stop() mMediaBuffersAvailableCondition.wait(mMutex); } mStopped = true; mStarted = false; mFrameAvailableCondition.signal(); mMediaBuffersAvailableCondition.signal(); Loading Loading @@ -270,7 +273,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, *buffer = NULL; while (!mStopped && mNumPendingBuffers == mMaxAcquiredBufferCount) { while (mStarted && mNumPendingBuffers == mMaxAcquiredBufferCount) { mMediaBuffersAvailableCondition.wait(mMutex); } Loading @@ -281,7 +284,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, BufferQueue::BufferItem item; // If the recording has started and the queue is empty, then just // wait here till the frames come in from the client side while (!mStopped) { while (mStarted) { status_t err = mBufferQueue->acquireBuffer(&item); if (err == BufferQueue::NO_BUFFER_AVAILABLE) { Loading Loading @@ -322,7 +325,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, // If the loop was exited as a result of stopping the recording, // it is OK if (mStopped) { if (!mStarted) { ALOGV("Read: SurfaceMediaSource is stopped. Returning ERROR_END_OF_STREAM."); return ERROR_END_OF_STREAM; } Loading Loading
include/media/stagefright/SurfaceMediaSource.h +2 −2 Original line number Diff line number Diff line Loading @@ -193,8 +193,8 @@ private: // Set to a default of 30 fps if not specified by the client side int32_t mFrameRate; // mStopped is a flag to check if the recording is going on bool mStopped; // mStarted is a flag to check if the recording is going on bool mStarted; // mNumFramesReceived indicates the number of frames recieved from // the client side Loading
media/libstagefright/SurfaceMediaSource.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ SurfaceMediaSource::SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeig mNumPendingBuffers(0), mCurrentTimestamp(0), mFrameRate(30), mStopped(false), mStarted(false), mNumFramesReceived(0), mNumFramesEncoded(0), mFirstFrameTimestamp(0), Loading Loading @@ -80,7 +80,7 @@ SurfaceMediaSource::SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeig SurfaceMediaSource::~SurfaceMediaSource() { ALOGV("~SurfaceMediaSource"); CHECK(mStopped == true); CHECK(!mStarted); } nsecs_t SurfaceMediaSource::getTimestamp() { Loading Loading @@ -140,6 +140,8 @@ status_t SurfaceMediaSource::start(MetaData *params) Mutex::Autolock lock(mMutex); CHECK(!mStarted); mStartTimeNs = 0; int64_t startTimeUs; int32_t bufferCount = 0; Loading Loading @@ -171,6 +173,7 @@ status_t SurfaceMediaSource::start(MetaData *params) } mNumPendingBuffers = 0; mStarted = true; return OK; } Loading @@ -191,7 +194,7 @@ status_t SurfaceMediaSource::stop() ALOGV("stop"); Mutex::Autolock lock(mMutex); if (mStopped) { if (!mStarted) { return OK; } Loading @@ -208,7 +211,7 @@ status_t SurfaceMediaSource::stop() mMediaBuffersAvailableCondition.wait(mMutex); } mStopped = true; mStarted = false; mFrameAvailableCondition.signal(); mMediaBuffersAvailableCondition.signal(); Loading Loading @@ -270,7 +273,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, *buffer = NULL; while (!mStopped && mNumPendingBuffers == mMaxAcquiredBufferCount) { while (mStarted && mNumPendingBuffers == mMaxAcquiredBufferCount) { mMediaBuffersAvailableCondition.wait(mMutex); } Loading @@ -281,7 +284,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, BufferQueue::BufferItem item; // If the recording has started and the queue is empty, then just // wait here till the frames come in from the client side while (!mStopped) { while (mStarted) { status_t err = mBufferQueue->acquireBuffer(&item); if (err == BufferQueue::NO_BUFFER_AVAILABLE) { Loading Loading @@ -322,7 +325,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, // If the loop was exited as a result of stopping the recording, // it is OK if (mStopped) { if (!mStarted) { ALOGV("Read: SurfaceMediaSource is stopped. Returning ERROR_END_OF_STREAM."); return ERROR_END_OF_STREAM; } Loading