diff --git a/bin/jni/jni_interface.i b/bin/jni/jni_interface.i index ead1d7abc90..6016cd59e9c 100644 --- a/bin/jni/jni_interface.i +++ b/bin/jni/jni_interface.i @@ -311,7 +311,7 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM exportable_callback(bind(&VideoCallback::getCameraInfo, videoM, _1, _2, _3, _4)), exportable_callback(bind(&VideoCallback::setParameters, videoM, _1, _2, _3, _4, _5)), exportable_callback(bind(&VideoCallback::setBitrate, videoM, _1, _2)), - exportable_callback(bind(&VideoCallback::requestKeyFrame, videoM)), + exportable_callback(bind(&VideoCallback::requestKeyFrame, videoM, _1)), exportable_callback(bind(&VideoCallback::startCapture, videoM, _1)), exportable_callback(bind(&VideoCallback::stopCapture, videoM, _1)), exportable_callback(bind(&VideoCallback::decodingStarted, videoM, _1, _2, _3, _4, _5)), diff --git a/bin/jni/videomanager.i b/bin/jni/videomanager.i index 9fbf5c4627a..bcacce95c87 100644 --- a/bin/jni/videomanager.i +++ b/bin/jni/videomanager.i @@ -45,7 +45,7 @@ public: virtual void getCameraInfo(const std::string& device, std::vector *formats, std::vector *sizes, std::vector *rates) {} virtual void setParameters(const std::string&, const int format, const int width, const int height, const int rate) {} virtual void setBitrate(const std::string&, const int bitrate) {} - virtual void requestKeyFrame(){} + virtual void requestKeyFrame(const std::string& camid){} virtual void startCapture(const std::string& camid) {} virtual void stopCapture(const std::string& camid) {} virtual void decodingStarted(const std::string& id, const std::string& shm_path, int w, int h, bool is_mixer) {} @@ -443,7 +443,7 @@ public: virtual void getCameraInfo(const std::string& device, std::vector *formats, std::vector *sizes, std::vector *rates){} virtual void setParameters(const std::string&, const int format, const int width, const int height, const int rate) {} virtual void setBitrate(const std::string&, const int bitrate) {} - virtual void requestKeyFrame(){} + virtual void requestKeyFrame(const std::string& camid){} virtual void startCapture(const std::string& camid) {} virtual void stopCapture(const std::string& camid) {} virtual void decodingStarted(const std::string& id, const std::string& shm_path, int w, int h, bool is_mixer) {} diff --git a/src/jami/videomanager_interface.h b/src/jami/videomanager_interface.h index 50c4a3c76b4..f3a103158fd 100644 --- a/src/jami/videomanager_interface.h +++ b/src/jami/videomanager_interface.h @@ -283,12 +283,12 @@ struct DRING_PUBLIC VideoSignal struct DRING_PUBLIC RequestKeyFrame { constexpr static const char* name = "RequestKeyFrame"; - using cb_type = void(); + using cb_type = void(const std::string& /*device*/); }; struct DRING_PUBLIC SetBitrate { constexpr static const char* name = "SetBitrate"; - using cb_type = void(const std::string& device, const int bitrate); + using cb_type = void(const std::string& /*device*/, const int bitrate); }; #endif struct DRING_PUBLIC StartCapture diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index 746ad91b093..cd656a1a250 100644 --- a/src/media/video/video_rtp_session.cpp +++ b/src/media/video/video_rtp_session.cpp @@ -306,8 +306,13 @@ void VideoRtpSession::forceKeyFrame() { std::lock_guard lock(mutex_); +#if __ANDROID__ + if (videoLocal_) + emitSignal(videoLocal_->getName()); +#else if (sender_) sender_->forceKeyFrame(); +#endif } void diff --git a/src/media/video/video_rtp_session.h b/src/media/video/video_rtp_session.h index 041978ece3e..7d619200faf 100644 --- a/src/media/video/video_rtp_session.h +++ b/src/media/video/video_rtp_session.h @@ -39,6 +39,7 @@ class MediaRecorder; namespace jami { namespace video { +class VideoInput; class VideoMixer; class VideoSender; class VideoReceiveThread; @@ -100,7 +101,7 @@ class VideoRtpSession : public RtpSession bool hasConference() { return conference_; } - std::shared_ptr& getVideoLocal() { return videoLocal_; } + std::shared_ptr& getVideoLocal() { return videoLocal_; } std::shared_ptr& getVideoMixer() { return videoMixer_; } @@ -129,7 +130,7 @@ class VideoRtpSession : public RtpSession = std::make_shared(); Conference* conference_ {nullptr}; std::shared_ptr videoMixer_; - std::shared_ptr videoLocal_; + std::shared_ptr videoLocal_; uint16_t initSeqVal_ = 0; std::function requestKeyFrameCallback_; diff --git a/src/media/video/video_sender.cpp b/src/media/video/video_sender.cpp index 4fe65b09798..48a19d63829 100644 --- a/src/media/video/video_sender.cpp +++ b/src/media/video/video_sender.cpp @@ -82,12 +82,6 @@ VideoSender::encodeAndSendVideo(const std::shared_ptr& input_frame) } if (auto packet = input_frame->packet()) { -#if __ANDROID__ - if (forceKeyFrame_) { - emitSignal(); - --forceKeyFrame_; - } -#endif videoEncoder_->send(*packet); } else { bool is_keyframe = forceKeyFrame_ > 0