webrtcsink already supported instantiating a data channel for the sole purpose of carrying navigation events from the consumer to the producer, it can also now create a generic control data channel through which the consumer can send JSON requests in the form:
{
"id": identifier used in the response message,
"mid": optional media identifier the request applies to,
"request": {
"type": currently "navigationEvent" and "customUpstreamEvent" are supported,
"type-specific-field": ...
}
}
The producer will reply with such messages:
{
"id": identifier of the request,
"error": optional error message, successful if not set
}
The example frontend was also updated with a text area for sending any arbitrary request.
The use case for this work was to make it possible for a consumer to control the mix matrix used for the audio stream, with such a pipeline running on the producer side:
gst-launch-1.0 audiotestsrc ! audioconvert ! webrtcsink enable-control-data-channel=true
As audioconvert
now supports setting a mix matrix through a custom upstream event,
the consumer can simply input the following text in the request field of the frontend
to reverse the channels of a stereo audio stream:
{
"type": "customUpstreamEvent",
"structureName": "GstRequestAudioMixMatrix",
"structure": {
"matrix": [[0.0, 1.0], [1.0, 0.0]]
}
}