* #6124 : add VideoRtpFactory class

Currently a dummy class.
This commit is contained in:
Tristan Matthews
2011-06-14 16:28:10 -04:00
parent 2a00fe8cd8
commit 6d0d8f3ccd
6 changed files with 138 additions and 6 deletions

View File

@ -5,7 +5,8 @@ noinst_LTLIBRARIES = libvideo_endpoint.la
libvideo_endpoint_la_SOURCES = video_endpoint.cpp video_endpoint.h \
libav_utils.cpp libav_utils.h \
video_rtp_session.cpp video_rtp_session.h
video_rtp_session.cpp video_rtp_session.h \
video_rtp_factory.cpp video_rtp_factory.h
libvideo_endpoint_la_LIBADD = @LIBAVFORMAT_LIBS@
AM_CXXFLAGS=@LIBAVCODEC_CFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVDEVICE_CFLAGS@ @LIBSWSCALE_CFLAGS@

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "video_rtp_factory.h"
namespace sfl_video
{
VideoRtpFactory::VideoRtpFactory(SIPCall * ca)
{
}
void VideoRtpFactory::start()
{
// starting
}
void VideoRtpFactory::stop()
{
// stop
}
} // end namespace sfl

View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef __VIDEO_RTP_SESSION_H__
#define __VIDEO_RTP_SESSION_H__
class SIPCall;
namespace sfl_video {
class VideoRtpFactory {
public:
VideoRtpFactory(SIPCall * ca);
/**
* Start the video RTP thread of the type specified in the configuration
* file.
* @param None
*/
void start();
/**
* Stop the audio rtp thread of the type specified in the configuration
* file. initAudioRtpSession must have been called prior to that.
* @param None
*/
void stop();
};
}
#endif // __VIDEO_RTP_SESSION_H__

View File

@ -69,7 +69,6 @@ AudioRtpSession::~AudioRtpSession()
void AudioRtpSession::final()
{
delete _rtpThread;
delete static_cast<AudioRtpSession *> (this);

View File

@ -45,6 +45,11 @@ namespace sfl
class AudioRtpFactory;
}
namespace sfl_video
{
class VideoRtpFactory;
}
/**
* @file sipcall.h
* @brief SIPCall are SIP implementation of a normal Call
@ -161,6 +166,13 @@ class SIPCall : public Call
return _audiortp;
}
/**
* Returns a pointer to the VideoRtp object
*/
sfl_video::VideoRtpFactory * getVideoRtp (void) {
return videortp_;
}
/**
* Return the local memory pool for this call
*/
@ -206,6 +218,11 @@ class SIPCall : public Call
*/
sfl::AudioRtpFactory * _audiortp;
/**
* Video Rtp Session factory
*/
sfl_video::VideoRtpFactory * videortp_;
/**
* Event subscription structure
*/

View File

@ -51,6 +51,8 @@
#include "audio/audiolayer.h"
#include "audio/audiortp/AudioRtpFactory.h"
#include "video/video_rtp_factory.h"
#include "pjsip/sip_endpoint.h"
#include "pjsip/sip_transport_tls.h"
#include "pjsip/sip_transport_tls.h"
@ -717,6 +719,8 @@ Call *SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
call->getAudioRtp()->initLocalCryptoInfo (call);
_info ("UserAgent: Start audio rtp session");
call->getAudioRtp()->start (static_cast<sfl::AudioCodec *>(audiocodec));
_info ("UserAgent: Start video rtp session");
call->getVideoRtp()->start();
} catch (...) {
throw VoipLinkException ("Could not start rtp session for early media");
}
@ -855,6 +859,7 @@ SIPVoIPLink::hangup (const CallID& id) throw (VoipLinkException)
try {
if (Manager::instance().isCurrentCall (id)) {
call->getAudioRtp()->stop();
call->getVideoRtp()->stop();
}
}
catch(...) {
@ -901,6 +906,7 @@ SIPVoIPLink::peerHungup (const CallID& id) throw (VoipLinkException)
if (Manager::instance().isCurrentCall (id)) {
_debug ("UserAgent: Stopping AudioRTP for hangup");
call->getAudioRtp()->stop();
call->getVideoRtp()->stop();
}
}
catch(...) {
@ -942,11 +948,11 @@ SIPVoIPLink::onhold (const CallID& id) throw (VoipLinkException)
}
// Stop sound
call->setAudioStart (false);
call->setState (Call::Hold);
try {
call->getAudioRtp()->stop();
call->getVideoRtp()->stop();
}
catch (...) {
throw VoipLinkException("Could not stop audio rtp session");
@ -1020,6 +1026,7 @@ SIPVoIPLink::offhold (const CallID& id) throw (VoipLinkException)
call->getAudioRtp()->initAudioRtpConfig (call);
call->getAudioRtp()->initAudioRtpSession (call);
call->getAudioRtp()->start (static_cast<sfl::AudioCodec *>(audiocodec));
call->getVideoRtp()->start();
}
catch (SdpException &e) {
@ -1314,6 +1321,7 @@ SIPVoIPLink::refuse (const CallID& id)
// Stop Audio RTP session
call->getAudioRtp()->stop();
call->getVideoRtp()->stop();
// User refuse current call. Notify peer
status = pjsip_inv_end_session (call->getInvSession(), PJSIP_SC_DECLINE, NULL, &tdata); //603
@ -1652,6 +1660,10 @@ SIPVoIPLink::SIPCallServerFailure (SIPCall *call)
if (call->getAudioRtp ()) {
call->getAudioRtp()->stop();
}
if (call->getVideoRtp ()) {
call->getVideoRtp()->stop();
}
}
}
@ -1668,9 +1680,9 @@ SIPVoIPLink::SIPCallClosed (SIPCall *call)
CallID id = call->getCallId();
if (Manager::instance().isCurrentCall (id)) {
call->setAudioStart (false);
_debug ("UserAgent: Stopping AudioRTP when closing");
call->getAudioRtp()->stop();
call->getVideoRtp()->stop();
}
Manager::instance().peerHungupCall (id);
@ -1795,6 +1807,7 @@ bool SIPVoIPLink::SIPNewIpToIpCall (const CallID& id, const std::string& to)
call->getAudioRtp()->initAudioRtpSession (call);
call->getAudioRtp()->initLocalCryptoInfo (call);
call->getAudioRtp()->start (static_cast<sfl::AudioCodec *>(audiocodec));
call->getVideoRtp()->start ();
} catch (...) {
_debug ("UserAgent: Unable to create RTP Session in new IP2IP call (%s:%d)", __FILE__, __LINE__);
}
@ -3518,8 +3531,6 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status)
AudioCodecType pl = (AudioCodecType) sessionMedia->getPayloadType();
try {
call->setAudioStart (true);
Manager::instance().audioLayerMutexLock();
Manager::instance().getAudioDriver()->startStream();
Manager::instance().audioLayerMutexUnlock();