Registering for and handling events

This page describes how to register an event for a callback function and how to handle them when the event occured.

Events can be registered for a session, a send source or a receive source using RRtpXxx:RegisterEventCallbackL(), where Xxx can be Session, SendSource or ReceiveSource, for the respective source of events.

RegisterEventCallbackL(ERtpPacketReceived, GetPacket, aPtr, ERtpOneShot);

In the above call, the event ERtpPacketReceived is registered to the callback function GetPacket(). ERtpOneShot indicates that the callback function can be called only once.

TRtpEvent provides a handle to an RTP session, send stream or receive stream event. The event types supported by TRtpEventType are passed to RegisterEventCallbackL(), so that the registered callback function is called for the specified event.

Some of the event types supported by TRtpEventType that may be handled are given below:

  • ERtpAnyEvent is called for any event failures.

  • Event types related to the session:

    • ERtpSessionFail indicates a session-level error.

    • ERtpSessionEventEnd defines the upper limit for session event type values.

  • Event types related to the send stream:

    • ERtpSendFail indicates an error has occurred while sending a packet.

    • ERtpSendSucceeded indicates a send packet operation has succeeded.

  • Event types related to the reception stream:

    • ERtpNewSource indicates that a new stream has been received.

    • ERtpPacketReceived indicates that an in-sequence packet has been received.

  • Event types related to non-RTP data:

    • ENonRtpDataReceived indicates that non-RTP data has been received on the RTP socket.

    • ENonRtcpDataReceived indicates that non-RTP data has been received on the RTCP socket.