Skip to content

Commit

Permalink
Reduce buffer size used while scanning media.
Browse files Browse the repository at this point in the history
For some reasons, when playing a MOV file by AirPlay from an iPhone fails when the buffer is too big. So add a method for specific stream allowing to temporarily reduce the size of the buffer. I suspect an issue in FFmpeg caching code.
This allows to work around it, without investigating too much the "why".

Fixes #11263
  • Loading branch information
jyavenard committed May 5, 2013
1 parent d0ea141 commit 3345a03
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -982,6 +982,7 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,

InitByteContext();

ic->pb->buffer_size = ringBuffer->DiscoveryBufferSize();
int err = avformat_open_input(&ic, filename, fmt, NULL);
if (err < 0)
{
Expand All @@ -990,6 +991,7 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
return -1;
}

ic->pb->buffer_size = ringBuffer->BestBufferSize();
int ret = FindStreamInfo();
if (ret < 0)
{
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/ringbuffer.h
Expand Up @@ -87,6 +87,7 @@ class MTV_PUBLIC RingBuffer : protected MThread
virtual bool IsSeekingAllowed(void) { return true; }
virtual bool IsBookmarkAllowed(void) { return true; }
virtual int BestBufferSize(void) { return 32768; }
virtual int DiscoveryBufferSize(void) { return BestBufferSize(); }
static QString BitrateToString(uint64_t rate, bool hz = false);
RingBufferType GetType() const { return type; }

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/streamingringbuffer.h
Expand Up @@ -23,6 +23,7 @@ class StreamingRingBuffer : public RingBuffer
virtual bool IsStreamed(void) { return m_streamed; }
virtual bool IsSeekingAllowed(void) { return m_allowSeeks; }
virtual bool IsBookmarkAllowed(void) { return false; }
virtual int DiscoveryBufferSize(void) { return 2048; }

protected:
virtual int safe_read(void *data, uint sz);
Expand Down

0 comments on commit 3345a03

Please sign in to comment.