mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-04 04:06:26 -05:00
seq: return back old snd_seq_drain_output behaviour for -EAGAIN
It seems that many applications did not follow the documentation
including pyalsa sequencer module, thus return the previous
behaviour and correct documentation.
Closes: https://github.com/alsa-project/alsa-lib/issues/493
Fixes: b97a11ec ("seq: fix snd_seq_drain_output return value for partial drain")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
63a981865a
commit
805464c7bd
1 changed files with 3 additions and 8 deletions
|
|
@ -4431,8 +4431,7 @@ int snd_seq_event_output_pending(snd_seq_t *seq)
|
|||
* \brief drain output buffer to sequencer
|
||||
* \param seq sequencer handle
|
||||
* \return 0 when all events are drained and sent to sequencer.
|
||||
* When events still remain on the buffer, the byte size of remaining
|
||||
* events are returned. On error a negative error code is returned.
|
||||
* On error a negative error code is returned (including -EAGAIN).
|
||||
*
|
||||
* This function drains all pending events on the output buffer.
|
||||
* The function returns immediately after the events are sent to the queues
|
||||
|
|
@ -4444,19 +4443,15 @@ int snd_seq_event_output_pending(snd_seq_t *seq)
|
|||
*/
|
||||
int snd_seq_drain_output(snd_seq_t *seq)
|
||||
{
|
||||
ssize_t result, processed = 0;
|
||||
ssize_t result;
|
||||
assert(seq);
|
||||
while (seq->obufused > 0) {
|
||||
result = seq->ops->write(seq, seq->obuf, seq->obufused);
|
||||
if (result < 0) {
|
||||
if (result == -EAGAIN && processed > 0)
|
||||
return seq->obufused;
|
||||
if (result < 0)
|
||||
return result;
|
||||
}
|
||||
if ((size_t)result < seq->obufused)
|
||||
memmove(seq->obuf, seq->obuf + result, seq->obufused - result);
|
||||
seq->obufused -= result;
|
||||
processed += result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue