This happens because in the janus_streaming_create_rtsp_source() → janus_streaming_rtsp_connect_to_server() process,
the janus_streaming_rtp_source_stream is created without adding the index to the GHashTable media_byid.
However, in the janus_streaming_create_rtp_source() function, the index is explicitly added to the GHashTable media_byid.
IIRC we only map RTP, not RTCP. Besides, RTSP mountpoints in the Streaming plugin don’t support more than one audio and one video stream, which means using -1 as a mindex is enough to get it working. Pure RTP mountpoints can have multiple audio and video streams, and so those need to be indexed accordingly to the m-line they’re associated with.
Lorenzo, Thanks for an answer.
I am one of the people who loves janus.
(My english is not that good.)
I understood. What I wanted to say is …
Big if needed, if include the following REFERENCE code,
the janus_streaming_incoming_rtcp() function can find the stream using mindex and handle the RTCP.
The REFERENCE code is part of the code in the janus_streaming_create_rtp_source() function.
static int janus_streaming_rtsp_connect_to_server(janus_streaming_mountpoint *mp) {
...
// *REFERENCE* ->
/* Map this stream by mindex */
g_hash_table_insert(live_rtp_source->media_byid, GINT_TO_POINTER(stream->mindex), stream);
// <- *REFERENCE*
/* Map this stream by all its file descriptors */
...
if(stream->fd[0] != -1)
g_hash_table_insert(source->media_byfd, GINT_TO_POINTER(stream->fd[0]), stream);
}