Add a callback to get TMMBR values

This commit is contained in:
Mickaël Turnel 2017-09-11 14:42:36 +02:00
parent a554ad1c91
commit 81cb216c22
4 changed files with 40 additions and 0 deletions

View file

@ -144,6 +144,14 @@ void linphone_call_cbs_set_ack_processing(LinphoneCallCbs *cbs, LinphoneCallCbsA
cbs->ack_processing = cb;
}
LinphoneCallCbsTmmbrReceivedCb linphone_call_cbs_get_tmmbr_received(LinphoneCallCbs *cbs) {
return cbs->tmmbr_received_cb;
}
void linphone_call_cbs_set_tmmbr_received(LinphoneCallCbs *cbs, LinphoneCallCbsTmmbrReceivedCb cb) {
cbs->tmmbr_received_cb = cb;
}
bool_t linphone_call_state_is_early(LinphoneCallState state){
switch (state){
@ -4860,6 +4868,10 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){
/* If this event happens then it should be a video stream */
if (stream_index == call->main_video_stream_index)
stats->estimated_download_bandwidth = (float)(evd->info.video_bandwidth_available)*1e-3;
} else if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) {
if (rtcp_RTPFB_get_type(evd->packet) == RTCP_RTPFB_TMMBR) {
linphone_call_notify_tmmbr_received(call, stream_index, (int)rtcp_RTPFB_tmmbr_get_max_bitrate(evd->packet));
}
}
ortp_event_destroy(ev);
}
@ -6235,3 +6247,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) {
NOTIFY_IF_EXIST(ack_processing, call, msg, is_received)
}
void linphone_call_notify_tmmbr_received(LinphoneCall *call, int stream_index, int tmmbr) {
NOTIFY_IF_EXIST(tmmbr_received_cb, call, stream_index, tmmbr)
}

View file

@ -309,6 +309,7 @@ struct _LinphoneCallCbs {
LinphoneCallCbsStatsUpdatedCb stats_updated_cb;
LinphoneCallCbsTransferStateChangedCb transfer_state_changed_cb;
LinphoneCallCbsAckProcessingCb ack_processing;
LinphoneCallCbsTmmbrReceivedCb tmmbr_received_cb;
};
LinphoneCallCbs * _linphone_call_cbs_new(void);
@ -420,6 +421,7 @@ void linphone_call_notify_transfer_state_changed(LinphoneCall *call, LinphoneCal
void linphone_call_notify_stats_updated(LinphoneCall *call, const LinphoneCallStats *stats);
void linphone_call_notify_info_message_received(LinphoneCall *call, const LinphoneInfoMessage *msg);
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);
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op);

View file

@ -684,6 +684,20 @@ LINPHONE_PUBLIC LinphoneCallCbsAckProcessingCb linphone_call_cbs_get_ack_process
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_ack_processing(LinphoneCallCbs *cbs, LinphoneCallCbsAckProcessingCb cb);
/**
* Get the TMMBR received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current TMMBR received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsTmmbrReceivedCb linphone_call_cbs_get_tmmbr_received(LinphoneCallCbs *cbs);
/**
* Set the TMMBR received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The TMMBR received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_tmmbr_received(LinphoneCallCbs *cbs, LinphoneCallCbsTmmbrReceivedCb cb);
/**
* @}
*/

View file

@ -134,6 +134,14 @@ typedef void (*LinphoneCallCbsTransferStateChangedCb)(LinphoneCall *call, Linpho
*/
typedef void (*LinphoneCallCbsAckProcessingCb)(LinphoneCall *call, LinphoneHeaders *ack, bool_t is_received);
/**
* Callback for notifying a received TMMBR.
* @param call LinphoneCall for which the TMMBR has changed
* @param stream_index the index of the current stream
* @param tmmbr the value of the received TMMBR
*/
typedef void (*LinphoneCallCbsTmmbrReceivedCb)(LinphoneCall *call, int stream_index, int tmmbr);
/**
* @}
**/