diff --git a/src/manager.cpp b/src/manager.cpp index 6da67fb820b93dc5c376b21b3b72ce6e40ba7002..c9ce4c0fd285bfb04a60c9ed3782c3c15dadfabf 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -66,6 +66,7 @@ using random_device = std::random_device; #ifdef RING_VIDEO #include "client/videomanager.h" +#include "video/video_scaler.h" #endif #include "conference.h" diff --git a/src/media/video/sinkclient.cpp b/src/media/video/sinkclient.cpp index 0b9e5842905c7e5696665c94af62866d9147360f..a5e63e4801a5524fc1a92ee7d74576f8ebb61144 100644 --- a/src/media/video/sinkclient.cpp +++ b/src/media/video/sinkclient.cpp @@ -30,13 +30,13 @@ #include "shm_header.h" #endif // HAVE_SHM -#include "video_scaler.h" #include "media_buffer.h" #include "logger.h" #include "noncopyable.h" #include "client/ring_signal.h" #include "dring/videomanager_interface.h" #include "libav_utils.h" +#include "video_scaler.h" #ifndef _WIN32 #include <sys/mman.h> @@ -297,11 +297,14 @@ SinkClient::stop() noexcept #endif // !HAVE_SHM -SinkClient::SinkClient(const std::string& id, bool mixer) : id_ {id}, mixer_(mixer) +SinkClient::SinkClient(const std::string& id, bool mixer) + : id_ {id} + , mixer_(mixer) #ifdef DEBUG_FPS , frameCount_(0u) , lastFrameDebug_(std::chrono::system_clock::now()) #endif + , scaler_(new VideoScaler()) {} void @@ -327,7 +330,6 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/, if (target_.pull) { VideoFrame dst; - VideoScaler scaler; const int width = f->width(); const int height = f->height(); #ifndef __APPLE__ @@ -343,7 +345,7 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/, buffer_ptr->width = width; buffer_ptr->height = height; dst.setFromMemory(buffer_ptr->ptr, format, width, height); - scaler.scale(*f, dst); + scaler_->scale(*f, dst); target_.push(std::move(buffer_ptr)); } } diff --git a/src/media/video/sinkclient.h b/src/media/video/sinkclient.h index 91168a238c1ef494a30a1fd0bd7c5df3a37a665e..608ed04d56f5cb3e2620766ca20518b256be0027 100644 --- a/src/media/video/sinkclient.h +++ b/src/media/video/sinkclient.h @@ -39,6 +39,8 @@ namespace ring { namespace video { class ShmHolder; #endif // HAVE_SHM +class VideoScaler; + class SinkClient : public VideoFramePassiveReader { public: @@ -68,6 +70,7 @@ class SinkClient : public VideoFramePassiveReader const bool mixer_; bool started_ {false}; // used to arbitrate client's stop signal. DRing::SinkTarget target_; + std::unique_ptr<VideoScaler> scaler_; #ifdef DEBUG_FPS unsigned frameCount_;