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
Branches
Tags
No related merge requests found
......@@ -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"
......
......@@ -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));
}
}
......
......@@ -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_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment