diff mbox series

[FFmpeg-devel,2/4] avformat/psxstr: fix demuxing I/O error at EOF

Message ID PAVPR08MB97952CF4960E474D2C2B38069A61A@PAVPR08MB9795.eurprd08.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,1/4] avcodec/mdec: DC reading for STRv1 is like STRv2 | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

aybe aybe Jan. 2, 2024, 2:52 a.m. UTC
This second patch fixes the following error at the end of a .STR stream conversion:

[in#0/psxstr @ 0000000000681e80] Error during demuxing: I/O error

It's been a bit of trial and error as I've never used ffmpeg, but returning AVERROR_EOF appears to be the way to go (doesn't complain anymore).

Signed-off-by: aybe <aybe@users.noreply.github.com>
---
  libavformat/psxstr.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

--
2.41.0.windows.1

Comments

Michael Niedermayer Jan. 11, 2024, 1:07 p.m. UTC | #1
On Tue, Jan 02, 2024 at 02:52:11AM +0000, aybe aybe wrote:
> This second patch fixes the following error at the end of a .STR stream conversion:
> 
> [in#0/psxstr @ 0000000000681e80] Error during demuxing: I/O error
> 
> It's been a bit of trial and error as I've never used ffmpeg, but returning AVERROR_EOF appears to be the way to go (doesn't complain anymore).
> 
> Signed-off-by: aybe <aybe@users.noreply.github.com>
> ---
>   libavformat/psxstr.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index bb56b05688..72d14b9792 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -165,8 +165,12 @@  static int str_read_packet(AVFormatContext *s,
      AVStream *st;

      while (1) {
+        int read = avio_read(pb, sector, RAW_CD_SECTOR_SIZE);

-        if (avio_read(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
+        if (read == AVERROR_EOF)
+            return AVERROR_EOF;
+
+        if (read != RAW_CD_SECTOR_SIZE)
              return AVERROR(EIO);

          channel = sector[0x11];