diff --git a/src/face-tracker-ptz.cpp b/src/face-tracker-ptz.cpp index 415141b..941f1c8 100644 --- a/src/face-tracker-ptz.cpp +++ b/src/face-tracker-ptz.cpp @@ -925,7 +925,7 @@ static inline bool operator != (const struct video_scale_info &a, const struct v return false; } -static bool scale_set_texture(struct face_tracker_ptz *s, std::shared_ptr &cvtex, struct obs_source_frame *frame) +static bool scale_set_texture(struct face_tracker_ptz *s, texture_object *cvtex, struct obs_source_frame *frame) { const struct video_scale_info scaler_src_info = { frame->format, @@ -971,10 +971,10 @@ static bool scale_set_texture(struct face_tracker_ptz *s, std::shared_ptrscaler, scaled_frame.data, scaled_frame.linesize, frame->data, frame->linesize)) { blog(LOG_ERROR, "video_scaler_scale failed"); - return NULL; + return false; } - cvtex.get()->set_texture_obsframe(&scaled_frame, 1); + cvtex->set_texture_obsframe(&scaled_frame, 1); return true; } @@ -986,13 +986,14 @@ static struct obs_source_frame *ftptz_filter_video(void *data, struct obs_source auto *s = (struct face_tracker_ptz*)data; std::shared_ptr cvtex(new texture_object()); - cvtex.get()->scale = s->ftm->scale; - cvtex.get()->tick = s->ftm->tick_cnt; + cvtex->scale = s->ftm->scale; + cvtex->tick = s->ftm->tick_cnt; if (is_rgb_format(frame->format)) { - cvtex.get()->set_texture_obsframe(frame, s->ftm->scale); + cvtex->set_texture_obsframe(frame, s->ftm->scale); } else { - scale_set_texture(s, cvtex, frame); + if (!scale_set_texture(s, cvtex.get(), frame)) + return frame; } s->known_width = frame->width; diff --git a/src/face-tracker.cpp b/src/face-tracker.cpp index 68393b1..4f727f2 100644 --- a/src/face-tracker.cpp +++ b/src/face-tracker.cpp @@ -742,8 +742,8 @@ static inline std::shared_ptr surface_to_cvtex(struct face_track uint32_t height = gs_stagesurface_get_height(s->stagesurface); std::shared_ptr cvtex(new texture_object); - cvtex.get()->scale = scale; - cvtex.get()->tick = s->ftm->tick_cnt; + cvtex->scale = scale; + cvtex->tick = s->ftm->tick_cnt; struct obs_source_frame frame; memset(&frame, 0, sizeof(frame)); @@ -752,7 +752,7 @@ static inline std::shared_ptr surface_to_cvtex(struct face_track frame.width = width; frame.height = height; frame.format = VIDEO_FORMAT_BGRA; - cvtex.get()->set_texture_obsframe(&frame, 1); + cvtex->set_texture_obsframe(&frame, 1); gs_stagesurface_unmap(s->stagesurface);