Skip to content

Commit

Permalink
videomanager: add deviceId to RequestKeyFrame
Browse files Browse the repository at this point in the history
Change-Id: Ie8cdb2a771a64dbdb9384fbbfadb255bec64d9c6
  • Loading branch information
aberaud committed Nov 23, 2021
1 parent f3af819 commit c5608b9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bin/jni/jni_interface.i
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
4 changes: 2 additions & 2 deletions bin/jni/videomanager.i
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -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) {}
Expand Down
4 changes: 2 additions & 2 deletions src/jami/videomanager_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/media/video/video_rtp_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/media/video/video_rtp_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MediaRecorder;
namespace jami {
namespace video {

class VideoInput;
class VideoMixer;
class VideoSender;
class VideoReceiveThread;
Expand Down Expand Up @@ -100,7 +101,7 @@ class VideoRtpSession : public RtpSession

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_; }

Expand Down Expand Up @@ -129,7 +130,7 @@ class VideoRtpSession : public RtpSession
= 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_;
Expand Down
6 changes: 0 additions & 6 deletions src/media/video/video_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5608b9

Please sign in to comment.