vlc | branch: master | Rafaël Carré <[email protected]> | Tue Jan 31 19:40:38 2012 -0500| [acf912ad543fd1a26a186bd5765c59c50955c0bb] | committer: Rafaël Carré
avio output: flush after writes detect errors and abort writing if they happen > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=acf912ad543fd1a26a186bd5765c59c50955c0bb --- modules/access/avio.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/access/avio.c b/modules/access/avio.c index 7a17142..ddfe86f 100644 --- a/modules/access/avio.c +++ b/modules/access/avio.c @@ -293,13 +293,23 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer) size_t i_write = 0; while (p_buffer != NULL) { - block_t *p_next = p_buffer->p_next;; + block_t *p_next = p_buffer->p_next; #if LIBAVFORMAT_VERSION_MAJOR < 54 - i_write += url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer); + int written = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer); + if (written < 0) { + errno = AVUNERROR(written); + goto error; + } + i_write += written; #else - /* FIXME : how are errors notified ?? */ avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer); + avio_flush(p_sys->context); + if (p_sys->context->error) { + errno = AVUNERROR(p_sys->context->error); + p_sys->context->error = 0; /* FIXME? */ + goto error; + } i_write += p_buffer->i_buffer; #endif @@ -309,6 +319,11 @@ static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer) } return i_write; + +error: + msg_Err(p_access, "Wrote only %zu bytes (%m)", i_write); + block_ChainRelease( p_buffer ); + return i_write; } static int Seek(access_t *access, uint64_t position) _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
