[vlc-commits] [Git][videolan/vlc][master] demux/mkv: return 0 when the data was not fully read

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Mar 1 09:01:23 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6e4a202e by Steve Lhomme at 2025-03-01T07:29:30+00:00
demux/mkv: return 0 when the data was not fully read

This is how the IOCallback abstraction works [^1].
Either you read the amount requested, or you return 0.

vlc_stream_Read() reads the whole amount of data, unless it reaches the end of file.
In that case it returns the amount it could read.

[^1]: https://github.com/Matroska-Org/libebml/blob/ba5707e3268be330516c678c7de14af734f0f3b9/ebml/IOCallback.h#L30

- - - - -


1 changed file:

- modules/demux/mkv/stream_io_callback.cpp


Changes:

=====================================
modules/demux/mkv/stream_io_callback.cpp
=====================================
@@ -40,7 +40,7 @@ uint32 vlc_stream_io_callback::read( void *p_buffer, size_t i_size )
         return 0;
 
     int i_ret = vlc_stream_Read( s, p_buffer, i_size );
-    return i_ret < 0 ? 0 : i_ret;
+    return i_ret < 0 || i_ret < i_size ? 0 : i_ret;
 }
 
 void vlc_stream_io_callback::setFilePointer(int64_t i_offset, seek_mode mode )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e4a202e9b897e9b9962bc1c7c82e41feb323517

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e4a202e9b897e9b9962bc1c7c82e41feb323517
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list