Skip to content

Interceptor Framework for RTP/RTCP Processing or Direct RTP/RTCP Access for Custom Packetization #220

Description

@kinsleykajiva

Is your feature request related to a problem? Please describe.

There's currently no way to intercept, modify, or inject custom encoders, transform packets, or interoperate into the RTP/RTCP packet processing pipeline. This prevents implementing:
Enhanced monitoring (inspect packet-level metrics (jitter, packet loss patterns, RTT)) , Custom FEC (forward error correction) schemes , Research and experimentation (Cannot prototype new RTP extensions or RTCP feedback mechanisms)

Describe the solution you'd like

Expose RTP/RTCP send and receive hooks via a MediaStreamTrack or RtpTransceiver API. This should allow access to RtpReceiver and RtpSender transport streams .

Implement a pluggable interceptor framework similar to Pion's interceptor package, allowing developers to insert custom processing logic into the media pipeline:

  1. Interceptor Interface:

    interfaceInterceptor {
    // Called for each outgoing RTP packetRTCRtpPacketinterceptRTP(RTCRtpPacketpacket, RTCRtpSendersender);
    // Called for each incoming RTP packetRTCRtpPacketinterceptIncomingRTP(RTCRtpPacketpacket, RTCRtpReceiverreceiver);
    // Called for outgoing RTCP packetsRTCRtcpPacketinterceptRTCP(RTCRtcpPacketpacket);
    // Called for incoming RTCP packetsRTCRtcpPacketinterceptIncomingRTCP(RTCRtcpPacketpacket);
    }
  2. Interceptor Chain Management:

    interfaceInterceptorRegistry {
    voidadd(Interceptorinterceptor);
    voidremove(Interceptorinterceptor);
    List<Interceptor> getInterceptors();
    }
    // UsagepeerConnection.getInterceptorRegistry().add(newCustomInterceptor());
  3. Built-in Interceptors: Provide commonly-needed interceptors:

  4. Packet Access Objects: Expose packet structures:

    classRTCRtpPacket {
    RTCRtpHeaderheader;
    byte[] payload;
    List<RTCRtpHeaderExtension> extensions;
    }
    classRTCRtpHeader {
    intpayloadType;
    intsequenceNumber;
    longtimestamp;
    longssrc;
    List<Long> csrcs;
    }

Describe alternatives you've considered

Tried to implement own interface but due to local dev complications with webrtc code base and JNI complexity but ran into a wall trying to do this , hence this request .

Additional context

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions