Return EOF when fetchedCount == 0

This commit is contained in:
Isaac 2024-12-24 14:42:59 +08:00
parent 3bd97fcd34
commit 7cbf77c2b6
2 changed files with 7 additions and 0 deletions

View File

@ -184,6 +184,10 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
}
fetchedCount = Int32(fetchedData.count)
context.readingOffset += Int64(fetchedCount)
if fetchedCount == 0 {
return FFMPEG_CONSTANT_AVERROR_EOF
}
}
if context.closed {

View File

@ -70,6 +70,9 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
}
let fetchedCount = Int32(fetchedData.count)
context.readingOffset += Int64(fetchedCount)
if fetchedCount == 0 {
return FFMPEG_CONSTANT_AVERROR_EOF
}
return fetchedCount
} else {
return FFMPEG_CONSTANT_AVERROR_EOF