PortSIP VoIP SDK Manual for Mac  15.1
PortSIP features our newest, supported, quality-assured VoIP SDK used by Several hundred companies around the world for easy VoIP application develop and quality-assured code.
Functions
Audio and video stream callback events

Functions

(void) - <PortSIPEventDelegate >::onAudioRawCallback:audioCallbackMode:data:dataLength:samplingFreqHz:
 
(int) - <PortSIPEventDelegate >::onVideoRawCallback:videoCallbackMode:width:height:data:dataLength:
 
(void) - <PortSIPEventDelegate >::onVideoDecoderCallback:width:height:framerate:bitrate:
 

Detailed Description

Function Documentation

§ onAudioRawCallback:audioCallbackMode:data:dataLength:samplingFreqHz:()

- (void PortSIPEventDelegate) onAudioRawCallback: (long)  sessionId
audioCallbackMode: (int)  audioCallbackMode
data: (unsigned char *)  data
dataLength: (int)  dataLength
samplingFreqHz: (int)  samplingFreqHz 

This event will be triggered once receiving the audio packets when enableAudioStreamCallback function is called.

Parameters
sessionIdThe session ID of the call.
audioCallbackModeThe type that is passed in enableAudioStreamCallback function.
dataThe memory of audio stream. It's in PCM format.
dataLengthThe data size.
samplingFreqHzThe audio stream sample in HZ. For example, it could be 8000 or 16000.
Note
Don't call any SDK API functions in this event directly. If you want to call the API functions or other code which is time-consuming, you should post a message to another thread and execute SDK API functions or other code in another thread.

§ onVideoRawCallback:videoCallbackMode:width:height:data:dataLength:()

- (int PortSIPEventDelegate) onVideoRawCallback: (long)  sessionId
videoCallbackMode: (int)  videoCallbackMode
width: (int)  width
height: (int)  height
data: (unsigned char *)  data
dataLength: (int)  dataLength 

This event will be triggered once received the video packets if called enableVideoStreamCallback function.

Parameters
sessionIdThe session ID of the call.
videoCallbackModeThe type which is passed in enableVideoStreamCallback function.
widthThe width of video image.
heightThe height of video image.
dataThe memory of video stream. It's in YUV420 format, such as YV12.
dataLengthThe data size.
Returns
If you changed the sent video data, dataLength should be returned, otherwise 0.
Note
Don't call any SDK API functions in this event directly. If you want to call the API functions or other code which is time-consuming, you should post a message to another thread and execute SDK API functions or other code in another thread.

§ onVideoDecoderCallback:width:height:framerate:bitrate:()

- (void PortSIPEventDelegate) onVideoDecoderCallback: (long)  sessionId
width: (int)  width
height: (int)  height
framerate: (int)  framerate
bitrate: (int)  bitrate 

This event will be triggered once per second containing the frame rate and bit rate for the incoming stream or new incoming Video size is detected, if called enableVideoDecoderCallback function.

Parameters
sessionIdThe session ID of the call.
widthThe width of video image.
heightThe height of video image.
framerateThe frame rate of video.
bitrateThe bitrate of video codec.
Note
Don't call any SDK API functions in this event directly. If you want to call the API functions or other code which is time-consuming, you should post a message to another thread and execute SDK API functions or other code in another thread.