Call snd_seq_ev_clear on Alsa MIDI send events
MIDI output is broken on Linux. The ALSA documentation shows that we
should be clearing events after declaring them. Clearing the event
allows MIDI output to send again.
It was probably working before just by coincidence, and the problem
was exposed by changes in the event structure.
Bug: 40940293
Change-Id: Ifc671cfb173351eff72f7f43c776ee84b7f8aef1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5302886
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Michael Wilson <mjwilson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1261506}
diff --git a/media/midi/midi_manager_alsa.cc b/media/midi/midi_manager_alsa.cc
index 747d780..484ecd1 100644
--- a/media/midi/midi_manager_alsa.cc
+++ b/media/midi/midi_manager_alsa.cc
@@ -809,6 +809,7 @@
ScopedSndMidiEventPtr encoder = CreateScopedSndMidiEventPtr(kSendBufferSize);
for (const auto datum : data) {
snd_seq_event_t event;
+ snd_seq_ev_clear(&event);
int result = snd_midi_event_encode_byte(encoder.get(), datum, &event);
if (result == 1) {
// Full event, send it.