Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
Remove unused codes.
Browse files Browse the repository at this point in the history
Fix test.
  • Loading branch information
polygraphene committed Jul 1, 2018
1 parent d7660e1 commit 0bc55f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions ALVR-common/packet_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,23 @@ struct PacketErrorReport {

static const int ALVR_MAX_VIDEO_BUFFER_SIZE = ALVR_MAX_PACKET_SIZE - sizeof(VideoFrame);

static const int ALVR_FEC_SHARDS_MAX = 20;

inline int CalculateParityShards(int dataShards, int fecPercentage) {
int totalParityShards = (dataShards * fecPercentage + 99) / 100;
return totalParityShards;
}

// Calculate how many packet is needed for make signal shard.
inline int CalculateFECShardPackets(int len, int fecPercentage) {
int shards_max = 20;
// This reed solomon implementation accept only 255 shards.
// Normally, we use ALVR_MAX_VIDEO_BUFFER_SIZE as block_size and single packet becomes single shard.
// If we need more than maxDataShards packets, we need to combine multiple packet to make single shrad.
// NOTE: Moonlight seems to use only 255 shards for video frame.
int maxDataShards = ((shards_max - 2) * 100 + 99 + fecPercentage) / (100 + fecPercentage);
int maxDataShards = ((ALVR_FEC_SHARDS_MAX - 2) * 100 + 99 + fecPercentage) / (100 + fecPercentage);
int minBlockSize = (len + maxDataShards - 1) / maxDataShards;
int shardPackets = (minBlockSize + ALVR_MAX_VIDEO_BUFFER_SIZE - 1) / ALVR_MAX_VIDEO_BUFFER_SIZE;
assert(maxDataShards + CalculateParityShards(maxDataShards, fecPercentage) <= shards_max);
assert(maxDataShards + CalculateParityShards(maxDataShards, fecPercentage) <= ALVR_FEC_SHARDS_MAX);
return shardPackets;
}

Expand Down
4 changes: 0 additions & 4 deletions alvr_server/Listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ class Listener : public CThread {
int totalParityShards = (dataShards * m_fecPercentage + 99) / 100;
int totalShards = dataShards + totalParityShards;

int dataPackets = dataShards * shardPackets;
int parityPackets = totalParityShards * shardPackets;
int totalPackets = totalShards * shardPackets;

assert(totalShards <= DATA_SHARDS_MAX);

Log("reed_solomon_new. dataShards=%d totalParityShards=%d totalShards=%d blockSize=%d shardPackets=%d"
Expand Down
Binary file modified test/gtest/rs_test.cpp
Binary file not shown.

0 comments on commit 0bc55f9

Please sign in to comment.