* data instead of calling the protocol seek function, for seekable
* protocols.
*/
-#define SHORT_SEEK_THRESHOLD 4096
+#define SHORT_SEEK_THRESHOLD 32768
static void *ff_avio_child_next(void *obj, void *prev)
{
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
{
int ret = avio_read(s, buf, size);
- if (ret != size)
- return AVERROR_INVALIDDATA;
- return ret;
+ if (ret == size)
+ return ret;
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+ return AVERROR_INVALIDDATA;
}
int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data)
len = s->buf_end - s->buf_ptr;
if (len == 0) {
- /* Reset the buf_end pointer to the start of the buffer, to make sure
- * the fill_buffer call tries to read as much data as fits into the
- * full buffer, instead of just what space is left after buf_end.
- * This avoids returning partial packets at the end of the buffer,
- * for packet based inputs.
- */
- s->buf_end = s->buf_ptr = s->buffer;
fill_buffer(s);
len = s->buf_end - s->buf_ptr;
}