Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ namespace crypto {

plaintext.resize(round_to_pkcs7_padded(cipher.size()));

int update_outlen, final_outlen;
int final_outlen;
int update_outlen;

if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) {
return -1;
Expand Down Expand Up @@ -195,7 +196,8 @@ namespace crypto {
return -1;
}

int update_outlen, final_outlen;
int final_outlen;
int update_outlen;

// Encrypt into the caller's buffer
if (EVP_EncryptUpdate(encrypt_ctx.get(), ciphertext, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
Expand Down Expand Up @@ -232,7 +234,8 @@ namespace crypto {
EVP_CIPHER_CTX_set_padding(decrypt_ctx.get(), padding);
plaintext.resize(round_to_pkcs7_padded(cipher.size()));

int update_outlen, final_outlen;
int final_outlen;
int update_outlen;

if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) {
return -1;
Expand All @@ -259,7 +262,8 @@ namespace crypto {
EVP_CIPHER_CTX_set_padding(encrypt_ctx.get(), padding);
cipher.resize(round_to_pkcs7_padded(plaintext.size()));

int update_outlen, final_outlen;
int final_outlen;
int update_outlen;

// Encrypt into the caller's buffer
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher.data(), &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
Expand Down Expand Up @@ -290,7 +294,8 @@ namespace crypto {
return false;
}

int update_outlen, final_outlen;
int final_outlen;
int update_outlen;

// Encrypt into the caller's buffer
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
Expand Down
3 changes: 2 additions & 1 deletion src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,8 @@ namespace input {
* @return The status of the batching operation.
*/
batch_result_e batch(PNV_REL_MOUSE_MOVE_PACKET dest, PNV_REL_MOUSE_MOVE_PACKET src) {
short deltaX, deltaY;
short deltaX;
short deltaY;

// Batching is safe as long as the result doesn't overflow a 16-bit integer
if (!__builtin_add_overflow(util::endian::big(dest->deltaX), util::endian::big(src->deltaX), &deltaX)) {
Expand Down
12 changes: 8 additions & 4 deletions src/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ namespace input {
std::shared_ptr<input_t> alloc(safe::mail_t mail);

struct touch_port_t: public platf::touch_port_t {
int env_width, env_height;
int env_height;
int env_width;

// Offset x and y coordinates of the client
float client_offsetX, client_offsetY;
float client_offsetX;
float client_offsetY;

float scalar_inv, scalar_tpcoords;
float scalar_inv;
float scalar_tpcoords;

int env_logical_width, env_logical_height;
int env_logical_height;
int env_logical_width;

explicit operator bool() const {
return width != 0 && height != 0 && env_width != 0 && env_height != 0;
Expand Down
29 changes: 21 additions & 8 deletions src/platform/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,14 @@ namespace platf {

// Dimensions for touchscreen input
struct touch_port_t {
int offset_x, offset_y;
int width, height;
int logical_width, logical_height;
int offset_x;
int offset_y;

int height;
int width;

int logical_height;
int logical_width;
};

// These values must match Limelight-internal.h's SS_FF_* constants!
Expand Down Expand Up @@ -534,12 +539,20 @@ namespace platf {
virtual ~display_t() = default;

// Offsets for when streaming a specific monitor. By default, they are 0.
int offset_x, offset_y;
int env_width, env_height;
int env_logical_width, env_logical_height;
int offset_x;
int offset_y;

int env_height;
int env_width;

int env_logical_height;
int env_logical_width;

int height;
int width;

int width, height;
int logical_width, logical_height;
int logical_height;
int logical_width;

protected:
// collect capture timing data (at loglevel debug)
Expand Down
9 changes: 6 additions & 3 deletions src/platform/linux/cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ namespace cuda {
stream_t stream;
frame_t hwframe;

int width, height;
int height;
int width;

// When height and width don't change, it's not necessary to use linear interpolation
bool linear_interpolation;
Expand Down Expand Up @@ -447,15 +448,17 @@ namespace cuda {
egl::nv12_t nv12;
AVPixelFormat sw_format;

int width, height;
int height;
int width;

std::uint64_t sequence;
egl::rgb_t rgb;

registered_resource_t y_res;
registered_resource_t uv_res;

int offset_x, offset_y;
int offset_x;
int offset_y;
};

std::unique_ptr<platf::avcodec_encode_device_t> make_avcodec_encode_device(int width, int height, bool vram) {
Expand Down
7 changes: 5 additions & 2 deletions src/platform/linux/cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ namespace cuda {
stream_t make_stream(int flags = 0);

struct viewport_t {
int width, height;
int offsetX, offsetY;
int height;
int width;

int offsetX;
int offsetY;
};

class tex_t {
Expand Down
3 changes: 2 additions & 1 deletion src/platform/linux/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ namespace egl {
return nullptr;
}

int major, minor;
int major;
int minor;
if (!eglInitialize(display.get(), &major, &minor)) {
BOOST_LOG(error) << "Couldn't initialize EGL display: ["sv << util::hex(eglGetError()).to_string_view() << ']';
return nullptr;
Expand Down
15 changes: 10 additions & 5 deletions src/platform/linux/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ namespace egl {

class cursor_t: public platf::img_t {
public:
int x, y;
int src_w, src_h;
int src_h;
int src_w;
int x;
int y;

unsigned long serial;

Expand Down Expand Up @@ -329,9 +331,12 @@ namespace egl {
gl::program_t program[3];
gl::buffer_t color_matrix;

int out_width, out_height;
int in_width, in_height;
int offsetX, offsetY;
int out_height;
int out_width;
int in_height;
int in_width;
int offsetX;
int offsetY;

// Pointer to the texture to be converted to nv12
int loaded_texture;
Expand Down
23 changes: 16 additions & 7 deletions src/platform/linux/kmsgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,20 @@ namespace platf {
struct cursor_t {
// Public properties used during blending
bool visible = false;
std::int32_t x, y;
std::uint32_t dst_w, dst_h;
std::uint32_t src_w, src_h;
std::uint32_t dst_h;
std::uint32_t dst_w;
std::uint32_t src_h;
std::uint32_t src_w;
std::int32_t x;
std::int32_t y;
std::vector<std::uint8_t> pixels;
unsigned long serial;

// Private properties used for tracking cursor changes
std::uint64_t prop_src_x, prop_src_y, prop_src_w, prop_src_h;
std::uint64_t prop_src_x;
std::uint64_t prop_src_y;
std::uint64_t prop_src_h;
std::uint64_t prop_src_w;
std::uint32_t fb_id;
};

Expand Down Expand Up @@ -1133,8 +1139,10 @@ namespace platf {

std::chrono::nanoseconds delay;

int img_width, img_height;
int img_offset_x, img_offset_y;
int img_height;
int img_width;
int img_offset_x;
int img_offset_y;

int plane_id;
int crtc_id;
Expand Down Expand Up @@ -1317,7 +1325,8 @@ namespace platf {
gl::ctx.BindTexture(GL_TEXTURE_2D, rgb->tex[0]);

// Don't remove these lines, see https://github.com/LizardByte/Sunshine/issues/453
int w, h;
int h;
int w;
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h;
Expand Down
12 changes: 8 additions & 4 deletions src/platform/linux/vaapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ namespace va {
egl::sws_t sws;
egl::nv12_t nv12;

int width, height;
int height;
int width;
};

class va_ram_t: public va_t {
Expand Down Expand Up @@ -455,7 +456,8 @@ namespace va {
std::uint64_t sequence;
egl::rgb_t rgb;

int offset_x, offset_y;
int offset_x;
int offset_y;
};

/**
Expand Down Expand Up @@ -531,7 +533,8 @@ namespace va {
vaSetErrorCallback(display.get(), __log, &error);
vaSetErrorCallback(display.get(), __log, &info);

int major, minor;
int major;
int minor;
auto status = vaInitialize(display.get(), &major, &minor);
if (status) {
BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status);
Expand Down Expand Up @@ -595,7 +598,8 @@ namespace va {
return false;
}

int major, minor;
int major;
int minor;
auto status = vaInitialize(display.get(), &major, &minor);
if (status) {
BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status);
Expand Down
3 changes: 2 additions & 1 deletion src/platform/linux/wlgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ namespace wl {
gl::ctx.BindTexture(GL_TEXTURE_2D, (*rgb_opt)->tex[0]);

// Don't remove these lines, see https://github.com/LizardByte/Sunshine/issues/453
int w, h;
int h;
int w;
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h;
Expand Down
6 changes: 4 additions & 2 deletions src/platform/windows/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ namespace platf::dxgi {
std::vector<std::uint8_t> img_data;

DXGI_OUTDUPL_POINTER_SHAPE_INFO shape_info;
int x, y;
int x;
int y;
bool visible;
};

Expand Down Expand Up @@ -346,7 +347,8 @@ namespace platf::dxgi {
winrt::Windows::Graphics::Capture::GraphicsCaptureItem item {nullptr};
winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool frame_pool {nullptr};
winrt::Windows::Graphics::Capture::GraphicsCaptureSession capture_session {nullptr};
winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame produced_frame {nullptr}, consumed_frame {nullptr};
winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame consumed_frame {nullptr};
winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame produced_frame {nullptr};
SRWLOCK frame_lock = SRWLOCK_INIT;
CONDITION_VARIABLE frame_present_cv;

Expand Down
6 changes: 4 additions & 2 deletions src/platform/windows/display_vram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,10 @@ namespace platf::dxgi {
ps_t convert_UV_ps;
ps_t convert_UV_fp16_ps;

std::array<D3D11_VIEWPORT, 3> out_Y_or_YUV_viewports, out_Y_or_YUV_viewports_for_clear;
D3D11_VIEWPORT out_UV_viewport, out_UV_viewport_for_clear;
std::array<D3D11_VIEWPORT, 3> out_Y_or_YUV_viewports;
std::array<D3D11_VIEWPORT, 3> out_Y_or_YUV_viewports_for_clear;
D3D11_VIEWPORT out_UV_viewport;
D3D11_VIEWPORT out_UV_viewport_for_clear;

DXGI_FORMAT format;

Expand Down
4 changes: 3 additions & 1 deletion src/platform/windows/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ namespace platf {
auto &report = gamepad.report.ds4.Report;

// Use int32 to process this data, so we can clamp if needed.
int32_t intX, intY, intZ;
int32_t intX;
int32_t intY;
int32_t intZ;

switch (motion_type) {
case LI_MOTION_TYPE_ACCEL:
Expand Down
14 changes: 8 additions & 6 deletions src/platform/windows/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,20 @@ namespace {
std::atomic<bool> used_nt_set_timer_resolution = false;

bool nt_set_timer_resolution_max() {
ULONG minimum, maximum, current;
if (!NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, &current)) ||
!NT_SUCCESS(NtSetTimerResolution(maximum, TRUE, &current))) {
ULONG maximum;
ULONG minimum;
if (ULONG current; !NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, &current)) ||
!NT_SUCCESS(NtSetTimerResolution(maximum, TRUE, &current))) {
return false;
}
return true;
}

bool nt_set_timer_resolution_min() {
ULONG minimum, maximum, current;
if (!NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, &current)) ||
!NT_SUCCESS(NtSetTimerResolution(minimum, TRUE, &current))) {
ULONG maximum;
ULONG minimum;
if (ULONG current; !NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, &current)) ||
!NT_SUCCESS(NtSetTimerResolution(minimum, TRUE, &current))) {
return false;
}
return true;
Expand Down
5 changes: 2 additions & 3 deletions src/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,9 +1377,8 @@ namespace stream {
}

std::array<std::string_view, MAX_FEC_BLOCKS> fec_blocks;
decltype(fec_blocks)::iterator
fec_blocks_begin = std::begin(fec_blocks),
fec_blocks_end = std::begin(fec_blocks) + fec_blocks_needed;
auto fec_blocks_begin = std::begin(fec_blocks);
auto fec_blocks_end = std::begin(fec_blocks) + fec_blocks_needed;

BOOST_LOG(verbose) << "Generating "sv << fec_blocks_needed << " FEC blocks"sv;

Expand Down
Loading
Loading