mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-01-30 03:32:43 +00:00
Send valid frame type value in frame header (#516)
This commit is contained in:
parent
f4edce318c
commit
66f46ab341
@ -65,6 +65,28 @@ enum class socket_e : int {
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct video_short_frame_header_t {
|
||||
uint8_t *payload() {
|
||||
return (uint8_t *)(this + 1);
|
||||
}
|
||||
|
||||
std::uint8_t headerType; // Always 0x01 for short headers
|
||||
std::uint8_t unknown[2];
|
||||
|
||||
// Currently known values:
|
||||
// 1 = Normal P-frame
|
||||
// 2 = IDR-frame
|
||||
// 4 = P-frame with intra-refresh blocks
|
||||
// 5 = P-frame after reference frame invalidation
|
||||
std::uint8_t frameType;
|
||||
|
||||
std::uint8_t unknown2[4];
|
||||
};
|
||||
|
||||
static_assert(
|
||||
sizeof(video_short_frame_header_t) == 8,
|
||||
"Short frame header must be 8 bytes");
|
||||
|
||||
struct video_packet_raw_t {
|
||||
uint8_t *payload() {
|
||||
return (uint8_t *)(this + 1);
|
||||
@ -896,8 +918,11 @@ void videoBroadcastThread(udp::socket &sock) {
|
||||
std::string_view payload { (char *)av_packet->data, (size_t)av_packet->size };
|
||||
std::vector<uint8_t> payload_new;
|
||||
|
||||
auto nv_packet_header = "\0017charss"sv;
|
||||
std::copy(std::begin(nv_packet_header), std::end(nv_packet_header), std::back_inserter(payload_new));
|
||||
video_short_frame_header_t frame_header = {};
|
||||
frame_header.headerType = 0x01; // Short header type
|
||||
frame_header.frameType = (av_packet->flags & AV_PKT_FLAG_KEY) ? 2 : 1;
|
||||
|
||||
std::copy_n((uint8_t *)&frame_header, sizeof(frame_header), std::back_inserter(payload_new));
|
||||
std::copy(std::begin(payload), std::end(payload), std::back_inserter(payload_new));
|
||||
|
||||
payload = { (char *)payload_new.data(), payload_new.size() };
|
||||
|
Loading…
x
Reference in New Issue
Block a user