diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 2445ed3aca8de52b926d63e2f67287342bece0a0..d9342308fa9a470625b7030fd30766c760c336e1 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -142,7 +142,7 @@ VideoMixer::process() VideoFrame& output = getNewFrame(); try { - output.reserve(AV_PIX_FMT_YUV422P, width_, height_); + output.reserve(format_, width_, height_); } catch (const std::bad_alloc& e) { JAMI_ERR("VideoFrame::allocBuffer() failed"); return; @@ -217,12 +217,13 @@ VideoMixer::render_frame(VideoFrame& output, const VideoFrame& input, } void -VideoMixer::setDimensions(int width, int height) +VideoMixer::setParameters(int width, int height, AVPixelFormat format) { auto lock(rwMutex_.write()); width_ = width; height_ = height; + format_ = format; // cleanup the previous frame to have a nice copy in rendering method std::shared_ptr<VideoFrame> previous_p(obtainLastFrame()); @@ -268,6 +269,6 @@ VideoMixer::getHeight() const AVPixelFormat VideoMixer::getPixelFormat() const -{ return AV_PIX_FMT_YUYV422; } +{ return format_; } }} // namespace jami::video diff --git a/src/media/video/video_mixer.h b/src/media/video/video_mixer.h index 056c472f209ee6a64d61d3922b9a7487dace3832..db32f777f69be2fa42cc922424ac32a92f721cdd 100644 --- a/src/media/video/video_mixer.h +++ b/src/media/video/video_mixer.h @@ -43,7 +43,7 @@ public: VideoMixer(const std::string& id); ~VideoMixer(); - void setDimensions(int width, int height); + void setParameters(int width, int height, AVPixelFormat format = AV_PIX_FMT_YUV422P); int getWidth() const override; int getHeight() const override; @@ -70,6 +70,7 @@ private: const std::string id_; int width_ = 0; int height_ = 0; + AVPixelFormat format_ = AV_PIX_FMT_YUV422P; std::list<std::unique_ptr<VideoMixerSource>> sources_; rw_mutex rwMutex_; diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index c1db4f6f680da4b0a26772aa3b26aa0051af2bbf..3ed0edd5c772bef6f98209311386fc5e8c052a20 100644 --- a/src/media/video/video_rtp_session.cpp +++ b/src/media/video/video_rtp_session.cpp @@ -300,7 +300,13 @@ VideoRtpSession::enterConference(Conference* conference) if (send_.enabled or receiveThread_) { videoMixer_ = conference->getVideoMixer(); - videoMixer_->setDimensions(localVideoParams_.width, localVideoParams_.height); +#if defined(__APPLE__) && TARGET_OS_MAC + videoMixer_->setParameters(localVideoParams_.width, + localVideoParams_.height, + av_get_pix_fmt(localVideoParams_.pixel_format.c_str())); +#else + videoMixer_->setParameters(localVideoParams_.width, localVideoParams_.height); +#endif setupConferenceVideoPipeline(*conference_); } } @@ -574,5 +580,3 @@ VideoRtpSession::getPonderateLoss(float lastLoss) }} // namespace jami::video - -