Opened 12 years ago
Closed 12 years ago
#2537 closed defect (fixed)
ffurl_read_complete returns incorrect value
Reported by: | jyavenard | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
This bug report is about the use of the avio's API amd ffurl_read_complete
according to the documentation, ffurl_read_complete:
Read as many bytes as possible (up to size), calling the read function multiple times if necessary. This makes special short-read handling in applications unnecessary, if the return value is < size then it is certain there was either an error or the end of file was reached. Definition at line 310 of file avio.c.
The issue is actually in retry_transfer_wrapper in avio.c.
If you try to read n-bytes of data using ffurl_read_complete when the current position in the file is less than n-bytes from the end.
ffurl_read_complete will return AVERROR_EOF instead of the number of bytes actually read (and here the number of bytes returned would be less than the number of bytes asked).
Expected behaviour:
ffurl_read_complete when encountering an end of file, should return the number of bytes actually read, and set eof flags accordingly
Background information.
The issue was found trying to play file in #2513
and reading the MOOV data. The MOOV table is located at the end of the file. MythTV seeks data from the file using ffurl_read_complete ; it would sometimes fail because we are enable to read the data close to the end of the file.
Change History (2)
comment:1 by , 12 years ago
Component: | undetermined → avformat |
---|---|
Version: | unspecified → git-master |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in a46e578ddacd680b5b169a70c61032381a1b9f63
Please test