Commit 981ba6fb authored by Ghislain MARY's avatar Ghislain MARY

Add API to send FIR and PLI messages for the videostream.

parent cc4c03ad
......@@ -165,7 +165,7 @@ MS2_PUBLIC int media_stream_set_srtp_recv_key(MediaStream *stream, MSCryptoSuite
MS2_PUBLIC int media_stream_set_srtp_send_key(MediaStream *stream, MSCryptoSuite suite, const char* key);
/**
* @paraa stream object
* @param[in] stream MediaStream object
* @return true if stream is encrypted
* */
MS2_PUBLIC bool_t media_stream_is_secured(const MediaStream *stream);
......@@ -580,7 +580,25 @@ The following function allows to take into account new parameters by redrawing t
MS2_PUBLIC void video_stream_update_video_params(VideoStream *stream);
/*function to call periodically to handle various events */
MS2_PUBLIC void video_stream_iterate(VideoStream *stream);
/**
* Ask the video stream to send a Full-Intra Request.
* @param[in] stream The videostream object.
*/
MS2_PUBLIC void video_stream_send_fir(VideoStream *stream);
/**
* Ask the video stream to send a Picture Loss Indication.
* @param[in] stream The videostream object.
*/
MS2_PUBLIC void video_stream_send_pli(VideoStream *stream);
/**
* Ask the video stream to generate a Video Fast Update (generally after receiving a Full-Intra Request.
* @param[in] stream The videostream object.
*/
MS2_PUBLIC void video_stream_send_vfu(VideoStream *stream);
MS2_PUBLIC void video_stream_stop(VideoStream * stream);
MS2_PUBLIC void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize);
......
......@@ -599,6 +599,18 @@ void video_stream_change_camera(VideoStream *stream, MSWebCam *cam){
}
}
void video_stream_send_fir(VideoStream *stream) {
if (stream->ms.sessions.rtp_session != NULL) {
rtp_session_send_rtcp_fb_fir(stream->ms.sessions.rtp_session);
}
}
void video_stream_send_pli(VideoStream *stream) {
if (stream->ms.sessions.rtp_session != NULL) {
rtp_session_send_rtcp_fb_pli(stream->ms.sessions.rtp_session);
}
}
void video_stream_send_vfu(VideoStream *stream){
if (stream->ms.encoder)
ms_filter_call_method_noarg(stream->ms.encoder, MS_VIDEO_ENCODER_REQ_VFU);
......
......@@ -519,6 +519,25 @@ bool_t parse_args(int argc, char** argv, MediastreamDatas* out) {
}
#ifdef VIDEO_ENABLED
static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args) {
MediastreamDatas *md = (MediastreamDatas *)user_pointer;
switch (event_id) {
case MS_VIDEO_DECODER_DECODING_ERRORS:
ms_warning("Video decoding error");
video_stream_send_pli(md->video);
break;
case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED:
ms_message("First video frame decoded successfully");
break;
default:
ms_warning("Unhandled event %i", event_id);
break;
}
}
#endif
void setup_media_streams(MediastreamDatas* args) {
/*create the rtp session */
OrtpNetworkSimulatorParams params={0};
......@@ -729,6 +748,7 @@ void setup_media_streams(MediastreamDatas* args) {
NSUInteger cpucount = [[NSProcessInfo processInfo] processorCount];
ms_set_cpu_count(cpucount);
#endif
video_stream_set_event_callback(args->video,video_stream_event_cb, args);
video_stream_enable_adaptive_bitrate_control(args->video,args->use_rc);
if (args->camera)
......
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