Skip to content
Snippets Groups Projects
Commit 2493ad1c authored by Alexandre Lision's avatar Alexandre Lision
Browse files

video: reuse scaler

Video scaler now follows sink lifecycle

Issue: #81116
Change-Id: Ibb053991b265131e1f63e1b2a169821e1d0f3bae
parent ba49e66d
No related branches found
No related tags found
No related merge requests found
...@@ -66,6 +66,7 @@ using random_device = std::random_device; ...@@ -66,6 +66,7 @@ using random_device = std::random_device;
#ifdef RING_VIDEO #ifdef RING_VIDEO
#include "client/videomanager.h" #include "client/videomanager.h"
#include "video/video_scaler.h"
#endif #endif
#include "conference.h" #include "conference.h"
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
#include "shm_header.h" #include "shm_header.h"
#endif // HAVE_SHM #endif // HAVE_SHM
#include "video_scaler.h"
#include "media_buffer.h" #include "media_buffer.h"
#include "logger.h" #include "logger.h"
#include "noncopyable.h" #include "noncopyable.h"
#include "client/ring_signal.h" #include "client/ring_signal.h"
#include "dring/videomanager_interface.h" #include "dring/videomanager_interface.h"
#include "libav_utils.h" #include "libav_utils.h"
#include "video_scaler.h"
#ifndef _WIN32 #ifndef _WIN32
#include <sys/mman.h> #include <sys/mman.h>
...@@ -297,11 +297,14 @@ SinkClient::stop() noexcept ...@@ -297,11 +297,14 @@ SinkClient::stop() noexcept
#endif // !HAVE_SHM #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 #ifdef DEBUG_FPS
, frameCount_(0u) , frameCount_(0u)
, lastFrameDebug_(std::chrono::system_clock::now()) , lastFrameDebug_(std::chrono::system_clock::now())
#endif #endif
, scaler_(new VideoScaler())
{} {}
void void
...@@ -327,7 +330,6 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/, ...@@ -327,7 +330,6 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/,
if (target_.pull) { if (target_.pull) {
VideoFrame dst; VideoFrame dst;
VideoScaler scaler;
const int width = f->width(); const int width = f->width();
const int height = f->height(); const int height = f->height();
#ifndef __APPLE__ #ifndef __APPLE__
...@@ -343,7 +345,7 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/, ...@@ -343,7 +345,7 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/,
buffer_ptr->width = width; buffer_ptr->width = width;
buffer_ptr->height = height; buffer_ptr->height = height;
dst.setFromMemory(buffer_ptr->ptr, format, width, height); dst.setFromMemory(buffer_ptr->ptr, format, width, height);
scaler.scale(*f, dst); scaler_->scale(*f, dst);
target_.push(std::move(buffer_ptr)); target_.push(std::move(buffer_ptr));
} }
} }
......
...@@ -39,6 +39,8 @@ namespace ring { namespace video { ...@@ -39,6 +39,8 @@ namespace ring { namespace video {
class ShmHolder; class ShmHolder;
#endif // HAVE_SHM #endif // HAVE_SHM
class VideoScaler;
class SinkClient : public VideoFramePassiveReader class SinkClient : public VideoFramePassiveReader
{ {
public: public:
...@@ -68,6 +70,7 @@ class SinkClient : public VideoFramePassiveReader ...@@ -68,6 +70,7 @@ class SinkClient : public VideoFramePassiveReader
const bool mixer_; const bool mixer_;
bool started_ {false}; // used to arbitrate client's stop signal. bool started_ {false}; // used to arbitrate client's stop signal.
DRing::SinkTarget target_; DRing::SinkTarget target_;
std::unique_ptr<VideoScaler> scaler_;
#ifdef DEBUG_FPS #ifdef DEBUG_FPS
unsigned frameCount_; unsigned frameCount_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment