Commit 6f82c678 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

dtls: remove audio_stream_enable_dtls and video_stream_enable_dtls but creae...

dtls: remove audio_stream_enable_dtls and video_stream_enable_dtls but creae media_stream_enable_dtls instead
parent a8cf9830
......@@ -151,6 +151,9 @@ MS2_PUBLIC int media_stream_join_multicast_group(MediaStream *stream, const char
MS2_PUBLIC bool_t media_stream_dtls_supported(void);
/* enable DTLS on the media stream */
MS2_PUBLIC void media_stream_enable_dtls(MediaStream *stream, MSDtlsSrtpParams *params);
MS2_PUBLIC void media_stream_set_rtcp_information(MediaStream *stream, const char *cname, const char *tool);
MS2_PUBLIC void media_stream_get_local_rtp_stats(MediaStream *stream, rtp_stats_t *stats);
......@@ -619,9 +622,6 @@ MS2_PUBLIC void audio_stream_enable_zrtp(AudioStream *stream, MSZrtpParams *para
* */
bool_t audio_stream_zrtp_enabled(const AudioStream *stream);
/* enable DTLS on the audio stream */
MS2_PUBLIC void audio_stream_enable_dtls(AudioStream *stream, MSDtlsSrtpParams *params);
/* enable SRTP on the audio stream */
static MS2_INLINE bool_t audio_stream_enable_srtp(AudioStream* stream, MSCryptoSuite suite, const char* snd_key, const char* rcv_key) {
return media_stream_enable_srtp(&stream->ms, suite, snd_key, rcv_key);
......@@ -786,11 +786,11 @@ MS2_PUBLIC void video_stream_change_camera(VideoStream *stream, MSWebCam *cam);
* @brief This functions changes the source filter for the passed video stream.
* @details This is quite the same function as \ref video_stream_change_camera, but this one
* allows you to pass the source filter that is created for the camera and reuse it. This gives you the
* ability to switch rapidly between two streams, whereas re-creating them each time would be
* ability to switch rapidly between two streams, whereas re-creating them each time would be
* costly (especially with webcams).
*
* @note Since the \ref video_stream_stop() will automatically destroy the source, it is
* advised that you use \ref video_stream_stop_keep_source() instead, so that you
* @note Since the \ref video_stream_stop() will automatically destroy the source, it is
* advised that you use \ref video_stream_stop_keep_source() instead, so that you
* can manually destroy the source filters after the stream is stopped.
*
* Example usage:
......@@ -821,7 +821,7 @@ MS2_PUBLIC MSFilter* video_stream_change_source_filter(VideoStream *stream, MSWe
/**
* @brief This is the same function as \ref video_stream_change_source_filter() called with keep_source=1, but
* the new filter will be created from the MSWebcam that is passed as argument.
*
*
* @param stream the video stream
* @param cam the MSWebcam from which the new source filter should be created.
* @return the previous source filter
......@@ -935,9 +935,6 @@ MS2_PUBLIC void video_stream_send_only_stop(VideoStream *vs);
/* enable ZRTP on the video stream using information from the audio stream */
MS2_PUBLIC void video_stream_enable_zrtp(VideoStream *vstream, AudioStream *astream, MSZrtpParams *param);
/* enable DTLS on the video stream */
MS2_PUBLIC void video_stream_enable_dtls(VideoStream *stream, MSDtlsSrtpParams *params);
/* enable SRTP on the video stream */
static MS2_INLINE bool_t video_stream_enable_strp(VideoStream* stream, MSCryptoSuite suite, const char* snd_key, const char* rcv_key) {
return media_stream_enable_srtp(&stream->ms, suite, snd_key, rcv_key);
......
......@@ -128,16 +128,16 @@ static bool_t audio_stream_payload_type_changed(RtpSession *session, unsigned lo
ms_message("Ignore payload type change to CN");
return FALSE;
}
if (stream->ms.current_pt && strcasecmp(pt->mime_type, stream->ms.current_pt->mime_type)==0 && pt->clock_rate==stream->ms.current_pt->clock_rate){
ms_message("Ignoring payload type number change because it points to the same payload type as the current one");
return FALSE;
}
dec = ms_filter_create_decoder(pt->mime_type);
if (dec != NULL) {
MSFilter *nextFilter = stream->ms.decoder->outputs[0]->next.filter;
ms_message("Replacing decoder on the fly");
ms_filter_unlink(stream->ms.rtprecv, 0, stream->ms.decoder, 0);
ms_filter_unlink(stream->ms.decoder, 0, nextFilter, 0);
......@@ -432,9 +432,9 @@ static void configure_av_player(AudioStream *stream, const MSFmtDescriptor *audi
struct _AVPlayer *player=&stream->av_player;
int stream_rate=0;
int stream_channels=0;
ms_message("AudioStream [%p] Configure av_player, audiofmt=%s videofmt=%s",stream,ms_fmt_descriptor_to_string(audiofmt),ms_fmt_descriptor_to_string(videofmt));
if (audiofmt){
if (player->decoder){
if (audiofmt->nchannels>0){
......@@ -688,7 +688,7 @@ static void setup_generic_confort_noise(AudioStream *stream){
RtpProfile *prof=rtp_session_get_profile(stream->ms.sessions.rtp_session);
PayloadType *pt=rtp_profile_get_payload(prof, rtp_session_get_send_payload_type(stream->ms.sessions.rtp_session));
PayloadType *cn=rtp_profile_find_payload(prof, "CN", 8000, 1);
if (cn && pt && pt->channels==1 && pt->clock_rate==8000){
/* RFC3389 CN can be used*/
stream->vaddtx=ms_filter_new(MS_VAD_DTX_ID);
......@@ -762,12 +762,12 @@ int audio_stream_start_from_io(AudioStream *stream, RtpProfile *profile, const c
stream->dtmfgen=NULL;
rtp_session_signal_connect(rtps,"telephone-event",(RtpCallback)on_dtmf_received,stream);
rtp_session_signal_connect(rtps,"payload_type_changed",(RtpCallback)audio_stream_payload_type_changed,stream);
if (stream->ms.state==MSStreamPreparing){
/*we were using the dummy preload graph, destroy it but keep sound filters unless no soundcard is given*/
_audio_stream_unprepare_sound(stream,io->capture_card!=NULL);
}
/* creates the local part */
if (io->capture_card!=NULL){
if (stream->soundread==NULL)
......@@ -962,7 +962,7 @@ int audio_stream_start_from_io(AudioStream *stream, RtpProfile *profile, const c
}
ms_filter_call_method(stream->ms.encoder,MS_FILTER_ADD_FMTP, (void*)pt->send_fmtp);
}
configure_decoder(stream, pt, sample_rate, nchannels);
/*create the equalizer*/
......@@ -975,7 +975,7 @@ int audio_stream_start_from_io(AudioStream *stream, RtpProfile *profile, const c
}
}else
stream->equalizer=NULL;
#ifdef ANDROID
/*configure equalizer if needed*/
audio_stream_set_mic_gain_db(stream, 0);
......@@ -1591,13 +1591,6 @@ bool_t audio_stream_zrtp_enabled(const AudioStream *stream) {
return stream->ms.sessions.zrtp_context!=NULL;
}
void audio_stream_enable_dtls(AudioStream *stream, MSDtlsSrtpParams *params){
if (stream->ms.sessions.dtls_context==NULL) {
ms_message("Start DTLS audio stream context in stream sessions [%p]", &(stream->ms.sessions));
stream->ms.sessions.dtls_context=ms_dtls_srtp_context_new(&(stream->ms.sessions), params);
}
}
static void configure_av_recorder(AudioStream *stream){
if (stream->av_recorder.video_input && stream->av_recorder.recorder){
MSPinFormat pinfmt={0};
......
......@@ -81,7 +81,7 @@ MSTickerPrio __ms_get_default_prio(bool_t is_video) {
if (is_video) {
penv = getenv("MS_VIDEO_PRIO");
if(penv && _ms_ticker_prio_from_env(penv, &prio) == 0) return prio;
#ifdef __ios
return MS_TICKER_PRIO_HIGH;
#else
......@@ -90,7 +90,7 @@ MSTickerPrio __ms_get_default_prio(bool_t is_video) {
} else {
penv = getenv("MS_AUDIO_PRIO");
if (penv && _ms_ticker_prio_from_env(penv, &prio) == 0) return prio;
#ifdef __linux
return MS_TICKER_PRIO_REALTIME;
#else
......@@ -212,6 +212,13 @@ void media_stream_enable_adaptive_jittcomp(MediaStream *stream, bool_t enabled)
rtp_session_enable_adaptive_jitter_compensation(stream->sessions.rtp_session, enabled);
}
void media_stream_enable_dtls(MediaStream *stream, MSDtlsSrtpParams *params){
if (stream->sessions.dtls_context==NULL) {
ms_message("Start DTLS media stream context in stream session [%p]", &(stream->sessions));
stream->sessions.dtls_context=ms_dtls_srtp_context_new(&(stream->sessions), params);
}
}
bool_t media_stream_dtls_supported(void){
return ms_dtls_srtp_available();
}
......
......@@ -1516,13 +1516,6 @@ void video_stream_enable_zrtp(VideoStream *vstream, AudioStream *astream, MSZrtp
ms_zrtp_reset_transmition_timer(vstream->ms.sessions.zrtp_context);
}
void video_stream_enable_dtls(VideoStream *stream, MSDtlsSrtpParams *params){
if (stream->ms.sessions.dtls_context==NULL) {
ms_message("Start DTLS video stream context in stream session [%p]", &(stream->ms.sessions));
stream->ms.sessions.dtls_context=ms_dtls_srtp_context_new(&(stream->ms.sessions), params);
}
}
void video_stream_enable_display_filter_auto_rotate(VideoStream* stream, bool_t enable) {
stream->display_filter_auto_rotate_enabled = enable;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment