Changeset 2fbd49c in mainline
- Timestamp:
- 2022-09-22T09:01:32Z (2 years ago)
- 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)
- Location:
- uspace/srv/audio/hound
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_sink.c
ra76e76b r2fbd49c 36 36 #include <assert.h> 37 37 #include <errno.h> 38 #include <fibril_synch.h> 38 39 #include <stdlib.h> 39 40 #include <str.h> … … 64 65 return EINVAL; 65 66 link_initialize(&sink->link); 67 fibril_mutex_initialize(&sink->lock); 66 68 list_initialize(&sink->connections); 67 69 sink->name = str_dup(name); … … 139 141 140 142 pcm_format_silence(dest, size, &sink->format); 143 fibril_mutex_lock(&sink->lock); 141 144 list_foreach(sink->connections, sink_link, connection_t, conn) { 142 145 const errno_t ret = connection_add_source_data( … … 147 150 } 148 151 } 152 fibril_mutex_unlock(&sink->lock); 149 153 } 150 154 -
uspace/srv/audio/hound/audio_sink.h
ra76e76b r2fbd49c 41 41 #include <stdbool.h> 42 42 #include <fibril.h> 43 #include <fibril_synch.h> 43 44 #include <pcm/format.h> 44 45 … … 51 52 /** Link in hound's sink list */ 52 53 link_t link; 54 /** Protect sink including list of connections */ 55 fibril_mutex_t lock; 53 56 /** List of all related connections */ 54 57 list_t connections; -
uspace/srv/audio/hound/connection.c
ra76e76b r2fbd49c 61 61 conn->source = source; 62 62 list_append(&conn->source_link, &source->connections); 63 fibril_mutex_lock(&sink->lock); 63 64 list_append(&conn->sink_link, &sink->connections); 65 fibril_mutex_unlock(&sink->lock); 64 66 audio_sink_set_format(sink, audio_source_format(source)); 65 67 if (source->connection_change) … … 83 85 assert(!link_in_use(&connection->hound_link)); 84 86 list_remove(&connection->source_link); 87 fibril_mutex_lock(&connection->sink->lock); 85 88 list_remove(&connection->sink_link); 89 fibril_mutex_unlock(&connection->sink->lock); 86 90 if (connection->sink && connection->sink->connection_change) 87 91 connection->sink->connection_change(connection->sink, false); -
uspace/srv/audio/hound/hound.c
ra76e76b r2fbd49c 126 126 assert(fibril_mutex_is_locked(&hound->list_guard)); 127 127 log_verbose("Removing sink '%s'.", sink->name); 128 fibril_mutex_lock(&sink->lock); 128 129 if (!list_empty(&sink->connections)) 129 130 log_warning("Removing sink '%s' while still connected.", sink->name); … … 135 136 } 136 137 list_remove(&sink->link); 138 fibril_mutex_unlock(&sink->lock); 137 139 } 138 140
Note:
See TracChangeset
for help on using the changeset viewer.