panicked at 'attempt to subtract with overflow' when deserializing spa pod
Trying to deserialize Props
param data from pw results in:
spa_pod { size: 296, type_: 15 } @ 0x55ff54cf85c0
thread '<unnamed>' panicked at 'attempt to subtract with overflow', ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:396:23
3: libspa::pod::deserialize::PodDeserializer::deserialize_str
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:396:23
4: libspa::pod::deserialize::PodDeserializer::deserialize_any
at /home/arc/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:796:41
5: <libspa::pod::Value as libspa::pod::deserialize::PodDeserialize>::deserialize
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod.rs:606:9
6: libspa::pod::deserialize::StructPodDeserializer::deserialize_field
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:977:34
7: <libspa::pod::deserialize::ValueVisitor as libspa::pod::deserialize::Visitor>::visit_struct
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:1520:33
8: libspa::pod::deserialize::PodDeserializer::deserialize_struct
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:542:19
9: libspa::pod::deserialize::PodDeserializer::deserialize_any
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:801:41
10: <libspa::pod::Value as libspa::pod::deserialize::PodDeserialize>::deserialize
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod.rs:606:9
11: libspa::pod::deserialize::ObjectPodDeserializer::deserialize_property
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:1052:34
12: <libspa::pod::deserialize::ValueVisitor as libspa::pod::deserialize::Visitor>::visit_object
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:1533:47
13: libspa::pod::deserialize::PodDeserializer::deserialize_object
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:586:19
14: libspa::pod::deserialize::PodDeserializer::deserialize_any
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:803:41
15: <libspa::pod::Value as libspa::pod::deserialize::PodDeserialize>::deserialize
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod.rs:606:9
16: libspa::pod::deserialize::PodDeserializer::deserialize_from
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:242:9
17: libspa::pod::deserialize::PodDeserializer::deserialize_ptr
at ~/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libspa-0.4.1/src/pod/deserialize.rs:258:19
Here's the actual expected object, constructed using a spa_pod_parser
instead of nom:
Object {
type: Spa:Pod:Object:Param:Props (262146),
id: "Props" (2),
properties: [
Property {
key: "volume" (65539),
flags: (empty),
value: Float(1.0),
},
Property {
key: "mute" (65540),
flags: (empty),
value: Bool(false),
},
Property {
key: "channelVolumes" (65544),
flags: (empty),
value: ValueArray(Float([0.3890102, 0.3890102])),
},
Property {
key: "channelMap" (65547),
flags: (empty),
value: Ids(
[
"FL" (3),
"FR" (4),
],
),
},
Property {
key: "softMute" (65551),
flags: (empty),
value: Bool(false),
},
Property {
key: "softVolumes" (65552),
flags: (empty),
value: ValueArray(Float([1.0, 1.0])),
},
Property {
key: "monitorMute" (65548),
flags: (empty),
value: Bool(false),
},
Property {
key: "monitorVolumes" (65549),
flags: (empty),
value: ValueArray(Float([1.0, 1.0])),
},
Property {
key: "params" (524289),
flags: (empty),
value: Struct(
[
String("monitor.channel-volumes"),
Bool(false),
],
),
},
],
}
(btw, libspa::pod::deserialize::PodDeserializer
should really be a trait instead of a struct so that parsers can be implemented externally as a proper analogue to a serde::Deserializer
; likewise for PodSerializer
)
Edited by arcnmx