mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
bridging: Add better support for adding/removing streams.
This change adds support to bridge_softmix to allow the addition and removal of additional video source streams. When such a change occurs each participant is renegotiated as needed to reflect the update. If another video source is added then each participant gets another source. If a video source is removed then it is removed from each participant. This functionality allows you to have both your webcam and screenshare providing video if you desire, or even more streams. Mapping has been changed to use the topology index on the source channel as a unique identifier for outgoing participant streams, this will never change and provides an easy way to establish the mapping. The bridge_simple and bridge_native_rtp modules have also been updated to renegotiate when the stream topology of a party changes allowing the same behavior to occur as added to bridge_softmix. If a screen share is added then the opposite party is renegotiated. If that screen share is removed then the opposite party is renegotiated again. Some additional fixes are also included in here. Stream state is now conveyed in SDP so sendonly/recvonly/inactive streams can be requested. Removed streams now also remove previous state from themselves so consumers don't get confused. ASTERISK-28733 Change-Id: I93f41fb41b85646bef71408111c17ccea30cb0c5
This commit is contained in:
committed by
Joshua Colp
parent
a6de4497e6
commit
5a5be92b79
@@ -96,8 +96,9 @@ struct ast_stream_topology {
|
||||
struct ast_stream *ast_stream_alloc(const char *name, enum ast_media_type type)
|
||||
{
|
||||
struct ast_stream *stream;
|
||||
size_t name_len = MAX(strlen(S_OR(name, "")), 7); /* Ensure there is enough room for 'removed' */
|
||||
|
||||
stream = ast_calloc(1, sizeof(*stream) + strlen(S_OR(name, "")) + 1);
|
||||
stream = ast_calloc(1, sizeof(*stream) + name_len + 1);
|
||||
if (!stream) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -113,16 +114,16 @@ struct ast_stream *ast_stream_alloc(const char *name, enum ast_media_type type)
|
||||
struct ast_stream *ast_stream_clone(const struct ast_stream *stream, const char *name)
|
||||
{
|
||||
struct ast_stream *new_stream;
|
||||
size_t stream_size;
|
||||
const char *stream_name;
|
||||
size_t name_len;
|
||||
|
||||
if (!stream) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream_name = name ?: stream->name;
|
||||
stream_size = sizeof(*stream) + strlen(stream_name) + 1;
|
||||
new_stream = ast_calloc(1, stream_size);
|
||||
name_len = MAX(strlen(stream_name), 7); /* Ensure there is enough room for 'removed' */
|
||||
new_stream = ast_calloc(1, sizeof(*stream) + name_len + 1);
|
||||
if (!new_stream) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -205,6 +206,19 @@ void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state
|
||||
ast_assert(stream != NULL);
|
||||
|
||||
stream->state = state;
|
||||
|
||||
/* When a stream is set to removed that means that any previous data for it
|
||||
* is no longer valid. We therefore change its name to removed and remove
|
||||
* any old metadata associated with it.
|
||||
*/
|
||||
if (state == AST_STREAM_STATE_REMOVED) {
|
||||
strcpy(stream->name, "removed");
|
||||
ast_variables_destroy(stream->metadata);
|
||||
stream->metadata = NULL;
|
||||
if (stream->formats) {
|
||||
ast_format_cap_remove_by_type(stream->formats, AST_MEDIA_TYPE_UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *ast_stream_state2str(enum ast_stream_state state)
|
||||
|
Reference in New Issue
Block a user