diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index b926270100598..d606c2d6162e5 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -78,6 +78,9 @@ public: camera_frame_metadata_t *metadata); virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp& dataPtr); virtual void postRecordingFrameHandleTimestamp(nsecs_t timestamp, native_handle_t* handle); + virtual void postRecordingFrameHandleTimestampBatch( + const std::vector& timestamps, + const std::vector& handles); void postMetadata(JNIEnv *env, int32_t msgType, camera_frame_metadata_t *metadata); void addCallbackBuffer(JNIEnv *env, jbyteArray cbb, int msgType); void setCallbackMode(JNIEnv *env, bool installed, bool manualMode); @@ -362,6 +365,22 @@ void JNICameraContext::postRecordingFrameHandleTimestamp(nsecs_t, native_handle_ } } +void JNICameraContext::postRecordingFrameHandleTimestampBatch( + const std::vector&, + const std::vector& handles) { + // Video buffers are not needed at app layer so just return the video buffers here. + // This may be called when stagefright just releases camera but there are still outstanding + // video buffers. + if (mCamera != nullptr) { + mCamera->releaseRecordingFrameHandleBatch(handles); + } else { + for (auto& handle : handles) { + native_handle_close(handle); + native_handle_delete(handle); + } + } +} + void JNICameraContext::postMetadata(JNIEnv *env, int32_t msgType, camera_frame_metadata_t *metadata) { jobjectArray obj = NULL;