MozillaFirefox/mozilla-bmo1746799.patch

73 lines
5.8 KiB
Diff
Raw Normal View History

From 535dc3c97fd19a30a329a188786998ae00cdf017 Mon Sep 17 00:00:00 2001
From: andrew <andrew@arobeia.co.uk>
Date: Thu, 23 Dec 2021 16:18:30 +0000
Subject: [PATCH] Map linearly from cubeb volume to pa volume
Fixes incorrect volume mapping.
Rebased to current SUSE sources and updated checksums Wed Sep 04 00:00:00 2024
diff --git a/third_party/rust/cubeb-pulse/.cargo-checksum.json b/third_party/rust/cubeb-pulse/.cargo-checksum.json
--- a/third_party/rust/cubeb-pulse/.cargo-checksum.json
+++ b/third_party/rust/cubeb-pulse/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"477366d58c9dc059dbe4a158a6e910f23a3e9ecac7411f73616e06375583b764","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"4dc677a2a769c0f1667c7ad52bc7b09d22ae8e47bb95389223a5075eb4228d13","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"c0db5f2447de1d6df5aa2812fa342a085e73156a072c221c7379b9a6a9b86786","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"dfb30ec497d6215e4535e936fea8fe3a407ef24dc1cec43b52c0ffa923d9229c","src/backend/stream.rs":"dfe5b747e100cae4aeae36cf2ebb9dc4715b411b4116721a40eec2944eb0ec23","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
\ No newline at end of file
+{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"477366d58c9dc059dbe4a158a6e910f23a3e9ecac7411f73616e06375583b764","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"4dc677a2a769c0f1667c7ad52bc7b09d22ae8e47bb95389223a5075eb4228d13","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"c0db5f2447de1d6df5aa2812fa342a085e73156a072c221c7379b9a6a9b86786","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"dfb30ec497d6215e4535e936fea8fe3a407ef24dc1cec43b52c0ffa923d9229c","src/backend/stream.rs":"2dfc61c4eac69624558756d87283496d01f56f44bf311119eff0f1d124cd88f3","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
diff --git a/third_party/rust/cubeb-pulse/src/backend/stream.rs b/third_party/rust/cubeb-pulse/src/backend/stream.rs
--- a/third_party/rust/cubeb-pulse/src/backend/stream.rs
+++ b/third_party/rust/cubeb-pulse/src/backend/stream.rs
@@ -760,18 +760,18 @@ impl<'ctx> StreamOps for PulseStream<'ct
_ => pulse::SinkFlags::empty(),
}
};
if flags.contains(pulse::SinkFlags::FLAT_VOLUME) {
self.volume = volume;
} else {
let channels = stm.get_sample_spec().channels;
- let vol = pulse::sw_volume_from_linear(f64::from(volume));
- cvol.set(u32::from(channels), vol);
+ let vol = volume * (PA_VOLUME_NORM as f32);
+ cvol.set(u32::from(channels), vol as pa_volume_t);
let index = stm.get_index();
let context_ptr = self.context as *const _ as *mut _;
if let Ok(o) = context.set_sink_input_volume(
index,
&cvol,
context_success,
diff --git a/third_party/rust/pulse-ffi/.cargo-checksum.json b/third_party/rust/pulse-ffi/.cargo-checksum.json
--- a/third_party/rust/pulse-ffi/.cargo-checksum.json
+++ b/third_party/rust/pulse-ffi/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"d0d7e81366920147911554f68c95567cae0931950c6d96ccc2c986508473642e","src/ffi_funcs.rs":"a16646c5e7c49e94b907a7a404cfcadf3007688005c689cca936f0c2ee2e28e6","src/ffi_types.rs":"2ca56bc3638a40d331e53117a5dd175d0a6e102b1e0eccb9c2adc565c6861a33","src/lib.rs":"6aff308de11954a067d0f6ef95bf3126aabb6d928a5191e91d9a38ebadba91c2"},"package":null}
\ No newline at end of file
+{"files":{"Cargo.toml":"d0d7e81366920147911554f68c95567cae0931950c6d96ccc2c986508473642e","src/ffi_funcs.rs":"a16646c5e7c49e94b907a7a404cfcadf3007688005c689cca936f0c2ee2e28e6","src/ffi_types.rs":"f39a27712b17256583331f7ce5722413d0c7b51d73d8def8f50e839e23dfb411","src/lib.rs":"6aff308de11954a067d0f6ef95bf3126aabb6d928a5191e91d9a38ebadba91c2"},"package":null}
diff --git a/third_party/rust/pulse-ffi/src/ffi_types.rs b/third_party/rust/pulse-ffi/src/ffi_types.rs
--- a/third_party/rust/pulse-ffi/src/ffi_types.rs
+++ b/third_party/rust/pulse-ffi/src/ffi_types.rs
@@ -17,16 +17,21 @@ pub const PA_SAMPLE_S32BE: c_int = 8;
pub const PA_SAMPLE_S24LE: c_int = 9;
pub const PA_SAMPLE_S24BE: c_int = 10;
pub const PA_SAMPLE_S24_32LE: c_int = 11;
pub const PA_SAMPLE_S24_32BE: c_int = 12;
pub const PA_SAMPLE_MAX: c_int = 13;
pub const PA_SAMPLE_INVALID: c_int = -1;
pub type pa_sample_format_t = c_int;
+pub const PA_VOLUME_MUTED: c_uint = 0;
+pub const PA_VOLUME_NORM: c_uint = 0x10000;
+pub const PA_VOLUME_MAX: c_uint = 0x7fffffff;
+
+
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct Struct_pa_sample_spec {
pub format: pa_sample_format_t,
pub rate: u32,
pub channels: u8,
}