Skip to content

Commit

Permalink
msrtp: configurable media source id in VSR
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaakon committed Dec 4, 2018
1 parent 0c899fc commit 895390a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/api/sipe-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,11 @@ void sipe_core_status_set(struct sipe_core_public *sipe_public,
* of @c buffer MUST be at least @c SIPE_MSRTP_VSR_HEADER_LEN +
* @c SIPE_MSRTP_VSR_ENTRY_LEN.
* @param payload_type (in) payload ID of the codec negotiated with the peer.
* @param media_source_id (in) ID of the video stream to request.
*/
void sipe_core_msrtp_write_video_source_request(guint8 *buffer,
guint8 payload_type);
guint8 payload_type,
guint32 media_source_id);

/**
* Fills @buffer with customized Payload Content Scalability Information packet
Expand Down
5 changes: 3 additions & 2 deletions src/core/sipe-msrtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ enum

void
sipe_core_msrtp_write_video_source_request(guint8 *buffer,
guint8 payload_type)
guint8 payload_type,
guint32 media_source_id)
{
static guint8 bit_rate_histogram[] = {
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Expand All @@ -123,7 +124,7 @@ sipe_core_msrtp_write_video_source_request(guint8 *buffer,
SIPE_WRITE_UINT16_BE(buffer, SIPE_MSRTP_VSR_HEADER_LEN +
SIPE_MSRTP_VSR_ENTRY_LEN);
// Requested Media Source ID
SIPE_WRITE_UINT32_BE(buffer, SIPE_MSRTP_VSR_SOURCE_ANY);
SIPE_WRITE_UINT32_BE(buffer, media_source_id);
SIPE_WRITE_UINT16_BE(buffer, 1); // Request Id
SIPE_WRITE_UINT16_BE(buffer, 0); // Reserve1
SIPE_WRITE_UINT8(buffer, 0); // Version
Expand Down
9 changes: 5 additions & 4 deletions src/purple/purple-media.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ stream_writable_cb(SIPE_UNUSED_PARAMETER PurpleMediaManager *manager,

static gboolean
write_ms_h264_video_source_request(GstRTCPBuffer *buffer, guint32 ssrc,
guint8 payload_type)
guint8 payload_type, guint32 media_source_id)
{
GstRTCPPacket packet;
guint8 *fci_data;
Expand All @@ -558,7 +558,7 @@ write_ms_h264_video_source_request(GstRTCPBuffer *buffer, guint32 ssrc,

gst_rtcp_packet_fb_set_type(&packet, GST_RTCP_PSFB_TYPE_AFB);
gst_rtcp_packet_fb_set_sender_ssrc(&packet, ssrc);
gst_rtcp_packet_fb_set_media_ssrc(&packet, SIPE_MSRTP_VSR_SOURCE_ANY);
gst_rtcp_packet_fb_set_media_ssrc(&packet, media_source_id);

if (!gst_rtcp_packet_fb_set_fci_length(&packet,
SIPE_MSRTP_VSR_FCI_WORDLEN)) {
Expand All @@ -568,7 +568,8 @@ write_ms_h264_video_source_request(GstRTCPBuffer *buffer, guint32 ssrc,

fci_data = gst_rtcp_packet_fb_get_fci(&packet);

sipe_core_msrtp_write_video_source_request(fci_data, payload_type);
sipe_core_msrtp_write_video_source_request(fci_data, payload_type,
media_source_id);

return TRUE;
}
Expand All @@ -595,7 +596,7 @@ on_sending_rtcp_cb(SIPE_UNUSED_PARAMETER GObject *rtpsession,

gst_rtcp_buffer_map(buffer, GST_MAP_READWRITE, &rtcp_buffer);
was_changed = write_ms_h264_video_source_request(&rtcp_buffer,
ssrc, send_codec->id);
ssrc, send_codec->id, SIPE_MSRTP_VSR_SOURCE_ANY);
gst_rtcp_buffer_unmap(&rtcp_buffer);
}

Expand Down

0 comments on commit 895390a

Please sign in to comment.