Skip to content
Browse files

Refs #10490. Live TV program transition improvements.

Reverts earlier changes to FileRingBuffer related to oldfile, and
deals with the issue at a higher level.  First, in
TVRec::SwitchLiveTVRingBuffer(), update the LiveTVChain *after* the
next program starts recording so that the RingBuffer readahead thread
doesn't set oldfile on the current recording until after the new
recording starts.  Second, make sure oldfile isn't accidentally set
twice in the readahead thread.
  • Loading branch information...
1 parent b2dcd7b commit 0349883596549a8c76632fdfdf61920514ee65ae @stichnot stichnot committed Apr 19, 2012
View
6 mythtv/libs/libmythtv/fileringbuffer.cpp
@@ -453,8 +453,8 @@ int FileRingBuffer::safe_read(int fd, void *data, uint sz)
tot += ret;
}
- //if (oldfile)
- //break;
+ if (oldfile)
+ break;
if (ret == 0) // EOF returns 0
{
@@ -465,7 +465,7 @@ int FileRingBuffer::safe_read(int fd, void *data, uint sz)
// 0.36 second timeout for livetvchain with usleep(60000),
// or 2.4 seconds if it's a new file less than 30 minutes old.
- if (zerocnt >= (oldfile ? 4 : (livetvchain ? 6 : 40)))
+ if (zerocnt >= (livetvchain ? 6 : 40))
{
break;
}
View
8 mythtv/libs/libmythtv/ringbuffer.cpp
@@ -724,7 +724,7 @@ void RingBuffer::run(void)
struct timeval lastread, now;
int readtimeavg = 300;
bool ignore_for_read_timing = true;
- bool did_set_oldfile = false;
+ QString did_set_oldfile("");
gettimeofday(&lastread, NULL); // this is just to keep gcc happy
@@ -843,11 +843,12 @@ void RingBuffer::run(void)
"Reading enough data to start playback");
}
- if (!did_set_oldfile && remotefile && livetvchain &&
+ if (did_set_oldfile != filename && remotefile && livetvchain &&
livetvchain->HasNext())
{
+ LOG(VB_FILE, LOG_DEBUG, LOC + QString("did_set_oldfile=%1").arg(did_set_oldfile));
remotefile->SetTimeout(true);
- did_set_oldfile = true;
+ did_set_oldfile = filename;
}
LOG(VB_FILE, LOG_DEBUG, LOC +
@@ -922,7 +923,6 @@ void RingBuffer::run(void)
{
livetvchain->SwitchToNext(true);
setswitchtonext = true;
- did_set_oldfile = false;
}
}
else
View
11 mythtv/libs/libmythtv/tv_rec.cpp
@@ -4442,15 +4442,19 @@ bool TVRec::SwitchLiveTVRingBuffer(const QString & channum,
pginfo->MarkAsInUse(true, kRecorderInUseID);
pginfo->SaveAutoExpire(kLiveTVAutoExpire);
pginfo->ApplyRecordRecGroupChange("LiveTV");
+#if 0
tvchain->AppendNewProgram(pginfo, channel->GetCurrentName(),
channel->GetCurrentInput(), discont);
+#endif
+ bool delete_pg = false;
if (set_rec && recorder)
{
recorder->SetNextRecording(pginfo, rb);
if (discont)
recorder->CheckForRingBufferSwitch();
- delete pginfo;
+ //delete pginfo;
+ delete_pg = true;
SetFlags(kFlagRingBufferReady);
}
else if (!set_rec)
@@ -4467,6 +4471,11 @@ bool TVRec::SwitchLiveTVRingBuffer(const QString & channum,
SetRingBuffer(rb);
}
+ tvchain->AppendNewProgram(pginfo, channel->GetCurrentName(),
+ channel->GetCurrentInput(), discont);
+ if (delete_pg)
+ delete pginfo;
+
return true;
}

0 comments on commit 0349883

Please sign in to comment.
Something went wrong with that request. Please try again.