* #6517: merged VideoRTPFactory into VideoRTPSession

This commit is contained in:
Tristan Matthews
2011-07-27 18:50:19 -04:00
parent d49250b10f
commit ae0264ffb2
10 changed files with 31 additions and 179 deletions

View File

@ -667,9 +667,7 @@ std::string Sdp::getActiveVideoDescription() const
ss << "s=" << STR_SDP_NAME.ptr << std::endl;
ss << "c=" << STR_IN.ptr << " " << STR_IP4.ptr << " " << remoteIpAddr_ << std::endl;
ss << "t=0 0" << std::endl;
//ss << "m=" << STR_VIDEO.ptr << " " << getLocalPublishedVideoPort() << " " << STR_RTP_AVP.ptr << " 96" << std::endl;
//ss << "b=AS:1000" << std::endl;
//ss << "a=rtpmap:96 H264/90000" << std::endl;
std::string videoLine(getLineFromLocalSDP("m=video"));
_error("Adding video line %s", videoLine.c_str());

View File

@ -34,7 +34,7 @@
#include "sipcall.h"
#include "logger.h" // for _debug
#include "audio/audiortp/AudioRtpFactory.h"
#include "video/video_rtp_factory.h"
#include "video/video_rtp_session.h"
#include "sdp.h"
const int SIPCall::CALL_MEMPOOL_INIT_SIZE = 16384;
@ -45,7 +45,7 @@ SIPCall::SIPCall (const CallID& id, Call::CallType type, pj_caching_pool *cachin
, _did (0)
, _tid (0)
, _audiortp (new sfl::AudioRtpFactory(this))
, videortp_ (new sfl_video::VideoRtpFactory())
, videortp_ (new sfl_video::VideoRtpSession())
, _xferSub (NULL)
, _invSession (NULL)
, _local_sdp (NULL)

View File

@ -47,7 +47,7 @@ class AudioRtpFactory;
namespace sfl_video
{
class VideoRtpFactory;
class VideoRtpSession;
}
/**
@ -120,7 +120,7 @@ class SIPCall : public Call
/**
* Returns a pointer to the VideoRtp object
*/
sfl_video::VideoRtpFactory * getVideoRtp (void) {
sfl_video::VideoRtpSession * getVideoRtp () {
return videortp_;
}
@ -172,7 +172,7 @@ class SIPCall : public Call
/**
* Video Rtp Session factory
*/
sfl_video::VideoRtpFactory * videortp_;
sfl_video::VideoRtpSession * videortp_;
/**
* Event subscription structure

View File

@ -56,7 +56,7 @@
#include "audio/audiolayer.h"
#include "audio/audiortp/AudioRtpFactory.h"
#include "video/video_rtp_factory.h"
#include "video/video_rtp_session.h"
#include "pjsip/sip_endpoint.h"
#include "pjsip/sip_transport_tls.h"

View File

@ -7,7 +7,6 @@ noinst_LTLIBRARIES = libvideo.la
libvideo_la_SOURCES = video_endpoint.cpp video_endpoint.h \
libav_utils.cpp libav_utils.h \
video_rtp_session.cpp video_rtp_session.h \
video_rtp_factory.cpp video_rtp_factory.h \
video_send_thread.h video_send_thread.cpp \
video_receive_thread.h video_receive_thread.cpp \
video_preview.h video_preview.cpp \

View File

@ -37,24 +37,7 @@
int main (int argc, char* argv[])
{
std::map<std::string, std::string> txArgs, rxArgs;
txArgs["input"] = "/dev/video0";
txArgs["codec"] = "mpeg4";
txArgs["bitrate"] = "1000000";
txArgs["destination"] = "rtp://127.0.0.1:5000";
txArgs["format"] = "rgb24";
txArgs["width"] = "640";
txArgs["height"] = "480";
rxArgs["input"] = "test.sdp";
rxArgs["codec"] = "mpeg4";
rxArgs["bitrate"] = "1000000";
rxArgs["format"] = "rgb24";
rxArgs["width"] = "640";
rxArgs["height"] = "480";
sfl_video::VideoRtpSession session(txArgs, rxArgs);
//sfl_video::VideoRtpSession videorecv("rtp://127.0.0.1:5000", "libx264", 1000000, "rtp://127.0.0.1:5000", "rgb24");
sfl_video::VideoRtpSession session;
session.start();
sleep(10);
session.stop();

View File

@ -1,83 +0,0 @@
/*
* 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"
#include <map>
#include <string>
#include "video_rtp_session.h"
namespace sfl_video
{
VideoRtpFactory::VideoRtpFactory()
{
std::map<std::string, std::string> txArgs, rxArgs;
txArgs["input"] = "/dev/video0";
txArgs["codec"] = "libx264";
txArgs["bitrate"] = "1000000";
txArgs["destination"] = "rtp://127.0.0.1:5000";
txArgs["format"] = "rgb24";
// default to CIF/SIF(625)
txArgs["width"] = "352";
txArgs["height"] = "288";
txArgs["framerate"] = "30";
rxArgs["codec"] = txArgs["codec"];
rxArgs["bitrate"] = txArgs["bitrate"];
rxArgs["format"] = txArgs["format"];
rxArgs["width"] = txArgs["width"];
rxArgs["height"] = txArgs["height"];
session_.reset(new VideoRtpSession(txArgs, rxArgs));
}
void VideoRtpFactory::start()
{
session_->start();
}
void VideoRtpFactory::stop()
{
// stop
session_->stop();
}
void VideoRtpFactory::updateDestination(const std::string &dest,
unsigned int port)
{
session_->updateDestination(dest, port);
}
void VideoRtpFactory::updateSDP(Sdp *sdp)
{
session_->updateSDP(sdp);
}
} // end namespace sfl_video

View File

@ -1,64 +0,0 @@
/*
* 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_FACTORY_H__
#define __VIDEO_RTP_FACTORY_H__
#include <tr1/memory>
class Sdp;
namespace sfl_video {
class VideoRtpSession;
class VideoRtpFactory {
public:
VideoRtpFactory();
void updateDestination(const std::string &dest,
unsigned int port);
void updateSDP(Sdp *sdp);
/**
* Start the video RTP threads
* @param None
*/
void start();
/**
* Stop the audio rtp thread of the type specified in the configuration
* file. initAudioSymmetricRtpSession must have been called prior to that.
* @param None
*/
void stop();
private:
std::tr1::shared_ptr<VideoRtpSession> session_;
};
}
#endif // __VIDEO_RTP_FACTORY_H__

View File

@ -42,12 +42,30 @@
namespace sfl_video {
VideoRtpSession::VideoRtpSession(const std::map<std::string,std::string> &txArgs,
const std::map<std::string,std::string> &rxArgs) :
txArgs_(txArgs), rxArgs_(rxArgs)
VideoRtpSession::VideoRtpSession()
{
txArgs_["input"] = "/dev/video0";
txArgs_["codec"] = "libx264";
txArgs_["bitrate"] = "1000000";
txArgs_["destination"] = "rtp://127.0.0.1:5000";
txArgs_["format"] = "rgb24";
// default to CIF/SIF(625)
txArgs_["width"] = "352";
txArgs_["height"] = "288";
txArgs_["framerate"] = "30";
rxArgs_["codec"] = txArgs_["codec"];
rxArgs_["bitrate"] = txArgs_["bitrate"];
rxArgs_["format"] = txArgs_["format"];
rxArgs_["width"] = txArgs_["width"];
rxArgs_["height"] = txArgs_["height"];
}
VideoRtpSession::VideoRtpSession(const std::map<std::string, std::string> &txArgs,
const std::map<std::string, std::string> &rxArgs) :
txArgs_(txArgs), rxArgs_(rxArgs)
{}
void VideoRtpSession::updateSDP(const Sdp *sdp)
{
std::string desc = sdp->getActiveVideoDescription();

View File

@ -44,8 +44,9 @@ class VideoReceiveThread;
class VideoRtpSession {
public:
VideoRtpSession(const std::map<std::string,std::string> &txArgs,
const std::map<std::string,std::string> &rxArgs);
VideoRtpSession();
VideoRtpSession(const std::map<std::string, std::string> &txArgs,
const std::map<std::string, std::string> &rxArgs);
void start();
void stop();