Revision d223cef1 plugins/janus_recordplay.c

View differences:

plugins/janus_recordplay.c
392 392
	janus_recordplay_recording *recording;
393 393
	janus_recorder *arc;	/* Audio recorder */
394 394
	janus_recorder *vrc;	/* Video recorder */
395
	janus_mutex rec_mutex;	/* Mutex to protect the recorders from race conditions */
395 396
	janus_recordplay_frame_packet *aframes;	/* Audio frames (for playout) */
396 397
	janus_recordplay_frame_packet *vframes;	/* Video frames (for playout) */
397 398
	guint video_remb_startup;
......
657 658
	session->firefox = FALSE;
658 659
	session->arc = NULL;
659 660
	session->vrc = NULL;
661
	janus_mutex_init(&session->rec_mutex);
660 662
	session->destroyed = 0;
661 663
	g_atomic_int_set(&session->hangingup, 0);
662 664
	session->video_remb_startup = 4;
......
983 985
			return;
984 986
		/* Are we recording? */
985 987
		if(session->recorder) {
986
			if(video && session->vrc)
987
				janus_recorder_save_frame(session->vrc, buf, len);
988
			else if(!video && session->arc)
989
				janus_recorder_save_frame(session->arc, buf, len);
988
			janus_recorder_save_frame(video ? session->vrc : session->arc, buf, len);
990 989
		}
991 990

  
992 991
		janus_recordplay_send_rtcp_feedback(handle, video, buf, len);
......
1324 1323
		} else if(!strcasecmp(request_text, "stop")) {
1325 1324
			/* Stop the recording/playout */
1326 1325
			session->active = FALSE;
1326
			janus_mutex_lock(&session->rec_mutex);
1327 1327
			if(session->arc) {
1328 1328
				janus_recorder_close(session->arc);
1329 1329
				JANUS_LOG(LOG_INFO, "Closed audio recording %s\n", session->arc->filename ? session->arc->filename : "??");
......
1336 1336
				janus_recorder_free(session->vrc);
1337 1337
			}
1338 1338
			session->vrc = NULL;
1339
			janus_mutex_unlock(&session->rec_mutex);
1339 1340
			if(session->recorder) {
1340 1341
				/* Create a .nfo file for this recording */
1341 1342
				char nfofile[1024], nfo[1024];

Also available in: Unified diff