diff --git a/bin/jni/jni_interface.i b/bin/jni/jni_interface.i index ead1d7abc90753c26227dfbebb50aecab7fb207c..6016cd59e9c2499a69f8d0d3d1bb9e683ffa6673 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<VideoSignal::GetCameraInfo>(bind(&VideoCallback::getCameraInfo, videoM, _1, _2, _3, _4)), exportable_callback<VideoSignal::SetParameters>(bind(&VideoCallback::setParameters, videoM, _1, _2, _3, _4, _5)), exportable_callback<VideoSignal::SetBitrate>(bind(&VideoCallback::setBitrate, videoM, _1, _2)), - exportable_callback<VideoSignal::RequestKeyFrame>(bind(&VideoCallback::requestKeyFrame, videoM)), + exportable_callback<VideoSignal::RequestKeyFrame>(bind(&VideoCallback::requestKeyFrame, videoM, _1)), exportable_callback<VideoSignal::StartCapture>(bind(&VideoCallback::startCapture, videoM, _1)), exportable_callback<VideoSignal::StopCapture>(bind(&VideoCallback::stopCapture, videoM, _1)), exportable_callback<VideoSignal::DecodingStarted>(bind(&VideoCallback::decodingStarted, videoM, _1, _2, _3, _4, _5)), diff --git a/bin/jni/videomanager.i b/bin/jni/videomanager.i index 9fbf5c4627af314b330a204f2be4cf199e2edfea..bcacce95c87c990a046a529916ead6c8014a0f41 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<int> *formats, std::vector<unsigned> *sizes, std::vector<unsigned> *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<int> *formats, std::vector<unsigned> *sizes, std::vector<unsigned> *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 50c4a3c76b4823eef6a719f7d867f20b49f3db2c..f3a103158fd4e653faeabfa692932e03e7ef5047 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 746ad91b093c5ad23e7fbc7933d4512ed9321a53..cd656a1a25028a08dd38f317a53049be18fdf38c 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<std::recursive_mutex> lock(mutex_); +#if __ANDROID__ + if (videoLocal_) + emitSignal<DRing::VideoSignal::RequestKeyFrame>(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 041978ece3ec26d4976efbf33221e084a3201ca6..7d619200faffa7f78c2f49f995b2877e5ef8dc93 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 @@ public: bool hasConference() { return conference_; } - std::shared_ptr<VideoFrameActiveWriter>& getVideoLocal() { return videoLocal_; } + std::shared_ptr<VideoInput>& getVideoLocal() { return videoLocal_; } std::shared_ptr<VideoMixer>& getVideoMixer() { return videoMixer_; } @@ -129,7 +130,7 @@ private: = std::make_shared<VideoFrameActiveWriter>(); Conference* conference_ {nullptr}; std::shared_ptr<VideoMixer> videoMixer_; - std::shared_ptr<VideoFrameActiveWriter> videoLocal_; + std::shared_ptr<VideoInput> videoLocal_; uint16_t initSeqVal_ = 0; std::function<void(void)> requestKeyFrameCallback_; diff --git a/src/media/video/video_sender.cpp b/src/media/video/video_sender.cpp index 4fe65b097986551913c0b054c00d10ada140d219..48a19d638296ee8c7e41b8a9b828a2ff066668e0 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<VideoFrame>& input_frame) } if (auto packet = input_frame->packet()) { -#if __ANDROID__ - if (forceKeyFrame_) { - emitSignal<DRing::VideoSignal::RequestKeyFrame>(); - --forceKeyFrame_; - } -#endif videoEncoder_->send(*packet); } else { bool is_keyframe = forceKeyFrame_ > 0