Changeset 541eb67 in mainline


Ignore:
Timestamp:
2017-12-20T16:08:49Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d4a829e
Parents:
d9f0894
Message:

Hound error handling fixes.

Location:
uspace/srv/audio/hound
Files:
6 edited

Legend:

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

    rd9f0894 r541eb67  
    260260 * @param size Target buffer size.
    261261 * @param format Target data format.
    262  * @return Size of the target buffer used, Error code on failure.
    263  */
    264 ssize_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
     262 * @return Size of the target buffer used.
     263 */
     264size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
    265265    size_t size, const pcm_format_t *f)
    266266{
  • uspace/srv/audio/hound/audio_data.h

    rd9f0894 r541eb67  
    7878audio_data_t *audio_pipe_pop(audio_pipe_t *pipe);
    7979
    80 ssize_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size,
     80size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size,
    8181    const pcm_format_t *f);
    8282
  • uspace/srv/audio/hound/connection.c

    rd9f0894 r541eb67  
    101101 * @param format format of the destination audio buffer.
    102102 */
    103 ssize_t connection_add_source_data(connection_t *connection, void *data,
     103int connection_add_source_data(connection_t *connection, void *data,
    104104    size_t size, pcm_format_t format)
    105105{
     
    116116        log_verbose("Data available after update: %zu",
    117117            audio_pipe_bytes(&connection->fifo));
    118         ssize_t ret =
     118        size_t ret =
    119119            audio_pipe_mix_data(&connection->fifo, data, size, &format);
    120         if (ret != (ssize_t)size)
     120        if (ret != size)
    121121                log_warning("Connection failed to provide enough data %zd/%zu",
    122122                    ret, size);
    123         return ret > 0 ? EOK : ret;
     123        return EOK;
    124124}
    125125/**
  • uspace/srv/audio/hound/connection.h

    rd9f0894 r541eb67  
    8484void connection_destroy(connection_t *connection);
    8585
    86 ssize_t connection_add_source_data(connection_t *connection, void *data,
     86int connection_add_source_data(connection_t *connection, void *data,
    8787    size_t size, pcm_format_t format);
    8888
  • uspace/srv/audio/hound/hound_ctx.c

    rd9f0894 r541eb67  
    340340
    341341        pcm_format_silence(data, size, &stream->format);
    342         const int ret =
     342        const size_t ret =
    343343            audio_pipe_mix_data(&stream->fifo, data, size, &stream->format);
    344344        fibril_mutex_unlock(&stream->guard);
    345         if (ret == EOK)
     345        if (ret > 0) {
    346346                fibril_condvar_signal(&stream->change);
    347         return ret;
     347                return EOK;
     348        }
     349        return EEMPTY;
    348350}
    349351
     
    354356 * @param size Size of the @p data buffer.
    355357 * @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 */
     360size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
    360361    size_t size, const pcm_format_t *f)
    361362{
    362363        assert(stream);
    363364        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);
    365366        fibril_condvar_signal(&stream->change);
    366367        fibril_mutex_unlock(&stream->guard);
     
    457458        list_foreach(sink->connections, source_link, connection_t, conn) {
    458459                /* This should not trigger data update on the source */
    459                 const size_t copied = connection_add_source_data(
     460                connection_add_source_data(
    460461                    conn, buffer, bsize, sink->format);
    461                 if (copied != bsize)
    462                         log_error("Copied less than advertised data, "
    463                             "something is wrong");
    464462        }
    465463        /* push to all streams */
  • uspace/srv/audio/hound/hound_ctx.h

    rd9f0894 r541eb67  
    7575    size_t size);
    7676int hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);
    77 ssize_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
     77size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
    7878    size_t size, const pcm_format_t *f);
    7979void hound_ctx_stream_drain(hound_ctx_stream_t *stream);
Note: See TracChangeset for help on using the changeset viewer.