Loading include/media/stagefright/CameraSource.h +3 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,9 @@ protected: bool mStarted; int32_t mNumFramesEncoded; // Time between capture of two frames. int64_t mTimeBetweenFrameCaptureUs; CameraSource(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy, int32_t cameraId, Size videoSize, int32_t frameRate, Loading include/media/stagefright/CameraSourceTimeLapse.h +0 −4 Original line number Diff line number Diff line Loading @@ -57,10 +57,6 @@ private: int32_t mVideoWidth; int32_t mVideoHeight; // Time between capture of two frames during time lapse recording // Negative value indicates that timelapse is disabled. int64_t mTimeBetweenTimeLapseFrameCaptureUs; // Time between two frames in final video (1/frameRate) int64_t mTimeBetweenTimeLapseVideoFramesUs; Loading media/libstagefright/CameraSource.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ namespace android { static const int64_t CAMERA_SOURCE_TIMEOUT_NS = 3000000000LL; struct CameraSourceListener : public CameraListener { CameraSourceListener(const sp<CameraSource> &source); Loading Loading @@ -156,6 +158,7 @@ CameraSource::CameraSource( mLastFrameTimestampUs(0), mStarted(false), mNumFramesEncoded(0), mTimeBetweenFrameCaptureUs(0), mFirstFrameTimeUs(0), mNumFramesDropped(0), mNumGlitches(0), Loading Loading @@ -644,7 +647,8 @@ status_t CameraSource::stop() { releaseQueuedFrames(); while (!mFramesBeingEncoded.empty()) { if (NO_ERROR != mFrameCompleteCondition.waitRelative(mLock, 3000000000LL)) { mFrameCompleteCondition.waitRelative(mLock, mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) { LOGW("Timed out waiting for outstanding frames being encoded: %d", mFramesBeingEncoded.size()); } Loading Loading @@ -736,7 +740,8 @@ status_t CameraSource::read( Mutex::Autolock autoLock(mLock); while (mStarted && mFramesReceived.empty()) { if (NO_ERROR != mFrameAvailableCondition.waitRelative(mLock, 1000000000LL)) { mFrameAvailableCondition.waitRelative(mLock, mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) { if (mCameraRecordingProxy != 0 && !mCameraRecordingProxy->asBinder()->isBinderAlive()) { LOGW("camera recording proxy is gone"); Loading media/libstagefright/CameraSourceTimeLapse.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -39,12 +39,12 @@ CameraSourceTimeLapse *CameraSourceTimeLapse::CreateFromCamera( Size videoSize, int32_t videoFrameRate, const sp<Surface>& surface, int64_t timeBetweenTimeLapseFrameCaptureUs) { int64_t timeBetweenFrameCaptureUs) { CameraSourceTimeLapse *source = new CameraSourceTimeLapse(camera, proxy, cameraId, videoSize, videoFrameRate, surface, timeBetweenTimeLapseFrameCaptureUs); timeBetweenFrameCaptureUs); if (source != NULL) { if (source->initCheck() != OK) { Loading @@ -62,15 +62,15 @@ CameraSourceTimeLapse::CameraSourceTimeLapse( Size videoSize, int32_t videoFrameRate, const sp<Surface>& surface, int64_t timeBetweenTimeLapseFrameCaptureUs) int64_t timeBetweenFrameCaptureUs) : CameraSource(camera, proxy, cameraId, videoSize, videoFrameRate, surface, true), mTimeBetweenTimeLapseFrameCaptureUs(timeBetweenTimeLapseFrameCaptureUs), mTimeBetweenTimeLapseVideoFramesUs(1E6/videoFrameRate), mLastTimeLapseFrameRealTimestampUs(0), mSkipCurrentFrame(false) { mTimeBetweenFrameCaptureUs = timeBetweenFrameCaptureUs; LOGD("starting time lapse mode: %lld us", mTimeBetweenTimeLapseFrameCaptureUs); mTimeBetweenFrameCaptureUs); mVideoWidth = videoSize.width; mVideoHeight = videoSize.height; Loading Loading @@ -271,14 +271,14 @@ bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) { // The first 2 output frames from the encoder are: decoder specific info and // the compressed video frame data for the first input video frame. if (mNumFramesEncoded >= 1 && *timestampUs < (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenTimeLapseFrameCaptureUs)) { (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenFrameCaptureUs)) { // Skip all frames from last encoded frame until // sufficient time (mTimeBetweenTimeLapseFrameCaptureUs) has passed. // sufficient time (mTimeBetweenFrameCaptureUs) has passed. // Tell the camera to release its recording frame and return. LOGV("dataCallbackTimestamp timelapse: skipping intermediate frame"); return true; } else { // Desired frame has arrived after mTimeBetweenTimeLapseFrameCaptureUs time: // Desired frame has arrived after mTimeBetweenFrameCaptureUs time: // - Reset mLastTimeLapseFrameRealTimestampUs to current time. // - Artificially modify timestampUs to be one frame time (1/framerate) ahead // of the last encoded frame's time stamp. Loading Loading
include/media/stagefright/CameraSource.h +3 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,9 @@ protected: bool mStarted; int32_t mNumFramesEncoded; // Time between capture of two frames. int64_t mTimeBetweenFrameCaptureUs; CameraSource(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy, int32_t cameraId, Size videoSize, int32_t frameRate, Loading
include/media/stagefright/CameraSourceTimeLapse.h +0 −4 Original line number Diff line number Diff line Loading @@ -57,10 +57,6 @@ private: int32_t mVideoWidth; int32_t mVideoHeight; // Time between capture of two frames during time lapse recording // Negative value indicates that timelapse is disabled. int64_t mTimeBetweenTimeLapseFrameCaptureUs; // Time between two frames in final video (1/frameRate) int64_t mTimeBetweenTimeLapseVideoFramesUs; Loading
media/libstagefright/CameraSource.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ namespace android { static const int64_t CAMERA_SOURCE_TIMEOUT_NS = 3000000000LL; struct CameraSourceListener : public CameraListener { CameraSourceListener(const sp<CameraSource> &source); Loading Loading @@ -156,6 +158,7 @@ CameraSource::CameraSource( mLastFrameTimestampUs(0), mStarted(false), mNumFramesEncoded(0), mTimeBetweenFrameCaptureUs(0), mFirstFrameTimeUs(0), mNumFramesDropped(0), mNumGlitches(0), Loading Loading @@ -644,7 +647,8 @@ status_t CameraSource::stop() { releaseQueuedFrames(); while (!mFramesBeingEncoded.empty()) { if (NO_ERROR != mFrameCompleteCondition.waitRelative(mLock, 3000000000LL)) { mFrameCompleteCondition.waitRelative(mLock, mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) { LOGW("Timed out waiting for outstanding frames being encoded: %d", mFramesBeingEncoded.size()); } Loading Loading @@ -736,7 +740,8 @@ status_t CameraSource::read( Mutex::Autolock autoLock(mLock); while (mStarted && mFramesReceived.empty()) { if (NO_ERROR != mFrameAvailableCondition.waitRelative(mLock, 1000000000LL)) { mFrameAvailableCondition.waitRelative(mLock, mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) { if (mCameraRecordingProxy != 0 && !mCameraRecordingProxy->asBinder()->isBinderAlive()) { LOGW("camera recording proxy is gone"); Loading
media/libstagefright/CameraSourceTimeLapse.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -39,12 +39,12 @@ CameraSourceTimeLapse *CameraSourceTimeLapse::CreateFromCamera( Size videoSize, int32_t videoFrameRate, const sp<Surface>& surface, int64_t timeBetweenTimeLapseFrameCaptureUs) { int64_t timeBetweenFrameCaptureUs) { CameraSourceTimeLapse *source = new CameraSourceTimeLapse(camera, proxy, cameraId, videoSize, videoFrameRate, surface, timeBetweenTimeLapseFrameCaptureUs); timeBetweenFrameCaptureUs); if (source != NULL) { if (source->initCheck() != OK) { Loading @@ -62,15 +62,15 @@ CameraSourceTimeLapse::CameraSourceTimeLapse( Size videoSize, int32_t videoFrameRate, const sp<Surface>& surface, int64_t timeBetweenTimeLapseFrameCaptureUs) int64_t timeBetweenFrameCaptureUs) : CameraSource(camera, proxy, cameraId, videoSize, videoFrameRate, surface, true), mTimeBetweenTimeLapseFrameCaptureUs(timeBetweenTimeLapseFrameCaptureUs), mTimeBetweenTimeLapseVideoFramesUs(1E6/videoFrameRate), mLastTimeLapseFrameRealTimestampUs(0), mSkipCurrentFrame(false) { mTimeBetweenFrameCaptureUs = timeBetweenFrameCaptureUs; LOGD("starting time lapse mode: %lld us", mTimeBetweenTimeLapseFrameCaptureUs); mTimeBetweenFrameCaptureUs); mVideoWidth = videoSize.width; mVideoHeight = videoSize.height; Loading Loading @@ -271,14 +271,14 @@ bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) { // The first 2 output frames from the encoder are: decoder specific info and // the compressed video frame data for the first input video frame. if (mNumFramesEncoded >= 1 && *timestampUs < (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenTimeLapseFrameCaptureUs)) { (mLastTimeLapseFrameRealTimestampUs + mTimeBetweenFrameCaptureUs)) { // Skip all frames from last encoded frame until // sufficient time (mTimeBetweenTimeLapseFrameCaptureUs) has passed. // sufficient time (mTimeBetweenFrameCaptureUs) has passed. // Tell the camera to release its recording frame and return. LOGV("dataCallbackTimestamp timelapse: skipping intermediate frame"); return true; } else { // Desired frame has arrived after mTimeBetweenTimeLapseFrameCaptureUs time: // Desired frame has arrived after mTimeBetweenFrameCaptureUs time: // - Reset mLastTimeLapseFrameRealTimestampUs to current time. // - Artificially modify timestampUs to be one frame time (1/framerate) ahead // of the last encoded frame's time stamp. Loading