Beispiel #1
0
err_status_t
srtp_test_remove_stream() { 
  err_status_t status;
  srtp_policy_t *policy_list;
  srtp_t session;
  srtp_stream_t stream;
  /* 
   * srtp_get_stream() is a libSRTP internal function that we declare
   * here so that we can use it to verify the correct operation of the
   * library
   */ 
  extern srtp_stream_t srtp_get_stream(srtp_t srtp, uint32_t ssrc);
  

  status = srtp_create_big_policy(&policy_list);
  if (status)
    return status;

  status = srtp_create(&session, policy_list);
  if (status)
    return status;

  /*
   * check for false positives by trying to remove a stream that's not
   * in the session
   */
  status = srtp_remove_stream(session, htonl(0xaaaaaaaa));
  if (status != err_status_no_ctx)
    return err_status_fail;
  
  /* 
   * check for false negatives by removing stream 0x1, then
   * searching for streams 0x0 and 0x2
   */
  status = srtp_remove_stream(session, htonl(0x1));
  if (status != err_status_ok)
    return err_status_fail;
  stream = srtp_get_stream(session, htonl(0x0));
  if (stream == NULL)
    return err_status_fail;
  stream = srtp_get_stream(session, htonl(0x2));
  if (stream == NULL)
    return err_status_fail;  

  return err_status_ok;  
}
Beispiel #2
0
static void
gst_srtp_dec_remove_stream (GstSrtpDec * filter, guint ssrc)
{
  GstSrtpDecSsrcStream *stream = NULL;

  if (filter->streams == NULL)
    return;

  stream = g_hash_table_lookup (filter->streams, GUINT_TO_POINTER (ssrc));

  if (stream) {
    srtp_remove_stream (filter->session, ssrc);
    g_hash_table_remove (filter->streams, GUINT_TO_POINTER (ssrc));
  }
}