Commit 5d57a045 authored by Sylvain Berfini's avatar Sylvain Berfini

Added --log option to mediastream

parent 423ec016
......@@ -537,11 +537,13 @@ static void *msv4l2_thread(void *ptr){
ms_warning("msv4l2 could not be configured");
goto close;
}
if (msv4l2_do_mmap(s)!=0)
{
ms_warning("msv4l2 do mmap");
goto close;
}
ms_message("V4L2 video capture started.");
while(s->thread_run)
{
......@@ -576,7 +578,7 @@ static void msv4l2_preprocess(MSFilter *f){
s->thread_run=TRUE;
ms_thread_create(&s->thread,NULL,msv4l2_thread,s);
s->th_frame_count=-1;
ms_average_fps_init(&s->avgfps,"V4L2 capture");
ms_average_fps_init(&s->avgfps,"V4L2 capture average fps: %f");
}
static void msv4l2_process(MSFilter *f){
......
......@@ -148,6 +148,7 @@ typedef struct _MediastreamDatas {
int ice_local_candidates_nb;
int ice_remote_candidates_nb;
char * video_display_filter;
FILE * logfile;
} MediastreamDatas;
......@@ -216,6 +217,7 @@ const char *usage="mediastream --local <port> --remote <ip:port> \n"
"[ --interactive (run in interactive mode)]\n"
"[ --no-avpf]\n"
"[ --no-rtcp]\n"
"[ --log <file>]\n"
;
#if TARGET_OS_IPHONE
......@@ -323,6 +325,7 @@ MediastreamDatas* init_default_args() {
args->pt = NULL;
args->q = NULL;
args->profile = NULL;
args->logfile = NULL;
args->ice_session = NULL;
memset(args->ice_local_candidates, 0, sizeof(args->ice_local_candidates));
......@@ -532,6 +535,9 @@ bool_t parse_args(int argc, char** argv, MediastreamDatas* out) {
} else if (strcmp(argv[i],"--video-display-filter")==0) {
i++;
out->video_display_filter=argv[i];
} else if (strcmp(argv[i], "--log") == 0) {
i++;
out->logfile = fopen(argv[i], "a+");
} else {
printf("%s",usage);
printf("Unknown option '%s'\n", argv[i]);
......@@ -564,6 +570,9 @@ void setup_media_streams(MediastreamDatas* args) {
MSWebCam *cam=NULL;
#endif
ortp_init();
if (args->logfile)
ortp_set_log_file(args->logfile);
if (args->is_verbose) {
ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
} else {
......@@ -962,6 +971,9 @@ void clear_mediastreams(MediastreamDatas* args) {
ortp_ev_queue_destroy(args->q);
rtp_profile_destroy(args->profile);
if (args->logfile)
fclose(args->logfile);
ms_exit();
}
......
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