2
* Copyright (C) 2015 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef MCS_STREAMING_MEDIASENDER_H_
19
#define MCS_STREAMING_MEDIASENDER_H_
25
#include "mcs/video/baseencoder.h"
26
#include "mcs/video/bufferqueue.h"
28
#include "mcs/streaming/packetizer.h"
29
#include "mcs/streaming/transportsender.h"
34
class MediaSender : public std::enable_shared_from_this<MediaSender>,
35
public mcs::video::BaseEncoder::Delegate {
37
typedef std::shared_ptr<MediaSender> Ptr;
39
static Ptr Create(const Packetizer::Ptr &packetizer, const TransportSender::Ptr &sender, const mcs::video::BaseEncoder::Config &config);
46
void OnBufferAvailable(const mcs::video::Buffer::Ptr &buffer) override;
47
void OnBufferWithCodecConfig(const mcs::video::Buffer::Ptr &buffer) override;
49
uint16_t LocalRTPPort() const;
52
MediaSender(const Packetizer::Ptr &packetizer, const TransportSender::Ptr &sender, const mcs::video::BaseEncoder::Config &config);
56
void ProcessBuffer(const mcs::video::Buffer::Ptr &buffer);
59
Packetizer::Ptr packetizer_;
60
TransportSender::Ptr sender_;
61
Packetizer::TrackId video_track_;
62
int64_t prev_time_us_;
63
std::thread worker_thread_;
64
mcs::video::BufferQueue::Ptr queue_;
68
} // namespace streaming