Commit 8958c8ac authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Applied from master callback for next video frame decoded

parent ab06d514
......@@ -50,6 +50,7 @@ void linphone_call_notify_info_message_received(LinphoneCall *call, const Linpho
void linphone_call_notify_ack_processing(LinphoneCall *call, LinphoneHeaders *msg, bool_t is_received);
void linphone_call_notify_tmmbr_received(LinphoneCall *call, int stream_index, int tmmbr);
void linphone_call_notify_snapshot_taken(LinphoneCall *call, const char *file_path);
void linphone_call_notify_next_video_frame_decoded(LinphoneCall *call);
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, LinphonePrivate::SalCallOp *op);
......
......@@ -187,6 +187,20 @@ LINPHONE_PUBLIC LinphoneCallCbsSnapshotTakenCb linphone_call_cbs_get_snapshot_ta
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_snapshot_taken(LinphoneCallCbs *cbs, LinphoneCallCbsSnapshotTakenCb cb);
/**
* Get the next video frame decoded callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current next video frame decoded callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsNextVideoFrameDecodedCb linphone_call_cbs_get_next_video_frame_decoded(LinphoneCallCbs *cbs);
/**
* Set the next video frame decoded callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The next video frame decoded callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_next_video_frame_decoded(LinphoneCallCbs *cbs, LinphoneCallCbsNextVideoFrameDecodedCb cb);
/**
* @}
*/
......
......@@ -102,6 +102,12 @@ typedef void (*LinphoneCallCbsTmmbrReceivedCb)(LinphoneCall *call, int stream_in
*/
typedef void (*LinphoneCallCbsSnapshotTakenCb)(LinphoneCall *call, const char *filepath);
/**
* Callback to notify a next video frame has been decoded
* @param call LinphoneCall for which the next video frame has been decoded
*/
typedef void (*LinphoneCallCbsNextVideoFrameDecodedCb)(LinphoneCall *call);
/**
* @}
**/
......
......@@ -35,6 +35,7 @@ struct _LinphoneCallCbs {
LinphoneCallCbsAckProcessingCb ackProcessing;
LinphoneCallCbsTmmbrReceivedCb tmmbrReceivedCb;
LinphoneCallCbsSnapshotTakenCb snapshotTakenCb;
LinphoneCallCbsNextVideoFrameDecodedCb nextVideoFrameDecodedCb;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallCbs);
......@@ -142,3 +143,11 @@ LinphoneCallCbsSnapshotTakenCb linphone_call_cbs_get_snapshot_taken(LinphoneCall
void linphone_call_cbs_set_snapshot_taken(LinphoneCallCbs *cbs, LinphoneCallCbsSnapshotTakenCb cb) {
cbs->snapshotTakenCb = cb;
}
LinphoneCallCbsNextVideoFrameDecodedCb linphone_call_cbs_get_next_video_frame_decoded(LinphoneCallCbs *cbs) {
return cbs->nextVideoFrameDecodedCb;
}
void linphone_call_cbs_set_next_video_frame_decoded(LinphoneCallCbs *cbs, LinphoneCallCbsNextVideoFrameDecodedCb cb) {
cbs->nextVideoFrameDecodedCb = cb;
}
......@@ -188,6 +188,10 @@ void linphone_call_notify_snapshot_taken(LinphoneCall *call, const char *file_pa
NOTIFY_IF_EXIST(SnapshotTaken, snapshot_taken, call, file_path)
}
void linphone_call_notify_next_video_frame_decoded(LinphoneCall *call) {
NOTIFY_IF_EXIST(NextVideoFrameDecoded, next_video_frame_decoded, call)
}
// =============================================================================
// Public functions.
// =============================================================================
......
......@@ -418,6 +418,7 @@ void CallPrivate::onFirstVideoFrameDecoded (const shared_ptr<CallSession> &sessi
nextVideoFrameDecoded._func = nullptr;
nextVideoFrameDecoded._user_data = nullptr;
}
linphone_call_notify_next_video_frame_decoded(L_GET_C_BACK_PTR(q));
}
void CallPrivate::onResetFirstVideoFrameDecoded (const shared_ptr<CallSession> &session) {
......
......@@ -4227,6 +4227,11 @@ void MediaSession::sendVfuRequest () {
#ifdef VIDEO_ENABLED
L_D();
MediaSessionParams *curParams = getCurrentParams();
if (d->videoStream && d->videoStream->ms.decoder) {
ms_filter_call_method_noarg(d->videoStream->ms.decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION);
}
if ((curParams->avpfEnabled() || curParams->getPrivate()->implicitRtcpFbEnabled())
&& d->videoStream && media_stream_get_state(&d->videoStream->ms) == MSStreamStarted) { // || sal_media_description_has_implicit_avpf((const SalMediaDescription *)call->resultdesc)
lInfo() << "Request Full Intra Request on CallSession [" << this << "]";
......
......@@ -55,7 +55,7 @@ static void call_multicast_base(bool_t video) {
BC_ASSERT_GREATER(linphone_core_manager_get_max_audio_down_bw(marie),70,int,"%d");
if (video) {
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(marie->lc),linphone_call_iframe_decoded_cb,marie->lc);
linphone_call_set_first_video_frame_decoded_cb(linphone_core_get_current_call(marie->lc));
linphone_call_send_vfu_request(linphone_core_get_current_call(marie->lc));
BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
}
......@@ -149,7 +149,7 @@ static void early_media_with_multicast_base(bool_t video) {
/* send a 183 to initiate the early media */
if (video) {
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(pauline->lc),linphone_call_iframe_decoded_cb,pauline->lc);
linphone_call_set_first_video_frame_decoded_cb(linphone_core_get_current_call(pauline->lc));
}
linphone_call_accept_early_media(linphone_core_get_current_call(pauline->lc));
......@@ -160,7 +160,7 @@ static void early_media_with_multicast_base(bool_t video) {
/* send a 183 to initiate the early media */
if (video) {
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(pauline2->lc),linphone_call_iframe_decoded_cb,pauline2->lc);
linphone_call_set_first_video_frame_decoded_cb(linphone_core_get_current_call(pauline2->lc));
}
linphone_call_accept_early_media(linphone_core_get_current_call(pauline2->lc));
......
......@@ -173,12 +173,12 @@ void linphone_transfer_state_changed(LinphoneCore *lc, LinphoneCall *transfered,
}
void linphone_call_iframe_decoded_cb(LinphoneCall *call,void * user_data) {
LinphoneCallLog *calllog = linphone_call_get_call_log(call);
char* to=linphone_address_as_string(linphone_call_log_get_to(calllog));
char* from=linphone_address_as_string(linphone_call_log_get_from(calllog));
static void linphone_call_next_video_frame_decoded_cb(LinphoneCall *call) {
LinphoneCallLog *clog = linphone_call_get_call_log(call);
char* to=linphone_address_as_string(linphone_call_log_get_to(clog));
char* from=linphone_address_as_string(linphone_call_log_get_to(clog));
stats* counters;
LinphoneCore* lc=(LinphoneCore*)user_data;
LinphoneCore* lc = linphone_call_get_core(call);
ms_message("call from [%s] to [%s] receive iFrame",from,to);
ms_free(to);
ms_free(from);
......@@ -186,6 +186,13 @@ void linphone_call_iframe_decoded_cb(LinphoneCall *call,void * user_data) {
counters->number_of_IframeDecoded++;
}
void linphone_call_set_first_video_frame_decoded_cb(LinphoneCall *call) {
LinphoneCallCbs *call_cbs = linphone_factory_create_call_cbs(linphone_factory_get());
linphone_call_cbs_set_next_video_frame_decoded(call_cbs, linphone_call_next_video_frame_decoded_cb);
linphone_call_add_callbacks(call, call_cbs);
linphone_call_cbs_unref(call_cbs);
}
#define reset_call_stats(var, value) \
if (var) linphone_call_stats_unref(var); \
var = value
......@@ -3655,9 +3662,12 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, bctbx_l
LinphoneCallStats *stats = linphone_call_get_video_stats(call);
if (video_dir != LinphoneMediaDirectionInactive){
LinphoneCallCbs *call_cbs = linphone_factory_create_call_cbs(linphone_factory_get());
BC_ASSERT_TRUE(linphone_call_params_video_enabled(params));
BC_ASSERT_EQUAL(linphone_call_params_get_video_direction(params), video_dir, int, "%d");
linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_iframe_decoded_cb,mgr->lc);
linphone_call_cbs_set_next_video_frame_decoded(call_cbs, linphone_call_next_video_frame_decoded_cb);
linphone_call_add_callbacks(call, call_cbs);
linphone_call_cbs_unref(call_cbs);
linphone_call_send_vfu_request(call);
}
switch (video_dir) {
......
......@@ -275,7 +275,7 @@ bool_t request_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bo
}
if (video_added) {
linphone_call_set_next_video_frame_decoded_callback(call_obj,linphone_call_iframe_decoded_cb,callee->lc);
linphone_call_set_first_video_frame_decoded_cb(call_obj);
/*send vfu*/
linphone_call_send_vfu_request(call_obj);
BC_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_IframeDecoded,initial_callee_stat.number_of_IframeDecoded+1));
......@@ -599,7 +599,7 @@ void video_call_base_2(LinphoneCoreManager* caller,LinphoneCoreManager* callee,
BC_ASSERT_TRUE(linphone_call_log_video_enabled(linphone_call_get_call_log(caller_call)));
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
linphone_call_set_first_video_frame_decoded_cb(callee_call);
linphone_call_send_vfu_request(callee_call);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
} else {
......@@ -622,8 +622,8 @@ static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){
/*check video path is established in both directions.
Indeed, FIR are ignored until the first RTP packet is received, because SSRC is not known.*/
linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
linphone_call_set_first_video_frame_decoded_cb(callee_call);
linphone_call_set_first_video_frame_decoded_cb(caller_call);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
......@@ -639,7 +639,7 @@ static void check_fir(LinphoneCoreManager* caller,LinphoneCoreManager* callee ){
ms_message("check_fir: [%p] received %d FIR ",&caller_call ,caller_vstream->ms_video_stat.counter_rcvd_fir);
ms_message("check_fir: [%p] stat number of iframe decoded %d ",&callee_call, callee->stat.number_of_IframeDecoded);
linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
linphone_call_set_first_video_frame_decoded_cb(caller_call);
linphone_call_send_vfu_request(caller_call);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
......@@ -878,8 +878,8 @@ static void video_call_established_by_reinvite_with_implicit_avpf(void) {
BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(callee_call)));
BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(caller_call)));
linphone_call_set_next_video_frame_decoded_callback(caller_call,linphone_call_iframe_decoded_cb,caller->lc);
linphone_call_set_next_video_frame_decoded_callback(callee_call,linphone_call_iframe_decoded_cb,callee->lc);
linphone_call_set_first_video_frame_decoded_cb(caller_call);
linphone_call_set_first_video_frame_decoded_cb(callee_call);
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&callee->stat.number_of_IframeDecoded,1));
BC_ASSERT_TRUE( wait_for(callee->lc,caller->lc,&caller->stat.number_of_IframeDecoded,1));
......@@ -1328,10 +1328,7 @@ static void accept_call_in_send_only_base(LinphoneCoreManager* pauline, Linphone
/*The send-only client shall set rtp symmetric in absence of media relay for this test.*/
lp_config_set_int(linphone_core_get_config(marie->lc),"rtp","symmetric",1);
linphone_call_set_next_video_frame_decoded_callback(linphone_core_invite_address(pauline->lc,marie->identity)
,linphone_call_iframe_decoded_cb
,pauline->lc);
linphone_call_set_first_video_frame_decoded_cb(linphone_core_invite_address(pauline->lc,marie->identity));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallIncomingReceived,1,DEFAULT_WAIT_FOR));
......
......@@ -406,7 +406,7 @@ void account_manager_destroy(void);
LinphoneAddress *account_manager_get_identity_with_modified_identity(const LinphoneAddress *modified_identity);
LinphoneCore *configure_lc_from(LinphoneCoreCbs *cbs, const char *path, const char *file, void *user_data);
void linphone_call_iframe_decoded_cb(LinphoneCall *call,void * user_data);
void linphone_call_set_first_video_frame_decoded_cb(LinphoneCall *call);
void call_paused_resumed_base(bool_t multicast,bool_t with_losses);
void simple_call_base(bool_t enable_multicast_recv_side);
void call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_relay,LinphoneFirewallPolicy policy,bool_t enable_tunnel, const char *marie_rc, const char *pauline_rc);
......
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