parse_keymgmt (const gchar * keymgmt, GstCaps * caps)
{
gboolean res = FALSE;
- gchar *p, *kmpid;
gsize size;
guchar *data;
GstMIKEYMessage *msg;
const gchar *srtp_cipher;
const gchar *srtp_auth;
- p = (gchar *) keymgmt;
+ {
+ gchar *orig_value;
+ gchar *p, *kmpid;
- SKIP_SPACES (p);
- if (*p == '\0')
- return FALSE;
+ p = orig_value = g_strdup (keymgmt);
- PARSE_STRING (p, " ", kmpid);
- if (!g_str_equal (kmpid, "mikey"))
- return FALSE;
+ SKIP_SPACES (p);
+ if (*p == '\0') {
+ g_free (orig_value);
+ return FALSE;
+ }
+
+ PARSE_STRING (p, " ", kmpid);
+ if (kmpid == NULL || !g_str_equal (kmpid, "mikey")) {
+ g_free (orig_value);
+ return FALSE;
+ }
+ data = g_base64_decode (p, &size);
+
+ g_free (orig_value); /* Don't need this any more */
+ }
- data = g_base64_decode (p, &size);
if (data == NULL)
return FALSE;
gst_buffer_new_wrapped (g_memdup (pkd->key_data, pkd->key_len),
pkd->key_len);
gst_caps_set_simple (caps, "srtp-key", GST_TYPE_BUFFER, buf, NULL);
+ gst_buffer_unref (buf);
}
gst_caps_set_simple (caps,
switch (int_code) {
case GST_RTSP_STS_UNAUTHORIZED:
+ case GST_RTSP_STS_NOT_FOUND:
if (gst_rtspsrc_setup_auth (src, response)) {
/* Try the request/response again after configuring the auth info
* and loop again */
GstBuffer *buf;
guint8 *key_data;
#define KEY_SIZE 30
+ guint data_size = GST_ROUND_UP_4 (KEY_SIZE);
/* create a random key */
- key_data = g_malloc (KEY_SIZE);
- for (i = 0; i < KEY_SIZE; i += 4)
+ key_data = g_malloc (data_size);
+ for (i = 0; i < data_size; i += 4)
GST_WRITE_UINT32_BE (key_data + i, g_random_int ());
buf = gst_buffer_new_wrapped (key_data, KEY_SIZE);