diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 2445ed3ac..d9342308f 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 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 056c472f2..db32f777f 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> sources_; rw_mutex rwMutex_; diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index c1db4f6f6..3ed0edd5c 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 - -