Skip to content

Commit

Permalink
fix: compilation warnings on clang
Browse files Browse the repository at this point in the history
  • Loading branch information
ABeltramo committed Aug 13, 2024
1 parent 00360fa commit d683b99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/moonlight-server/gst-plugin/video.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static void generate_fec_packets(const gst_rtp_moonlight_pay_video &rtpmoonlight

auto payload_size = (int)gst_buffer_get_size(rtp_payload);
auto blocks = determine_split(rtpmoonlightpay, gst_buffer_list_length(rtp_packets));
auto nr_shards = blocks.data_shards + blocks.parity_shards;
const auto nr_shards = blocks.data_shards + blocks.parity_shards;

if (nr_shards > DATA_SHARDS_MAX) {
logs::log(logs::warning,
Expand All @@ -223,11 +223,11 @@ static void generate_fec_packets(const gst_rtp_moonlight_pay_video &rtpmoonlight

// Reed Solomon encode the full stream of bytes
auto rs = moonlight::fec::create(blocks.data_shards, blocks.parity_shards);
unsigned char *ptr[nr_shards];
std::vector<unsigned char*> ptr(nr_shards);
for (int shard_idx = 0; shard_idx < nr_shards; shard_idx++) {
ptr[shard_idx] = info.data + (shard_idx * blocks.block_size);
}
if (moonlight::fec::encode(rs.get(), ptr, nr_shards, blocks.block_size) != 0) {
if (moonlight::fec::encode(rs.get(), &ptr.front(), nr_shards, blocks.block_size) != 0) {
logs::log(logs::warning, "Error during video FEC encoding");
}

Expand Down
6 changes: 3 additions & 3 deletions tests/testGSTPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ TEST_CASE_METHOD(GStreamerTestsFixture, "Create RTP VIDEO packets", "[GSTPlugin]
auto flatten_packets = gst_buffer_list_unfold(rtp_packets);
auto packets_content = gst_buffer_copy_content(flatten_packets);

unsigned char *packets_ptr[total_shards];
std::vector<unsigned char*> packets_ptr(total_shards);
for (int shard_idx = 0; shard_idx < total_shards; shard_idx++) {
packets_ptr[shard_idx] = &packets_content.front() + (shard_idx * rtp_packet_size);
}
Expand All @@ -300,7 +300,7 @@ TEST_CASE_METHOD(GStreamerTestsFixture, "Create RTP VIDEO packets", "[GSTPlugin]
std::vector<unsigned char> marks = {0, 0, 0, 0};

auto rs = moonlight::fec::create(data_shards, parity_shards);
auto result = moonlight::fec::decode(rs.get(), packets_ptr, &marks.front(), total_shards, rtp_packet_size);
auto result = moonlight::fec::decode(rs.get(), &packets_ptr.front(), &marks.front(), total_shards, rtp_packet_size);

REQUIRE(result == 0);
REQUIRE_THAT(packets_content, Equals(gst_buffer_copy_content(flatten_packets)));
Expand All @@ -312,7 +312,7 @@ TEST_CASE_METHOD(GStreamerTestsFixture, "Create RTP VIDEO packets", "[GSTPlugin]
std::vector<unsigned char> marks = {1, 0, 0, 0};

auto rs = moonlight::fec::create(data_shards, parity_shards);
auto result = moonlight::fec::decode(rs.get(), packets_ptr, &marks.front(), total_shards, rtp_packet_size);
auto result = moonlight::fec::decode(rs.get(), &packets_ptr.front(), &marks.front(), total_shards, rtp_packet_size);

REQUIRE(result == 0);

Expand Down

0 comments on commit d683b99

Please sign in to comment.