blob: 0e86447d200905e2c0cba4b5e0dece5a78a3b0b3 [file] [log] [blame]
/*
* Copyright (C) 2004-2015 Savoir-faire Linux Inc.
*
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
* Author: Guillaume Roguez <Guillaume.Roguez@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __VIDEO_RTP_SESSION_H__
#define __VIDEO_RTP_SESSION_H__
#include "media/rtp_session.h"
#include "media/media_device.h"
#include "video_base.h"
#include <string>
#include <memory>
namespace ring {
class Conference;
} // namespace ring
namespace ring { namespace video {
class VideoMixer;
class VideoSender;
class VideoReceiveThread;
class VideoRtpSession : public RtpSession {
public:
VideoRtpSession(const std::string& callID,
const DeviceParams& localVideoParams);
~VideoRtpSession();
void start(std::unique_ptr<IceSocket> rtp_sock = nullptr,
std::unique_ptr<IceSocket> rtcp_sock = nullptr) override;
void restartSender() override;
void stop() override;
void forceKeyFrame();
void bindMixer(VideoMixer* mixer);
void unbindMixer();
void enterConference(Conference* conference);
void exitConference();
void switchInput(const std::string& input) {
input_ = input;
}
bool useCodec(const AccountVideoCodecInfo* codec) const;
private:
void setupConferenceVideoPipeline(Conference& conference);
void startSender();
void startReceiver();
std::string input_;
DeviceParams localVideoParams_;
std::unique_ptr<VideoSender> sender_;
std::unique_ptr<VideoReceiveThread> receiveThread_;
Conference* conference_ {nullptr};
std::shared_ptr<VideoMixer> videoMixer_;
std::shared_ptr<VideoFrameActiveWriter> videoLocal_;
uint16_t initSeqVal_ = 0;
};
}} // namespace ring::video
#endif // __VIDEO_RTP_SESSION_H__