Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12179 closed Bug Report - General (fixed)

MythTV doesn't play file

Reported by: JYA Owned by: JYA
Priority: minor Milestone: 0.27.2
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

File http://nrkbeta.no/2009/12/18/bergensbanen-eng/

doesn't play http://nrkbeta.no/torrent/divtorrents/Bergensbanen-minutt.for.minutt.1280x720p50.h264.NRK.mp4.torrent

The cause for the failure is related to how the RingBuffer::Read behaves.

It waits until there's exactly the number of bytes requested. Here, FFmpeg seek to the end of the file and request 5189405 but we are 4161536 from the end of the file only.

It times out after 16s waiting.

RingBuffer::Read should returns only what is currently available and not wait unnecessarily, letting FFmpeg deal with the retries.

Change History (5)

comment:1 Changed 10 years ago by JYA

diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbu
index 5628863..8dbd62c 100644
--- a/mythtv/libs/libmythtv/ringbuffer.cpp
+++ b/mythtv/libs/libmythtv/ringbuffer.cpp
@@ -1251,6 +1251,7 @@ bool RingBuffer::WaitForAvail(int count)
 {
     int avail = ReadBufAvail();
     count = (ateof && avail < count) ? avail : count;
+    count = !ateof && avail < count && avail > 0 ? avail : count;

     if (livetvchain && setswitchtonext && avail < count)
     {

this allows to play that particular file. However I'm not comfortable with simply returning a value > 0 if we have one.

We should still wait under special circumstances.

still looking at a more appropriate fix, that would less likely cause regression

comment:2 Changed 10 years ago by JYA

I feel #10658 was likely a good solution for this:

it doesn't wait after just a seek, and still wait 10s for other types of read

comment:3 Changed 10 years ago by Jean-Yves Avenard <jyavenard@…>

Resolution: fixed
Status: newclosed

In 13845afd923f2706134424b2e458d02c89ab5d83/mythtv:

Allow partial reads

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 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.

Based on a patch by DanielK
Fixes #12179
Ref #10658

comment:4 Changed 10 years ago by Jean-Yves Avenard <jyavenard@…>

In 5433b7647f6ce97b606c36829340ae311ef7da4c/mythtv:

Allow partial reads

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 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.

Based on a patch by DanielK
Fixes #12179
Ref #10658

comment:5 Changed 10 years ago by Jean-Yves Avenard <jyavenard@…>

In 5aa484744061688ac850a70d16980834e736f44c/mythtv:

Allow partial reads

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 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.

Based on a patch by DanielK
Fixes #12179
Ref #10658

(cherry picked from commit 5433b7647f6ce97b606c36829340ae311ef7da4c)

Conflicts:

mythtv/libs/libmythtv/ringbuffer.cpp

Note: See TracTickets for help on using tickets.