IPacketObserver
The definition of IPacketObserver.
onReceiveAudioPacket
Occurs when the local user receives an audio packet.
virtual bool onReceiveAudioPacket(Packet& packet) = 0;
Parameters
- packet
- The received audio packet, see Packet.
Returns
true
: The audio packet is received successfully.false
: The audio packet is discarded.
onReceiveVideoPacket
Occurs when the local user receives a video packet.
virtual bool onReceiveVideoPacket(Packet& packet) = 0;
Parameters
- packet
- The received video packet, see Packet.
Returns
true
: The video packet is received successfully.false
: The video packet is discarded.
onSendAudioPacket
Occurs when the local user sends an audio packet.
virtual bool onSendAudioPacket(Packet& packet) = 0;
Parameters
- packet
- The sent audio packet, see Packet.
Returns
true
: The audio packet is sent successfully.false
: The audio packet is discarded.
onSendVideoPacket
Occurs when the local user sends a video packet.
virtual bool onSendVideoPacket(Packet& packet) = 0;
Parameters
- packet
- The sent video packet, see Packet.
Returns
true
: The video packet is sent successfully.false
: The video packet is discarded.
onStreamMessage
Occurs when the local user receives the data stream from the remote user.
virtual void onStreamMessage(uid_t userId, int streamId, const char* data, size_t length, uint64_t sentTs) { (void)userId; (void)streamId; (void)data; (void)length; (void)sentTs; }
The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.
Parameters
- userId
- The ID of the remote user sending the message.
- streamId
- The stream ID of the received message.
- data
- The data received.
- length
- The data length (byte).
- sentTs
- The time when the data stream is sent.
onStreamMessageError
Occurs when the local user does not receive the data stream from the remote user.
virtual void onStreamMessageError(uid_t userId, int streamId, int code, int missed, int cached) { (void)userId; (void)streamId; (void)code; (void)missed; (void)cached; }
The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the sendStreamMessage method.
Parameters
- userId
- The ID of the remote user sending the message.
- streamId
- The stream ID of the received message.
- code
- Error code. See .
- missed
- The number of lost messages.
- cached
- Number of incoming cached messages when the data stream is interrupted.
onUplinkNetworkInfoUpdated
Occurs when the uplink network information changes.
virtual void onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) { (void)info; }
The SDK triggers this callback when the uplink network information changes.
Parameters
- info
- The uplink network information. See UplinkNetworkInfo.