-
Notifications
You must be signed in to change notification settings - Fork 3
/
sender.cc
55 lines (43 loc) · 1.79 KB
/
sender.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <liveMedia/liveMedia.hh>
#include <BasicUsageEnvironment.hh>
#include <GroupsockHelper.hh>
#include "source.hh"
#include "H265VideoStreamDiscreteFramer.hh"
#include <cstdlib>
#include <iostream>
int main(int argc, char **argv)
{
if (argc != 11) {
fprintf(stderr, "usage: ./%s <input file> <result file> <local address> <local port> <remote address> <remote port> \
<number of threads> <fps> <format> <srtp> \n", __FILE__);
return EXIT_FAILURE;
}
std::string input_file = argv[1];
std::string result_file = argv[2];
std::string local_address = argv[3];
int local_port = atoi(argv[4]);
std::string remote_address = argv[5];
int remote_port = atoi(argv[6]);
int nthreads = atoi(argv[7]);
int fps = atoi(argv[8]);
bool vvc_enabled = get_vvc_state(argv[9]);
bool srtp_enabled = get_srtp_state(argv[10]);
if (vvc_enabled || srtp_enabled)
{
std::cerr << "Unsupported option for Live555 tester" << std::endl;
return EXIT_FAILURE;
}
TaskScheduler *scheduler = BasicTaskScheduler::createNew();
UsageEnvironment *env = BasicUsageEnvironment::createNew(*scheduler);
H265FramedSource* framedSource = H265FramedSource::createNew(*env, fps, input_file, result_file);
H265VideoStreamDiscreteFramer* framer = H265VideoStreamDiscreteFramer::createNew(*env, framedSource);
Port rtpPort(remote_port);
struct in_addr dst_addr;
dst_addr.s_addr = our_inet_addr(remote_address.c_str());
Groupsock rtpGroupsock(*env, dst_addr, rtpPort, 255);
OutPacketBuffer::maxSize = 40 * 1000 * 1000;
RTPSink* videoSink = H265VideoRTPSink::createNew(*env, &rtpGroupsock, 96);
videoSink->startPlaying(*framer, NULL, videoSink);
env->taskScheduler().doEventLoop();
return EXIT_SUCCESS;
}