summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-04-23 16:04:57 +0300
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-04-25 13:07:50 +0300
commit7775f1562ca348f0c1a21388053172368055c5f1 (patch)
tree351853da293c12d0f4ab79cd5596bee973612c95 /lib
parent0f39100b2c70cd251c2827aab39925f4fa298453 (diff)
tests/kms_chamelium: test audio channels are not mixed up
Send a different signal to each channel and make sure captured audio channels are not swapped or mixed up. The Chamelium device has a bug and already swaps the left and right channels. For this reason, clients need to retrieve the Chamelium channel mapping and accomodate for this. See https://crbug.com/950922 for a discussion about this. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_chamelium.c34
-rw-r--r--lib/igt_chamelium.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 7c9030d1..6ac7b722 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -931,6 +931,40 @@ int chamelium_get_captured_frame_count(struct chamelium *chamelium)
}
/**
+ * chamelium_get_audio_channel_mapping:
+ * @chamelium: the Chamelium instance
+ * @port: the audio port
+ * @mapping: will be filled with the channel mapping
+ *
+ * Obtains the channel mapping for an audio port.
+ *
+ * Audio channels are not guaranteed not to be swapped. Users can use the
+ * channel mapping to match an input channel to a capture channel.
+ *
+ * The mapping contains one element per capture channel. Each element indicates
+ * which input channel the capture channel is mapped to. As a special case, -1
+ * means that the channel isn't mapped.
+ */
+void chamelium_get_audio_channel_mapping(struct chamelium *chamelium,
+ struct chamelium_port *port,
+ int mapping[static 8])
+{
+ xmlrpc_value *res, *res_channel;
+ int res_len, i;
+
+ res = chamelium_rpc(chamelium, port, "GetAudioChannelMapping", "(i)",
+ port->id);
+ res_len = xmlrpc_array_size(&chamelium->env, res);
+ igt_assert(res_len == 8);
+ for (i = 0; i < res_len; i++) {
+ xmlrpc_array_read_item(&chamelium->env, res, i, &res_channel);
+ xmlrpc_read_int(&chamelium->env, res_channel, &mapping[i]);
+ xmlrpc_DECREF(res_channel);
+ }
+ xmlrpc_DECREF(res);
+}
+
+/**
* chamelium_start_capturing_audio:
* @chamelium: the Chamelium instance
* @port: the port to capture audio from (it must support audio)
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 047f8c5d..728d16ea 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -106,6 +106,9 @@ void chamelium_start_capture(struct chamelium *chamelium,
void chamelium_stop_capture(struct chamelium *chamelium, int frame_count);
void chamelium_capture(struct chamelium *chamelium, struct chamelium_port *port,
int x, int y, int w, int h, int frame_count);
+void chamelium_get_audio_channel_mapping(struct chamelium *chamelium,
+ struct chamelium_port *port,
+ int mapping[static 8]);
void chamelium_start_capturing_audio(struct chamelium *chamelium,
struct chamelium_port *port, bool save_to_file);
struct chamelium_audio_file *chamelium_stop_capturing_audio(struct chamelium *chamelium,