How to add user-defined flags in Google WebRTC?

Viewed 233

This is my first question on Stack Overflow. I am currently working on the implementation of a VOIP application in which I want to send some user-defined and initialized flags from the server-side to the client-side and vice versa.

I have read documentation on RTP Header Extensions and RTP. Also, I searched for Sender Reports in RTP for sending profile-specific information, but couldn't get any help for sending that information in development code. Could anyone please help me and guide me that how can I do that? Can I add user-defined flags in RTP Headers, RTCP Header, or RTP Extension? What will be the process?

I have already tried to implement user-defined information as shown in the following images:

rtp_header_extension.h rtp_header_extension.h

rtp_header_extensions.cc rtp_header_extensions.cc

rtp_rtcp_defines.h rtp_rtcp_defines.h

rtp_header_extension_map.cc rtp_header_extension_map.cc

Any help would be greatly appreciated.

2 Answers

Is your application going to be at both ends of the call? Both peers would need to understand the RTP header extension. Likewise with any custom RTCP flags. It's unlikely this is the approach you want to take.

Alternative options to get your application data from one peer to another are:

  • Data channels.
  • It's a bit hacky but DTMF events could also be an option for small amounts of information.
  • A cutting edge option is Insertable Streams. Be aware browser support will be sporadic. The main use case of insertable streams is encryption but in theory there's no reason you couldn't add your metadata in a custom frame format.

You may refer to metadata.patch in this commit. In addition to files you mentioned, you need to modify following files:

  • modules/rtp_rtcp/source/rtp_utility.cc (modify ParseOneByteExtensionHeader function, add your own type)
  • media/engine/webrtc_video_engine.cc (modify GetCapabilities function)
  • api/rtp_headers.h, api/rtp_parameters.h, api/rtp_parameters.cc (add your own type to RTPHeaderExtension and RtpExtension)
  • modules/rtp_rtcp/source/rtp_sender_video.cc (modify SendVideo and AddRtpHeaderExtensions function, set your own extension)
  • video/rtp_video_stream_receiver.cc (modify ReceivePacket function, extract the value of your own extension)

My WebRTC version is M74.

Related