summaryrefslogtreecommitdiff
path: root/libavformat/sdp.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-12-12 12:59:41 +0200
committerMartin Storsjö <martin@martin.st>2013-01-15 11:55:29 +0200
commit611bf39bde603adb15a7f298e4a4fd783330d1c9 (patch)
treeab5f0505f6c60daae3c88ba67a79ec436dcc351a /libavformat/sdp.c
parent2f3bada63e57345329c4f9b48e9b81b5cfc03d05 (diff)
sdp: Include SRTP crypto params if using the srtp protocol
Also print port numbers for this protocol. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/sdp.c')
-rw-r--r--libavformat/sdp.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 57044d4c51..186f83b1a0 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -128,7 +128,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
*ttl = 0;
- if (strcmp(proto, "rtp")) {
+ if (strcmp(proto, "rtp") && strcmp(proto, "srtp")) {
/* The url isn't for the actual rtp sessions,
* don't parse out anything else than the destination.
*/
@@ -667,6 +667,19 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
av_strlcatf(buf, size,
"a=control:streamid=%d\r\n", i + j);
}
+ if (ac[i]->pb && ac[i]->pb->av_class) {
+ uint8_t *crypto_suite = NULL, *crypto_params = NULL;
+ av_opt_get(ac[i]->pb, "srtp_out_suite", AV_OPT_SEARCH_CHILDREN,
+ &crypto_suite);
+ av_opt_get(ac[i]->pb, "srtp_out_params", AV_OPT_SEARCH_CHILDREN,
+ &crypto_params);
+ if (crypto_suite && crypto_suite[0])
+ av_strlcatf(buf, size,
+ "a=crypto:1 %s inline:%s\r\n",
+ crypto_suite, crypto_params);
+ av_free(crypto_suite);
+ av_free(crypto_params);
+ }
}
}