Monday, November 9, 2015

Linphone Bandwidth calculation for a call



Lets consider an incoming call. this is done by calling linphone_core_accept_call_with_params. This method accepts the LinphoneCall which is to be accepted and 
the LinphoneCallParams for accepting the call. Internally this calls sal_call_accept. Now this methods creates a response 200 with the help of method 
sal_op_create_response_from_request. In this method, it adds the headers such as Contact, Allow, Expires, any custom headers etc. It then calls handle_offer_answer_response 
which internally creates the sdp_answer from the remote media description. Here it extracts the h->bandwidth from the remote media description. 
the SDP is now set to the answer response. This response is sent back to the remote using the belle_sip_server_transaction_send_response 

Now it needs to create the New Media description using the method sal_call_get_final_media_description 

Now it calls linphone_core_update_streams. Internally it calls linphone_call_start_media_streams as the streams has to be started from the receiver end. 
It then internally calls linphone_call_start_audio_stream which calls make_profile and the resultant profile is set to the AudioCall. 

When making the profile is where the bandwidth related checks are done. It calls the method get_ideal_audio_bw which has the logic like below 

If the client Application specifies any upload bandwidth, 

it finds then the minimum of the bandwidth by considering the remote bandwidth and the upload bandwidth specified in the file. 
It then calls the method linphone_core_update_allocated_audio_bandwidth_in_call which is called with PayloadType and the maxbw 
if the payload type is vbr, then the updated bandwidth is considered. 



references:

No comments:

Post a Comment