void text_stream_stop(TextStream *stream) {
	if (stream->ms.sessions.ticker) {
		if (stream->ms.state == MSStreamPreparing) {
			text_stream_unprepare_text(stream);
		} else if (stream->ms.state == MSStreamStarted) {
			MSConnectionHelper h;
			stream->ms.state = MSStreamStopped;
			ms_ticker_detach(stream->ms.sessions.ticker, stream->rttsource);
			ms_ticker_detach(stream->ms.sessions.ticker, stream->ms.rtprecv);
			
			if (stream->ms.ice_check_list != NULL) {
				ice_check_list_print_route(stream->ms.ice_check_list, "Text session's route");
				stream->ms.ice_check_list = NULL;
			}
			
			rtp_stats_display(rtp_session_get_stats(stream->ms.sessions.rtp_session),
					"             TEXT SESSION'S RTP STATISTICS                ");
			
			ms_connection_helper_start(&h);
			ms_connection_helper_unlink(&h, stream->rttsource, -1, 0);
			ms_connection_helper_unlink(&h, stream->ms.rtpsend, 0, -1);
			ms_connection_helper_start(&h);
			ms_connection_helper_unlink(&h, stream->ms.rtprecv, -1, 0);
			ms_connection_helper_unlink(&h, stream->rttsink, 0, -1);
		}
	}
	
	text_stream_free(stream);
	ms_filter_log_statistics();
}
Example #2
0
void
video_stream_stop (VideoStream * stream)
{
	stream->eventcb = NULL;
	stream->event_pointer = NULL;
	if (stream->ticker){
		if (stream->voidsink) {
			stop_preload_graph(stream);
		} else {
			if (stream->source)
				ms_ticker_detach(stream->ticker,stream->source);
			if (stream->rtprecv)
				ms_ticker_detach(stream->ticker,stream->rtprecv);

			if (stream->ice_check_list != NULL) {
				ice_check_list_print_route(stream->ice_check_list, "Video session's route");
				stream->ice_check_list = NULL;
			}
			rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics");

			if (stream->source){
				ms_filter_unlink(stream->source,0,stream->pixconv,0);
				ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0);
				ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0);
				ms_filter_unlink(stream->tee,0,stream->encoder,0);
				ms_filter_unlink(stream->encoder, 0, stream->rtpsend,0);
				if (stream->output2){
					ms_filter_unlink(stream->tee,1,stream->output2,0);
				}
			}
			if (stream->rtprecv){
				MSConnectionHelper h;
				ms_connection_helper_start (&h);
				ms_connection_helper_unlink (&h,stream->rtprecv,-1,0);
				ms_connection_helper_unlink (&h,stream->decoder,0,0);
				if (stream->tee2){
					ms_connection_helper_unlink (&h,stream->tee2,0,0);
					ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0);
				}
				if(stream->output)
					ms_connection_helper_unlink (&h,stream->output,0,-1);
				if (stream->tee && stream->output && stream->output2==NULL)
					ms_filter_unlink(stream->tee,1,stream->output,1);
			}
		}
	}
	video_stream_free (stream);
}
void audio_stream_stop(AudioStream * stream)
{
	if (stream->ms.ticker){
		MSConnectionHelper h;
		
		if (stream->dummy){
			stop_preload_graph(stream);
		}else if (stream->ms.start_time!=0){
		
			ms_ticker_detach(stream->ms.ticker,stream->soundread);
			ms_ticker_detach(stream->ms.ticker,stream->ms.rtprecv);

			if (stream->ms.ice_check_list != NULL) {
				ice_check_list_print_route(stream->ms.ice_check_list, "Audio session's route");
				stream->ms.ice_check_list = NULL;
			}
			rtp_stats_display(rtp_session_get_stats(stream->ms.session),
				"             AUDIO SESSION'S RTP STATISTICS                ");

			/*dismantle the outgoing graph*/
			ms_connection_helper_start(&h);
			ms_connection_helper_unlink(&h,stream->soundread,-1,0);
			if (stream->read_resampler!=NULL)
				ms_connection_helper_unlink(&h,stream->read_resampler,0,0);
			if (stream->ec!=NULL)
				ms_connection_helper_unlink(&h,stream->ec,1,1);
			if (stream->volsend!=NULL)
				ms_connection_helper_unlink(&h,stream->volsend,0,0);
			if (stream->dtmfgen_rtp)
				ms_connection_helper_unlink(&h,stream->dtmfgen_rtp,0,0);
			if (stream->send_tee)
				ms_connection_helper_unlink(&h,stream->send_tee,0,0);
			ms_connection_helper_unlink(&h,stream->ms.encoder,0,0);
			ms_connection_helper_unlink(&h,stream->ms.rtpsend,0,-1);

			/*dismantle the receiving graph*/
			ms_connection_helper_start(&h);
			ms_connection_helper_unlink(&h,stream->ms.rtprecv,-1,0);
			ms_connection_helper_unlink(&h,stream->ms.decoder,0,0);
			if (stream->plc!=NULL)
				ms_connection_helper_unlink(&h,stream->plc,0,0);
			if (stream->dtmfgen!=NULL)
				ms_connection_helper_unlink(&h,stream->dtmfgen,0,0);
			if (stream->volrecv!=NULL)
				ms_connection_helper_unlink(&h,stream->volrecv,0,0);
			if (stream->recv_tee)
				ms_connection_helper_unlink(&h,stream->recv_tee,0,0);
			if (stream->equalizer!=NULL)
				ms_connection_helper_unlink(&h,stream->equalizer,0,0);
			if (stream->ec!=NULL)
				ms_connection_helper_unlink(&h,stream->ec,0,0);
			if (stream->write_resampler!=NULL)
				ms_connection_helper_unlink(&h,stream->write_resampler,0,0);
			ms_connection_helper_unlink(&h,stream->soundwrite,0,-1);
			
			/*dismantle the call recording */
			if (stream->recorder){
				ms_filter_unlink(stream->send_tee,1,stream->recorder_mixer,0);
				ms_filter_unlink(stream->recv_tee,1,stream->recorder_mixer,1);
				ms_filter_unlink(stream->recorder_mixer,0,stream->recorder,0);
			}
		}
	}
	audio_stream_free(stream);
	ms_filter_log_statistics();
}
Example #4
0
void
video_stream_stop (VideoStream * stream)
{
	stream->eventcb = NULL;
	stream->event_pointer = NULL;
	if (stream->ms.ticker){
		if (stream->prepare_ongoing == TRUE) {
			stop_preload_graph(stream);
		} else {
			if (stream->source)
				ms_ticker_detach(stream->ms.ticker,stream->source);
			if (stream->ms.rtprecv)
				ms_ticker_detach(stream->ms.ticker,stream->ms.rtprecv);

			if (stream->ms.ice_check_list != NULL) {
				ice_check_list_print_route(stream->ms.ice_check_list, "Video session's route");
				stream->ms.ice_check_list = NULL;
			}
			rtp_stats_display(rtp_session_get_stats(stream->ms.session),
				"             VIDEO SESSION'S RTP STATISTICS                ");

			if (stream->source){
				MSConnectionHelper ch;
				ms_connection_helper_start(&ch);
				ms_connection_helper_unlink(&ch, stream->source, -1, 0);
				if (stream->pixconv) {
					ms_connection_helper_unlink(&ch, stream->pixconv, 0, 0);
				}
				if (stream->sizeconv) {
					ms_connection_helper_unlink(&ch, stream->sizeconv, 0, 0);
				}
				ms_connection_helper_unlink(&ch, stream->tee, 0, 0);
				if (stream->source_performs_encoding == FALSE) {
					ms_connection_helper_unlink(&ch, stream->ms.encoder, 0, 0);
				}
				ms_connection_helper_unlink(&ch, stream->ms.rtpsend, 0, -1);
				if (stream->output2){
					ms_filter_unlink(stream->tee,1,stream->output2,0);
				}
			}
			if (stream->ms.voidsink) {
				ms_filter_unlink(stream->ms.rtprecv, 0, stream->ms.voidsink, 0);
			} else if (stream->ms.rtprecv){
				MSConnectionHelper h;
				ms_connection_helper_start (&h);
				ms_connection_helper_unlink (&h,stream->ms.rtprecv,-1,0);
				if (stream->output_performs_decoding == FALSE) {
					ms_connection_helper_unlink (&h,stream->ms.decoder,0,0);
				}
				if (stream->tee2){
					ms_connection_helper_unlink (&h,stream->tee2,0,0);
					ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0);
				}
				if(stream->output)
					ms_connection_helper_unlink (&h,stream->output,0,-1);
				if (stream->tee && stream->output && stream->output2==NULL)
					ms_filter_unlink(stream->tee,1,stream->output,1);
			}
		}
	}
	video_stream_free (stream);
}