Commit 28938f7c authored by Adrien Béraud's avatar Adrien Béraud

videomanager: add requestKeyFrame signal for Android

Allows to request key frame from client-side hardware encoder.

Change-Id: Id14ea527bc5e0852de4538c93ac60da5616879ec
parent 2aad6913
......@@ -284,6 +284,7 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
const std::map<std::string, SharedCallback> videoEvHandlers = {
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::RequestKeyFrame>(bind(&VideoCallback::requestKeyFrame, videoM)),
exportable_callback<VideoSignal::StartCapture>(bind(&VideoCallback::startCapture, videoM, _1)),
exportable_callback<VideoSignal::StopCapture>(bind(&VideoCallback::stopCapture, videoM)),
exportable_callback<VideoSignal::DecodingStarted>(bind(&VideoCallback::decodingStarted, videoM, _1, _2, _3, _4, _5)),
......
......@@ -43,6 +43,7 @@ public:
virtual ~VideoCallback(){}
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 requestKeyFrame(){}
virtual void startCapture(const std::string& camid) {}
virtual void stopCapture() {}
virtual void decodingStarted(const std::string& id, const std::string& shm_path, int w, int h, bool is_mixer) {}
......@@ -397,6 +398,7 @@ public:
virtual ~VideoCallback(){}
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 requestKeyFrame(){}
virtual void startCapture(const std::string& camid) {}
virtual void stopCapture() {}
virtual void decodingStarted(const std::string& id, const std::string& shm_path, int w, int h, bool is_mixer) {}
......
......@@ -107,6 +107,7 @@ getSignalHandlers()
#ifdef __ANDROID__
exported_callback<DRing::VideoSignal::GetCameraInfo>(),
exported_callback<DRing::VideoSignal::SetParameters>(),
exported_callback<DRing::VideoSignal::RequestKeyFrame>(),
#endif
exported_callback<DRing::VideoSignal::StartCapture>(),
exported_callback<DRing::VideoSignal::StopCapture>(),
......
......@@ -209,6 +209,10 @@ struct DRING_PUBLIC VideoSignal {
constexpr static const char* name = "GetCameraInfo";
using cb_type = void(const std::string& device, std::vector<int> *formats, std::vector<unsigned> *sizes, std::vector<unsigned> *rates);
};
struct DRING_PUBLIC RequestKeyFrame {
constexpr static const char* name = "RequestKeyFrame";
using cb_type = void();
};
#endif
struct DRING_PUBLIC StartCapture {
constexpr static const char* name = "StartCapture";
......
......@@ -68,6 +68,12 @@ void
VideoSender::encodeAndSendVideo(VideoFrame& input_frame)
{
if (auto packet = input_frame.packet()) {
#if __ANDROID__
if (forceKeyFrame_) {
emitSignal<DRing::VideoSignal::RequestKeyFrame>();
forceKeyFrame_ = 0;
}
#endif
videoEncoder_->send(*packet);
} else {
bool is_keyframe = forceKeyFrame_ > 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment