Changeset 2fbd49c in mainline for uspace/srv/audio/hound/connection.c


Ignore:
Timestamp:
2022-09-22T09:01:32Z (17 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2139676
Parents:
a76e76b
git-author:
Jiri Svoboda <jiri@…> (2022-09-21 18:01:20)
git-committer:
Jiri Svoboda <jiri@…> (2022-09-22 09:01:32)
Message:

Audio synk needs locking

Without locking the list of sink connections, we are exposed
to a race between removing a connection at the end of playback
(typically while destroying a hound context) and audio device
event PCM_EVENT_FRAMES_PLAYED which causes audio mixing to occur
via audio_sink_mix_inputs(), causing hound to crash often at
the end of playback.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/connection.c

    ra76e76b r2fbd49c  
    6161                conn->source = source;
    6262                list_append(&conn->source_link, &source->connections);
     63                fibril_mutex_lock(&sink->lock);
    6364                list_append(&conn->sink_link, &sink->connections);
     65                fibril_mutex_unlock(&sink->lock);
    6466                audio_sink_set_format(sink, audio_source_format(source));
    6567                if (source->connection_change)
     
    8385        assert(!link_in_use(&connection->hound_link));
    8486        list_remove(&connection->source_link);
     87        fibril_mutex_lock(&connection->sink->lock);
    8588        list_remove(&connection->sink_link);
     89        fibril_mutex_unlock(&connection->sink->lock);
    8690        if (connection->sink && connection->sink->connection_change)
    8791                connection->sink->connection_change(connection->sink, false);
Note: See TracChangeset for help on using the changeset viewer.