Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Live TV: Delay opening a new ringbuffer until the TVChain is updated.

Refs #10490.  The problem is that at a program transition, the new
ringbuffer was opened before the TVChain was advanced, so the new
ringbuffer readahead thread was immediately setting the oldfile flag
on the remote ringbuffer, leading to premature EOF.

Additional logging is added to track setting of oldfile and stopreads,
for easier future debugging.
  • Loading branch information...
commit 7c7852f4d71e54276c8dfa66a589314c5061fd0d 1 parent f4d7bff
@stichnot stichnot authored
View
26 mythtv/libs/libmythtv/mythplayer.cpp
@@ -2446,6 +2446,7 @@ void MythPlayer::SwitchToProgram(void)
return;
}
+#if 0
player_ctx->buffer->OpenFile(
pginfo->GetPlaybackURL(), RingBuffer::kLiveTVOpenTimeout);
@@ -2460,6 +2461,7 @@ void MythPlayer::SwitchToProgram(void)
delete pginfo;
return;
}
+#endif
if (GetEof())
{
@@ -2476,6 +2478,30 @@ void MythPlayer::SwitchToProgram(void)
player_ctx->tvchain->SetProgram(*pginfo);
if (decoder)
decoder->SetProgramInfo(*pginfo);
+ }
+
+ player_ctx->buffer->OpenFile(
+ pginfo->GetPlaybackURL(), RingBuffer::kLiveTVOpenTimeout);
+
+ if (!player_ctx->buffer->IsOpen())
+ {
+ LOG(VB_GENERAL, LOG_ERR, LOC + "SwitchToProgram's OpenFile failed " +
+ QString("(card type: %1).")
+ .arg(player_ctx->tvchain->GetCardType(newid)));
+ LOG(VB_GENERAL, LOG_ERR, player_ctx->tvchain->toString());
+ SetEof(true);
+ SetErrored(QObject::tr("Error opening switch program buffer"));
+ delete pginfo;
+ return;
+ }
+
+ if (discontinuity || newtype)
+ {
+#if 0
+ player_ctx->tvchain->SetProgram(*pginfo);
+ if (decoder)
+ decoder->SetProgramInfo(*pginfo);
+#endif
player_ctx->buffer->Reset(true);
if (newtype)
View
5 mythtv/libs/libmythtv/ringbuffer.cpp
@@ -553,6 +553,7 @@ void RingBuffer::KillReadAheadThread(void)
*/
void RingBuffer::StopReads(void)
{
+ LOG(VB_FILE, LOG_INFO, LOC + "StopReads()");
stopreads = true;
generalWait.wakeAll();
}
@@ -563,6 +564,7 @@ void RingBuffer::StopReads(void)
*/
void RingBuffer::StartReads(void)
{
+ LOG(VB_FILE, LOG_INFO, LOC + "StartReads()");
stopreads = false;
generalWait.wakeAll();
}
@@ -573,6 +575,7 @@ void RingBuffer::StartReads(void)
*/
void RingBuffer::Pause(void)
{
+ LOG(VB_FILE, LOG_INFO, LOC + "Pause()");
StopReads();
rwlock.lockForWrite();
@@ -586,6 +589,7 @@ void RingBuffer::Pause(void)
*/
void RingBuffer::Unpause(void)
{
+ LOG(VB_FILE, LOG_INFO, LOC + "Unpause()");
StartReads();
rwlock.lockForWrite();
@@ -1557,6 +1561,7 @@ void RingBuffer::SetWriteBufferMinWriteSize(int newMinSize)
*/
void RingBuffer::SetOldFile(bool is_old)
{
+ LOG(VB_FILE, LOG_INFO, LOC + QString("SetOldFile(%1)").arg(is_old));
rwlock.lockForWrite();
oldfile = is_old;
rwlock.unlock();
View
3  mythtv/libs/libmythtv/tv_rec.cpp
@@ -1080,7 +1080,10 @@ void TVRec::TeardownRecorder(uint request_flags)
}
if (ringBuffer)
+ {
+ LOG(VB_FILE, LOG_INFO, LOC + "calling StopReads()");
ringBuffer->StopReads();
+ }
if (curRecording)
{
View
4 mythtv/programs/mythbackend/filetransfer.cpp
@@ -7,6 +7,7 @@
#include "mythmiscutil.h"
#include "mythsocket.h"
#include "programinfo.h"
+#include "mythlogging.h"
FileTransfer::FileTransfer(QString &filename, MythSocket *remote,
bool usereadahead, int timeout_ms) :
@@ -94,6 +95,7 @@ void FileTransfer::Stop(void)
if (readthreadlive)
{
readthreadlive = false;
+ LOG(VB_FILE, LOG_INFO, "calling StopReads()");
rbuffer->StopReads();
QMutexLocker locker(&lock);
readsLocked = true;
@@ -108,6 +110,7 @@ void FileTransfer::Stop(void)
void FileTransfer::Pause(void)
{
+ LOG(VB_FILE, LOG_INFO, "calling StopReads()");
rbuffer->StopReads();
QMutexLocker locker(&lock);
readsLocked = true;
@@ -118,6 +121,7 @@ void FileTransfer::Pause(void)
void FileTransfer::Unpause(void)
{
+ LOG(VB_FILE, LOG_INFO, "calling StartReads()");
rbuffer->StartReads();
{
QMutexLocker locker(&lock);
Please sign in to comment.
Something went wrong with that request. Please try again.