Streams: Add features for Advanced Codec Negotiation

The Streams API becomes the home for the core ACN capabilities.
These include...

 * Parsing and formatting of codec negotation preferences.
 * Resolving pending streams and topologies with those configured
   using configured preferences.
 * Utility functions for creating string representations of
   streams, topologies, and negotiation preferences.

For codec negotiation preferences:
 * Added ast_stream_codec_prefs_parse() which takes a string
   representation of codec negotiation preferences, which
   may come from a pjsip endpoint for example, and populates
   a ast_stream_codec_negotiation_prefs structure.
 * Added ast_stream_codec_prefs_to_str() which does the reverse.
 * Added many functions to parse individual parameter name
   and value strings to their respectrive enum values, and the
   reverse.

For streams:
 * Added ast_stream_create_resolved() which takes a "live" stream
   and resolves it with a configured stream and the negotiation
   preferences to create a new stream.
 * Added ast_stream_to_str() which create a string representation
   of a stream suitable for debug or display purposes.

For topology:
 * Added ast_stream_topology_create_resolved() which takes a "live"
   topology and resolves it, stream by stream, with a configured
   topology stream and the negotiation preferences to create a new
   topology.
 * Added ast_stream_topology_to_str() which create a string
   representation of a topology suitable for debug or display
   purposes.
 * Renamed ast_format_caps_from_topology() to
   ast_stream_topology_get_formats() to be more consistent with
   the existing ast_stream_get_formats().

Additional changes:
 * A new function ast_format_cap_append_names() appends the results
   to the ast_str buffer instead of replacing buffer contents.

Change-Id: I2df77dedd0c72c52deb6e329effe057a8e06cd56
This commit is contained in:
George Joseph
2020-06-26 10:14:58 -06:00
committed by Friendly Automation
parent 7440fd0397
commit 8d1064eaaf
10 changed files with 865 additions and 15 deletions

View File

@@ -521,7 +521,7 @@ static int compatible_formats_exist(struct ast_stream_topology *top, struct ast_
struct ast_format_cap *cap_from_top;
int res;
cap_from_top = ast_format_cap_from_stream_topology(top);
cap_from_top = ast_stream_topology_get_formats(top);
if (!cap_from_top) {
return 0;
@@ -581,7 +581,7 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
ast_format_cap_append_from_cap(caps, session->endpoint->media.codecs, AST_MEDIA_TYPE_UNKNOWN);
topology = ast_stream_topology_clone(session->endpoint->media.topology);
} else {
caps = ast_format_cap_from_stream_topology(session->pending_media_state->topology);
caps = ast_stream_topology_get_formats(session->pending_media_state->topology);
topology = ast_stream_topology_clone(session->pending_media_state->topology);
}