Opened 8 years ago

Closed 6 years ago

#10658 closed Developer Task (Won't Fix)

Allow partial AVFRingBuffer reads

Reported by: danielk Owned by: danielk
Priority: minor Milestone: 0.28
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by danielk)

Traditionally we've always had RingBuffer::Read() return the number of bytes requested unless we are at the end of the file. But this blocks libav which expects this the read to complete fairly quickly even if it is a blocking read. Instead we should block for only a short time waiting for more data and then return what data we do have as long as we have at least 1 byte of data.

Attachments (3)

10658-v1.patch (8.0 KB) - added by danielk 8 years ago.
Initial patch
10658-v2.patch (13.7 KB) - added by danielk 7 years ago.
Rework which allows short reads, but still avoids ever returning 0 bytes.
10490-debug-start-new-rec-every-30-sec-v2.patch (2.2 KB) - added by anonymous 7 years ago.
debugging patch

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by danielk

Attachment: 10658-v1.patch added

Initial patch

comment:1 Changed 8 years ago by danielk

Owner: set to danielk
Status: newaccepted
Type: Bug Report - GeneralDeveloper Task
Version: UnspecifiedMaster Head

comment:2 Changed 7 years ago by danielk

Milestone: 0.260.27

comment:3 Changed 7 years ago by danielk

With some debugging I've discovered that if you return -EAGAIN a number of times to libav it will mark the stream as having hit EOF. Even if you later reset the EOF flag any partially decoded data will be chucked by libav.

This means this solution is unworkable as is. However, we can still return partial reads as long as we avoid returning zero byte reads or -EAGAIN reads.

Changed 7 years ago by danielk

Attachment: 10658-v2.patch added

Rework which allows short reads, but still avoids ever returning 0 bytes.

comment:4 Changed 7 years ago by danielk

Description: modified (diff)
Summary: Rework AVFRingBuffer to return -EAGAIN when there is no dataAllow partial AVFRingBuffer reads

Changed 7 years ago by anonymous

debugging patch

comment:5 Changed 6 years ago by paulh

Milestone: 0.270.28

comment:6 Changed 6 years ago by JYA

Resolution: Won't Fix
Status: acceptedclosed

most of this is now unecessary as 1- ffmpeg doesn't consider having reached EOF when Read returns 0 2- RingBuffer::run will manage small read

Note: See TracTickets for help on using tickets.