Added fec_percentage as configurable variable
This commit is contained in:
@@ -15,7 +15,12 @@ unique_id = 03904e64-51da-4fb3-9afd-a9f7ff70fea4
|
|||||||
file_devices = devices.xml
|
file_devices = devices.xml
|
||||||
|
|
||||||
# How long to wait in milliseconds for data from moonlight before shutting down the stream
|
# How long to wait in milliseconds for data from moonlight before shutting down the stream
|
||||||
ping_timeout = 2000
|
ping_timeout = 2000
|
||||||
|
|
||||||
|
# How much error correcting packets must be send for every video max_b_frames
|
||||||
|
# This is just some random number, don't know the optimal value
|
||||||
|
# The higher fec_percentage, the lower space for the actual data to send per frame there is
|
||||||
|
fec_percentage = 25
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
# FFmpeg software encoding parameters
|
# FFmpeg software encoding parameters
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ video_t video {
|
|||||||
};
|
};
|
||||||
|
|
||||||
stream_t stream {
|
stream_t stream {
|
||||||
2s // ping_timeout
|
2s, // ping_timeout
|
||||||
|
13 // fecPercentage
|
||||||
};
|
};
|
||||||
|
|
||||||
nvhttp_t nvhttp {
|
nvhttp_t nvhttp {
|
||||||
@@ -136,6 +137,8 @@ void parse_file(const char *file) {
|
|||||||
if(to > 0) {
|
if(to > 0) {
|
||||||
stream.ping_timeout = std::chrono::milliseconds(to);
|
stream.ping_timeout = std::chrono::milliseconds(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int_f(vars, "fec_percentage", stream.fec_percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ struct video_t {
|
|||||||
|
|
||||||
struct stream_t {
|
struct stream_t {
|
||||||
std::chrono::milliseconds ping_timeout;
|
std::chrono::milliseconds ping_timeout;
|
||||||
|
|
||||||
|
int fec_percentage;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nvhttp_t {
|
struct nvhttp_t {
|
||||||
|
|||||||
@@ -627,7 +627,7 @@ void videoThread(video::idr_event_t idr_events) {
|
|||||||
auto blocksize = config.packetsize + MAX_RTP_HEADER_SIZE;
|
auto blocksize = config.packetsize + MAX_RTP_HEADER_SIZE;
|
||||||
auto payload_blocksize = blocksize - sizeof(video_packet_raw_t);
|
auto payload_blocksize = blocksize - sizeof(video_packet_raw_t);
|
||||||
|
|
||||||
auto fecpercentage { 25 };
|
auto fecPercentage = config::stream.fec_percentage;
|
||||||
|
|
||||||
payload_new = insert(sizeof(video_packet_raw_t), payload_blocksize,
|
payload_new = insert(sizeof(video_packet_raw_t), payload_blocksize,
|
||||||
payload, [&](void *p, int fecIndex, int end) {
|
payload, [&](void *p, int fecIndex, int end) {
|
||||||
@@ -639,7 +639,7 @@ void videoThread(video::idr_event_t idr_events) {
|
|||||||
video_packet->packet.fecInfo = (
|
video_packet->packet.fecInfo = (
|
||||||
fecIndex << 12 |
|
fecIndex << 12 |
|
||||||
end << 22 |
|
end << 22 |
|
||||||
fecpercentage << 4
|
fecPercentage << 4
|
||||||
);
|
);
|
||||||
|
|
||||||
if(fecIndex == 0) {
|
if(fecIndex == 0) {
|
||||||
@@ -655,7 +655,7 @@ void videoThread(video::idr_event_t idr_events) {
|
|||||||
|
|
||||||
payload = {(char *) payload_new.data(), payload_new.size()};
|
payload = {(char *) payload_new.data(), payload_new.size()};
|
||||||
|
|
||||||
auto shards = fec::encode(payload, blocksize, fecpercentage);
|
auto shards = fec::encode(payload, blocksize, fecPercentage);
|
||||||
if(shards.data_shards == 0) {
|
if(shards.data_shards == 0) {
|
||||||
std::cout << "skipping frame..."sv << std::endl;
|
std::cout << "skipping frame..."sv << std::endl;
|
||||||
continue;
|
continue;
|
||||||
@@ -668,7 +668,7 @@ void videoThread(video::idr_event_t idr_events) {
|
|||||||
inspect->packet.fecInfo = (
|
inspect->packet.fecInfo = (
|
||||||
x << 12 |
|
x << 12 |
|
||||||
shards.data_shards << 22 |
|
shards.data_shards << 22 |
|
||||||
fecpercentage << 4
|
fecPercentage << 4
|
||||||
);
|
);
|
||||||
|
|
||||||
inspect->rtp.sequenceNumber = util::endian::big<uint16_t>(lowseq + x);
|
inspect->rtp.sequenceNumber = util::endian::big<uint16_t>(lowseq + x);
|
||||||
|
|||||||
Reference in New Issue
Block a user