diff --git a/src/zm_camera.cpp b/src/zm_camera.cpp index 6fab967a9..0186f8045 100644 --- a/src/zm_camera.cpp +++ b/src/zm_camera.cpp @@ -59,7 +59,8 @@ Camera::Camera( mFirstAudioPTS(0), mLastVideoPTS(0), mLastAudioPTS(0), - bytes(0) + bytes(0), + mIsPrimed(false) { linesize = width * colours; pixels = width * height; diff --git a/src/zm_camera.h b/src/zm_camera.h index 2d2b853ab..490564c6a 100644 --- a/src/zm_camera.h +++ b/src/zm_camera.h @@ -65,6 +65,7 @@ protected: int64_t mLastVideoPTS; int64_t mLastAudioPTS; unsigned int bytes; + bool mIsPrimed; public: Camera( @@ -84,6 +85,7 @@ public: virtual ~Camera(); SourceType Type() const { return type; } + bool isPrimed() const { return mIsPrimed; } bool IsLocal() const { return type == LOCAL_SRC; } bool IsRemote() const { return type == REMOTE_SRC; } bool IsFile() const { return type == FILE_SRC; } diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index a7f11197f..425161bab 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -127,7 +127,6 @@ FfmpegCamera::FfmpegCamera( mSecondInput(nullptr), frameCount(0), use_hwaccel(true), - mCanCapture(false), mConvertContext(nullptr), error_count(0), stream_width(0), @@ -172,7 +171,7 @@ FfmpegCamera::~FfmpegCamera() { int FfmpegCamera::PrimeCapture() { start_read_time = std::chrono::steady_clock::now(); - if ( mCanCapture ) { + if ( mIsPrimed ) { Debug(1, "Priming capture from %s, Closing", mMaskedPath.c_str()); Close(); } @@ -188,7 +187,7 @@ int FfmpegCamera::PreCapture() { } int FfmpegCamera::Capture(std::shared_ptr &zm_packet) { - if (!mCanCapture) return -1; + if (!mIsPrimed) return -1; start_read_time = std::chrono::steady_clock::now(); int ret; @@ -562,13 +561,13 @@ int FfmpegCamera::OpenFfmpeg() { width, height, mVideoCodecContext->width, mVideoCodecContext->height); } - mCanCapture = true; + mIsPrimed = true; return 1; } // int FfmpegCamera::OpenFfmpeg() int FfmpegCamera::Close() { - mCanCapture = false; + mIsPrimed = false; if (mVideoCodecContext) { avcodec_close(mVideoCodecContext); diff --git a/src/zm_ffmpeg_camera.h b/src/zm_ffmpeg_camera.h index 3fba7f46c..c29af4127 100644 --- a/src/zm_ffmpeg_camera.h +++ b/src/zm_ffmpeg_camera.h @@ -68,7 +68,6 @@ class FfmpegCamera : public Camera { int OpenFfmpeg(); int Close() override; - bool mCanCapture; struct SwsContext *mConvertContext;