Changeset 541eb67 in mainline
- Timestamp:
- 2017-12-20T16:08:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d4a829e
- Parents:
- d9f0894
- Location:
- uspace/srv/audio/hound
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.c
rd9f0894 r541eb67 260 260 * @param size Target buffer size. 261 261 * @param format Target data format. 262 * @return Size of the target buffer used , Error code on failure.263 */ 264 s size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,262 * @return Size of the target buffer used. 263 */ 264 size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data, 265 265 size_t size, const pcm_format_t *f) 266 266 { -
uspace/srv/audio/hound/audio_data.h
rd9f0894 r541eb67 78 78 audio_data_t *audio_pipe_pop(audio_pipe_t *pipe); 79 79 80 s size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size,80 size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size, 81 81 const pcm_format_t *f); 82 82 -
uspace/srv/audio/hound/connection.c
rd9f0894 r541eb67 101 101 * @param format format of the destination audio buffer. 102 102 */ 103 ssize_t connection_add_source_data(connection_t *connection, void *data,103 int connection_add_source_data(connection_t *connection, void *data, 104 104 size_t size, pcm_format_t format) 105 105 { … … 116 116 log_verbose("Data available after update: %zu", 117 117 audio_pipe_bytes(&connection->fifo)); 118 s size_t ret =118 size_t ret = 119 119 audio_pipe_mix_data(&connection->fifo, data, size, &format); 120 if (ret != (ssize_t)size)120 if (ret != size) 121 121 log_warning("Connection failed to provide enough data %zd/%zu", 122 122 ret, size); 123 return ret > 0 ? EOK : ret;123 return EOK; 124 124 } 125 125 /** -
uspace/srv/audio/hound/connection.h
rd9f0894 r541eb67 84 84 void connection_destroy(connection_t *connection); 85 85 86 ssize_t connection_add_source_data(connection_t *connection, void *data,86 int connection_add_source_data(connection_t *connection, void *data, 87 87 size_t size, pcm_format_t format); 88 88 -
uspace/srv/audio/hound/hound_ctx.c
rd9f0894 r541eb67 340 340 341 341 pcm_format_silence(data, size, &stream->format); 342 const int ret =342 const size_t ret = 343 343 audio_pipe_mix_data(&stream->fifo, data, size, &stream->format); 344 344 fibril_mutex_unlock(&stream->guard); 345 if (ret == EOK)345 if (ret > 0) { 346 346 fibril_condvar_signal(&stream->change); 347 return ret; 347 return EOK; 348 } 349 return EEMPTY; 348 350 } 349 351 … … 354 356 * @param size Size of the @p data buffer. 355 357 * @param format Destination data format. 356 * @return Size of the destination buffer touch with stream's data, 357 * error code on failure. 358 */ 359 ssize_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data, 358 * @return Size of the destination buffer touch with stream's data. 359 */ 360 size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data, 360 361 size_t size, const pcm_format_t *f) 361 362 { 362 363 assert(stream); 363 364 fibril_mutex_lock(&stream->guard); 364 const int ret = audio_pipe_mix_data(&stream->fifo, data, size, f);365 const size_t ret = audio_pipe_mix_data(&stream->fifo, data, size, f); 365 366 fibril_condvar_signal(&stream->change); 366 367 fibril_mutex_unlock(&stream->guard); … … 457 458 list_foreach(sink->connections, source_link, connection_t, conn) { 458 459 /* This should not trigger data update on the source */ 459 con st size_t copied = connection_add_source_data(460 connection_add_source_data( 460 461 conn, buffer, bsize, sink->format); 461 if (copied != bsize)462 log_error("Copied less than advertised data, "463 "something is wrong");464 462 } 465 463 /* push to all streams */ -
uspace/srv/audio/hound/hound_ctx.h
rd9f0894 r541eb67 75 75 size_t size); 76 76 int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size); 77 s size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,77 size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data, 78 78 size_t size, const pcm_format_t *f); 79 79 void hound_ctx_stream_drain(hound_ctx_stream_t *stream);
Note:
See TracChangeset
for help on using the changeset viewer.