Merge "SDP: Ensure SDPs "merge" properly."

This commit is contained in:
Joshua Colp
2017-04-27 05:38:07 -05:00
committed by Gerrit Code Review
10 changed files with 2152 additions and 482 deletions

View File

@@ -165,6 +165,17 @@ int ast_codec_get_max(void);
*/
const char *ast_codec_media_type2str(enum ast_media_type type);
/*!
* \brief Conversion function to take a media string and convert it to a media type
*
* \param media_type_str The media type string
*
* \retval The ast_media_type that corresponds to the string
*
* \since 15.0.0
*/
enum ast_media_type ast_media_type_from_str(const char *media_type_str);
/*!
* \brief Get the number of samples contained within a frame
*

View File

@@ -146,6 +146,22 @@ struct ast_sdp {
struct ast_sdp_m_lines *m_lines;
};
/*!
* \brief A structure representing an SDP rtpmap attribute
*/
struct ast_sdp_rtpmap {
/*! The RTP payload number for the rtpmap */
int payload;
/*! The Name of the codec */
char *encoding_name;
/*! The clock rate of the codec */
int clock_rate;
/*! Optional encoding parameters */
char *encoding_parameters;
/*! Area where strings are stored */
char buf[0];
};
/*!
* \brief Free an SDP Attribute
*
@@ -545,15 +561,88 @@ struct ast_sdp *ast_sdp_alloc(struct ast_sdp_o_line *o_line,
struct ast_sdp_t_line *t_line);
/*!
* \brief Create an SDP from an existing SDP State local topology
* \brief Find an attribute on the top-level SDP
*
* \param sdp_state SDP State
* \note This will not search within streams for the given attribute.
*
* \retval non-NULL Success
* \retval NULL Failure
* \param sdp The SDP in which to search
* \param attr_name The name of the attribute to search for
* \param payload Optional payload number to search for. If irrelevant, set to -1
*
* \since 15
* \retval NULL Could not find the given attribute
* \retval Non-NULL The attribute to find
*
* \since 15.0.0
*/
struct ast_sdp *ast_sdp_create_from_state(const struct ast_sdp_state *sdp_state);
struct ast_sdp_a_line *ast_sdp_find_attribute(const struct ast_sdp *sdp,
const char *attr_name, int payload);
/*!
* \brief Find an attribute on an SDP stream (m-line)
*
* \param sdp The SDP in which to search
* \param attr_name The name of the attribute to search for
* \param payload Optional payload number to search for. If irrelevant, set to -1
*
* \retval NULL Could not find the given attribute
* \retval Non-NULL The attribute to find
*
* \since 15.0.0
*/
struct ast_sdp_a_line *ast_sdp_m_find_attribute(const struct ast_sdp_m_line *m_line,
const char *attr_name, int payload);
/*!
* \brief Convert an SDP a_line into an rtpmap
*
* The returned value is heap-allocated and must be freed with
* ast_sdp_rtpmap_free()
*
* \param a_line The SDP a_line to convert
*
* \retval NULL Fail
* \retval non-NULL Success
*
* \since 15.0.0
*/
struct ast_sdp_rtpmap *ast_sdp_a_get_rtpmap(const struct ast_sdp_a_line *a_line);
/*!
* \brief Allocate a new SDP rtpmap
*
* \param payload The RTP payload number
* \param encoding_name The human-readable name for the codec
* \param clock_rate The rate of the codec, in cycles per second
* \param encoding_parameters Optional codec-specific parameters (such as number of channels)
*
* \retval NULL Fail
* \retval non-NULL Success
*
* \since 15.0.0
*/
struct ast_sdp_rtpmap *ast_sdp_rtpmap_alloc(int payload, const char *encoding_name,
int clock_rate, const char *encoding_parameters);
/*!
* \brief Free an SDP rtpmap
*
* \since 15.0.0
*/
void ast_sdp_rtpmap_free(struct ast_sdp_rtpmap *rtpmap);
/*!
* \brief Turn an SDP into a stream topology
*
* This traverses the m-lines of the SDP and creates a stream topology, with
* each m-line corresponding to a stream in the created topology.
*
* \param sdp The SDP to convert
*
* \retval NULL An error occurred when converting
* \retval non-NULL The generated stream topology
*
* \since 15.0.0
*/
struct ast_stream_topology *ast_get_topology_from_sdp(const struct ast_sdp *sdp);
#endif /* _SDP_PRIV_H */

View File

@@ -106,7 +106,7 @@ void ast_sdp_options_set_media_address(struct ast_sdp_options *options,
*
* \returns media_address
*/
const char *ast_sdp_options_get_media_address(struct ast_sdp_options *options);
const char *ast_sdp_options_get_media_address(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -126,7 +126,7 @@ void ast_sdp_options_set_sdpowner(struct ast_sdp_options *options,
*
* \returns sdpowner
*/
const char *ast_sdp_options_get_sdpowner(struct ast_sdp_options *options);
const char *ast_sdp_options_get_sdpowner(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -146,7 +146,7 @@ void ast_sdp_options_set_sdpsession(struct ast_sdp_options *options,
*
* \returns sdpsession
*/
const char *ast_sdp_options_get_sdpsession(struct ast_sdp_options *options);
const char *ast_sdp_options_get_sdpsession(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -166,7 +166,7 @@ void ast_sdp_options_set_rtp_engine(struct ast_sdp_options *options,
*
* \returns rtp_engine
*/
const char *ast_sdp_options_get_rtp_engine(struct ast_sdp_options *options);
const char *ast_sdp_options_get_rtp_engine(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -186,7 +186,7 @@ void ast_sdp_options_set_bind_rtp_to_media_address(struct ast_sdp_options *optio
*
* \returns bind_rtp_to_media_address
*/
unsigned int ast_sdp_options_get_bind_rtp_to_media_address(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_bind_rtp_to_media_address(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -206,7 +206,7 @@ void ast_sdp_options_set_rtp_symmetric(struct ast_sdp_options *options,
*
* \returns rtp_symmetric
*/
unsigned int ast_sdp_options_get_rtp_symmetric(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_rtp_symmetric(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -226,7 +226,7 @@ void ast_sdp_options_set_telephone_event(struct ast_sdp_options *options,
*
* \returns telephone_event
*/
unsigned int ast_sdp_options_get_telephone_event(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_telephone_event(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -246,7 +246,7 @@ void ast_sdp_options_set_rtp_ipv6(struct ast_sdp_options *options,
*
* \returns rtp_ipv6
*/
unsigned int ast_sdp_options_get_rtp_ipv6(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_rtp_ipv6(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -266,7 +266,7 @@ void ast_sdp_options_set_g726_non_standard(struct ast_sdp_options *options,
*
* \returns g726_non_standard
*/
unsigned int ast_sdp_options_get_g726_non_standard(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_g726_non_standard(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -286,7 +286,7 @@ void ast_sdp_options_set_tos_audio(struct ast_sdp_options *options,
*
* \returns tos_audio
*/
unsigned int ast_sdp_options_get_tos_audio(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_tos_audio(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -306,7 +306,7 @@ void ast_sdp_options_set_cos_audio(struct ast_sdp_options *options,
*
* \returns cos_audio
*/
unsigned int ast_sdp_options_get_cos_audio(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_cos_audio(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -326,7 +326,7 @@ void ast_sdp_options_set_tos_video(struct ast_sdp_options *options,
*
* \returns tos_video
*/
unsigned int ast_sdp_options_get_tos_video(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_tos_video(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -346,7 +346,7 @@ void ast_sdp_options_set_cos_video(struct ast_sdp_options *options,
*
* \returns cos_video
*/
unsigned int ast_sdp_options_get_cos_video(struct ast_sdp_options *options);
unsigned int ast_sdp_options_get_cos_video(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -366,7 +366,7 @@ void ast_sdp_options_set_ice(struct ast_sdp_options *options,
*
* \returns ice
*/
enum ast_sdp_options_ice ast_sdp_options_get_ice(struct ast_sdp_options *options);
enum ast_sdp_options_ice ast_sdp_options_get_ice(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -386,7 +386,7 @@ void ast_sdp_options_set_impl(struct ast_sdp_options *options,
*
* \returns impl
*/
enum ast_sdp_options_impl ast_sdp_options_get_impl(struct ast_sdp_options *options);
enum ast_sdp_options_impl ast_sdp_options_get_impl(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -406,6 +406,25 @@ void ast_sdp_options_set_encryption(struct ast_sdp_options *options,
*
* \returns encryption
*/
enum ast_sdp_options_encryption ast_sdp_options_get_encryption(struct ast_sdp_options *options);
enum ast_sdp_options_encryption ast_sdp_options_get_encryption(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
* \brief Get SDP Options RTCP MUX
*
* \param options SDP Options
*
* \returns Boolean indicating if RTCP MUX is enabled.
*/
unsigned int ast_sdp_options_get_rtcp_mux(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
* \brief Set SDP Options RTCP MUX
*
* \param options SDP Options
* \param value Boolean that indicates if RTCP MUX should be enabled.
*/
void ast_sdp_options_set_rtcp_mux(struct ast_sdp_options *options, unsigned int value);
#endif /* _ASTERISK_SDP_OPTIONS_H */

View File

@@ -138,7 +138,7 @@ const void *ast_sdp_state_get_local_sdp_impl(struct ast_sdp_state *sdp_state);
*
* \since 15
*/
void ast_sdp_state_set_remote_sdp(struct ast_sdp_state *sdp_state, struct ast_sdp *sdp);
void ast_sdp_state_set_remote_sdp(struct ast_sdp_state *sdp_state, const struct ast_sdp *sdp);
/*!
* \brief Set the remote SDP from an Implementation