diff options
-rw-r--r-- | camera/CameraParameters.cpp | 1 | ||||
-rw-r--r-- | include/camera/CameraParameters.h | 23 | ||||
-rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 5 | ||||
-rwxr-xr-x | media/libstagefright/OMXCodec.cpp | 9 | ||||
-rw-r--r-- | media/libstagefright/SampleTable.cpp | 7 | ||||
-rw-r--r-- | media/libstagefright/include/SampleTable.h | 2 |
6 files changed, 40 insertions, 7 deletions
diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp index 51b96c1..0eb5d50 100644 --- a/camera/CameraParameters.cpp +++ b/camera/CameraParameters.cpp @@ -160,6 +160,7 @@ const char CameraParameters::FOCUS_MODE_MACRO[] = "macro"; const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed"; const char CameraParameters::FOCUS_MODE_EDOF[] = "edof"; const char CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO[] = "continuous-video"; +const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture"; CameraParameters::CameraParameters() : mMap() diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index b661496..6c91dfc 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -597,13 +597,24 @@ public: // CameraHardwareInterface.autoFocus in this mode. static const char FOCUS_MODE_EDOF[]; // Continuous auto focus mode intended for video recording. The camera - // continuously tries to focus. This is ideal for shooting video. - // Applications still can call CameraHardwareInterface.takePicture in this - // mode but the subject may not be in focus. Auto focus starts when the - // parameter is set. Applications should not call - // CameraHardwareInterface.autoFocus in this mode. To stop continuous focus, - // applications should change the focus mode to other modes. + // continuously tries to focus. This is the best choice for video + // recording because the focus changes smoothly . Applications still can + // call CameraHardwareInterface.takePicture in this mode but the subject may + // not be in focus. Auto focus starts when the parameter is set. + // Applications should not call CameraHardwareInterface.autoFocus in this + // mode. To stop continuous focus, applications should change the focus mode + // to other modes. static const char FOCUS_MODE_CONTINUOUS_VIDEO[]; + // Continuous auto focus mode intended for taking pictures. The camera + // continuously tries to focus. The speed of focus change is more aggressive + // than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is + // set. If applications call autoFocus in this mode, the focus callback will + // immediately return with a boolean that indicates the focus is sharp or + // not. The apps can then decide if they want to take a picture immediately + // or to change the focus mode to auto, and run a full autofocus cycle. To + // stop continuous focus, applications should change the focus mode to other + // modes. + static const char FOCUS_MODE_CONTINUOUS_PICTURE[]; private: DefaultKeyedVector<String8,String8> mMap; diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 73a05a5..3b79f06 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -1687,6 +1687,11 @@ status_t MPEG4Extractor::verifyTrack(Track *track) { } } + if (!track->sampleTable->isValid()) { + // Make sure we have all the metadata we need. + return ERROR_MALFORMED; + } + return OK; } diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 644c413..27dfeab 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -3199,9 +3199,16 @@ void OMXCodec::setState(State newState) { } status_t OMXCodec::waitForBufferFilled_l() { + + if (mIsEncoder) { + // For timelapse video recording, the timelapse video recording may + // not send an input frame for a _long_ time. Do not use timeout + // for video encoding. + return mBufferFilled.wait(mLock); + } status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutUs); if (err != OK) { - LOGE("Timed out waiting for buffers from video encoder: %d/%d", + CODEC_LOGE("Timed out waiting for output buffers: %d/%d", countBuffersWeOwn(mPortBuffers[kPortIndexInput]), countBuffersWeOwn(mPortBuffers[kPortIndexOutput])); } diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp index a8a094e..2b9d99b 100644 --- a/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/SampleTable.cpp @@ -84,6 +84,13 @@ SampleTable::~SampleTable() { mSampleIterator = NULL; } +bool SampleTable::isValid() const { + return mChunkOffsetOffset >= 0 + && mSampleToChunkOffset >= 0 + && mSampleSizeOffset >= 0 + && mTimeToSample != NULL; +} + status_t SampleTable::setChunkOffsetParams( uint32_t type, off64_t data_offset, size_t data_size) { if (mChunkOffsetOffset >= 0) { diff --git a/media/libstagefright/include/SampleTable.h b/media/libstagefright/include/SampleTable.h index f44e0a2..a6a6524 100644 --- a/media/libstagefright/include/SampleTable.h +++ b/media/libstagefright/include/SampleTable.h @@ -34,6 +34,8 @@ class SampleTable : public RefBase { public: SampleTable(const sp<DataSource> &source); + bool isValid() const; + // type can be 'stco' or 'co64'. status_t setChunkOffsetParams( uint32_t type, off64_t data_offset, size_t data_size); |