示例#1
0
int MultiConf::StopRecordingParticipant(int partId)
{
	int ret = 0;
	
	Log("-StopRecordingParticipant [id:%d]\n",partId);

	//Lock
	participantsLock.IncUse();

	//Get rtp participant
	RTPParticipant* rtp = (RTPParticipant*)GetParticipant(partId,Participant::RTP);

	//Check participant
	if (rtp)
	{
		//Set the listener for the rtp video packets
		rtp->SetMediaListener(NULL);

		//Add the listener for audio and text frames of the watcher
		audioEncoder.RemoveListener(&rtp->recorder);
		textEncoder.RemoveListener(&rtp->recorder);

		//Stop recording
		rtp->recorder.Stop();

		//End recording
		ret = rtp->recorder.End();
	}

	//Unlock
	participantsLock.DecUse();

	//Exit
	return ret;
}
示例#2
0
int MultiConf::StartRecordingParticipant(int partId,const char* filename)
{
	int ret = 0;

	Log("-StartRecordingParticipant [id:%d,name:\"%s\"]\n",partId,filename);

	//Lock
	participantsLock.IncUse();

	//Get participant
	RTPParticipant *rtp = (RTPParticipant*)GetParticipant(partId,Participant::RTP);

	//Check if
	if (!rtp)
		//End
		goto end;

	//Create recording
	if (!rtp->recorder.Create(filename))
		//End
		goto end;

        //Start recording
        if (!rtp->recorder.Record())
		//End
		goto end;

	//Set the listener for the rtp video packets
	rtp->SetMediaListener(&rtp->recorder);

	//Add the listener for audio and text frames of the watcher
	audioEncoder.AddListener(&rtp->recorder);
	textEncoder.AddListener(&rtp->recorder);

	//OK
	ret = 1;

end:
	//Unlock
	participantsLock.DecUse();

	//Exit
	return ret;
}