Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#340 closed task (fixed)

Redo live-tv.

Reported by: Isaac Richards Owned by: Isaac Richards
Priority: blocker Milestone: 0.19
Component: mythtv Version:
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by Isaac Richards)

From the old bug db, #24:

Getting rid of the Ringbuffer way of timeshifting would be nice:

  • Ringbuffer's slow for local access (ie, uses the network)
  • Multiple semi-complicated codepaths to support the Ringbuffer and normal file access.
  • Unable to save an in-progress show from the timeshifting buffer.

The idea would be to:

  • Just use normal files for timeshifting.
  • Automatically change to a new physical file on channel change or program change (from the guide data). Would also need to segment files every few hours, in order to allow very long programs to be timeshifted and still offer the ability to limit space used for timeshifting. Could just punt on this and just require enough recording space, though.

Basically, the recorder would need to create a chain of files to play back, and share that with the frontend on a periodic basis (store in db, send a message out to reload?). The recorder would have to be able to chunk the files based on a GOP end, so playback could continue from the beginning of an arbitrary file. The player engine would need to be able to seamlessly change from playing one file to the next. I think the hardest part would be dealing with seeking over file boundaries, but even that shouldn't be too bad.

Attachments (1)

livetv-start-bt.txt (5.3 KB) - added by danielk 14 years ago.
fe SEGFAULT on LiveTV start on a DVBRecorder

Download all attachments as: .zip

Change History (41)

comment:1 Changed 14 years ago by Isaac Richards

Description: modified (diff)

comment:2 Changed 14 years ago by Isaac Richards

Description: modified (diff)

comment:3 Changed 14 years ago by Isaac Richards

Type: defecttask

comment:4 Changed 14 years ago by Isaac Richards

(In [7284]) Messing around with stuff in preparation for working on program-based live-tv.

Refs #340.

comment:5 Changed 14 years ago by Isaac Richards

Milestone: 0.19
Priority: criticalblocker

comment:6 Changed 14 years ago by Isaac Richards

(In [7664]) Refs #340. Make mpegrecorder's ringbuffer switch actually work properly.

Wasn't splitting the data to the two ringbuffers as it should have. It now creates files that are seamless when slapped together..

comment:7 Changed 14 years ago by Isaac Richards

(In [7669]) LiveTVChain helper class + db table.

Refs #340.

comment:8 Changed 14 years ago by Isaac Richards

Status: newassigned

[7697] was also part of this.

comment:9 Changed 14 years ago by Isaac Richards

(In [7739]) Refs #340.

THIS BREAKS LIVE-TV.

First part of the new live-tv 'chain' implementation.

  • The RingBuffer? no longer is a ring buffer. Need to look at the locking in the class now, it can likely be made much simpler. Troublesome to rename this now, probably should at some point.
  • Live-tv initialization is different, there is no more 'setup ringbuffer' command. Instead, 'spawn tv' takes care of that, and the client sends a live-tv chain id to the backend to start appending to. Once started, the client reads the first program out of the chain, sets up the local ringbuffer and starts playing it.
  • It automatically creates a new file / chain entry when the program guide data changes. Playback follows along, reloads the chain, and can seamlessly playback across the gap.

Broken at the moment:

  • bttv/mjpeg/plextor usb capture cards (only in live tv).
  • Channel, input changes.
  • Seeking across file boundaries. Probably, seeking in general.
  • The OSD during live-tv.
  • Getting the proper position map from the encoder.
  • probably more stuff.

comment:10 Changed 14 years ago by danielk

I just got a crash from some kind of mutex problem when exiting a pre-recorded show.

I haven't gotten around to testing LiveTV yet :)

Changed 14 years ago by danielk

Attachment: livetv-start-bt.txt added

fe SEGFAULT on LiveTV start on a DVBRecorder

comment:11 Changed 14 years ago by Isaac Richards

Check to make sure the recorder is adding stuff to the tvchain table. I was unsure of where best to place things for dvb - it could be completely off..

It _may_ make sense for the frontend to play/loop from a local file instead of the dummy recorder streaming it stuff.

comment:12 Changed 14 years ago by danielk

I'll look at it tomorrow, I also managed to crash the backend generating a preview of a blank recording. I have some family obligations + errands to run, but I should have a couple hours early and late in the day.

comment:13 Changed 14 years ago by Isaac Richards

(In [7747]) Refs #340.

Should be reading the position map from the right place now during live-tv - only from the recorder if it's the most recent program in the chain.

comment:14 Changed 14 years ago by Isaac Richards

(In [7748]) Refs #340.

Channel changing seems to work again.

comment:15 Changed 14 years ago by Isaac Richards

(In [7757]) Refs #340.

Add a 'cardtype' column to the tvchain table. This will be used to know if the player needs more reinitialization as when switching capture card types.

Don't delete the file when exiting live-tv.

comment:16 Changed 14 years ago by Isaac Richards

(In [7759]) Refs #340.

Fixes the last channel being seen briefly after a channel change.

Still need to reset framesplayed on the frontend RB switch..

comment:17 Changed 14 years ago by anonymous

In SVN 7767, with a PVR250, I cannot enter live tv at all. I saw the big commit's message said live tv is broken, but I see other messages saying channel changing is working, so it sounds like I should at least be able to enter live tv.

The Watch TV menu item flickers briefly when I try to activate it. When tailing the backend server log --verbose all, I see no entry as I attempt to enter. I've attached both front and backend logs with verbose all while I start things up, attempt to enter live tv, and then exit.

comment:18 Changed 14 years ago by cpinkham

LiveTV is disabled right now per Isaac's announcement here: http://www.gossamer-threads.com/lists/mythtv/users/159077 Ask on the lists before here if you're not sure when it's operational again, or follow Isaac's instructions in the linked post if you want to test.

comment:19 Changed 14 years ago by Isaac Richards

(In [7780]) Refs #340.

Remove the obsolete LiveBufferDir/BufferSize/MaxBufferFill? settings for livetv.

comment:20 Changed 14 years ago by Isaac Richards

(In [7823]) Refs #340.

Add the recorder type changed handler - should handle card type switches cleanly now. The 'seamless' switch now handles discontinuities properly, and resets the decoder, too. This also tries to drain the ringbuffer read buffer & video output buffers a bit before switching to the next file.

comment:21 Changed 14 years ago by Isaac Richards

(In [7826]) Refs #340.

Simplify the TV class to use the TVChain-derived ProgramInfo? for its OSD information, instead of using a query to the backend. Store the channel name + input name in the TVChain table to make this easier.

Remove obsolete queries (GET_PROGRAM_INFO and GET_INPUT_NAME), and bump the protocol version to 21.

comment:22 Changed 14 years ago by Isaac Richards

(In [7838]) Refs #340.

Seeking across file boundaries for livetv. Possibly ff/rew too, didn't test yet.

Behavior is: When seeking forward, and not playing the most recent file, seek to the beginning of the next program. When seeking backward, it'll go to 5 seconds before the end of the file.

There seem to be some issues syncing the position map for the chains. Need to look into those later.

comment:23 Changed 14 years ago by Isaac Richards

(In [7853]) Refs #340.

Fix it from wiping the DB seek table on channel change. Seeking over program boundaries seems to work really nicely now.

Consolidate the RingBuf? switch code into recorderbase. Hopefully didn't break DVB, if it was working at all..

comment:24 Changed 14 years ago by cpinkham

(In [7854]) Refs #340.

Put LiveTV recordings into a "LiveTV" Recording Group.

Move NuppelVideoPlayer::UpdateInUseMark?() functionality into

ProgramInfo::UpdateInUseMark?() so it can be used elsewhere.

Mark currently recording programs as in use.

Make mythcommflag update a recording's in-use flag while flagging in

case it is run on a long recording on a slow machine.

comment:25 Changed 14 years ago by Isaac Richards

(In [7857]) Refs #340.

Make channel/input changing more like seeking in the NVP. Can still get rid of one more backend query.

Fix a bunch of bugs with channel changing & seeking. Probably still more in there.

comment:26 Changed 14 years ago by Isaac Richards

(In [7861]) Refs #340.

ToggleRecord? now works, and is now basically just a couple db calls. It just marks the program being watched in LiveTV as a non-livetv program (normal autoexpire value, 'Default' group). So, now it saves the entire program that's been watched from the beginning instead of from when 'ToggleRecord?' was hit.

Change the recording group 'LiveTV' to be untranslated in the DB, and translated on display like 'Default'.

Add some locking for the playbackinfo pointer in TV, since it can now be changed out of thread.

comment:27 Changed 14 years ago by cpinkham

(In [7863]) Refs #340.

Exclude LiveTV recordings from Max Episodes count when running Auto-Expire.

Modify AutoExpire? to wake up every 2 minutes to expire short LiveTV programs. These recordings are leftover from channel surfing. Short means < 2 minutes.

Disallow setting AutoExpireMethod? to None (0) since LiveTV now depends on it. LiveTV "recordings" are set to Auto-Expire by default so if you don't want to let anything else Auto-Expire, then don't allow Auto-Expire on your individual scheduled recordings. You can still choose what ordering (oldest first or lowest recording priority) to use when expiring.

Fix one more place where I was translating "LiveTV" and didn't need to be.

comment:28 Changed 14 years ago by Isaac Richards

(In [7865]) Refs #340.

Move keeping track of the LiveTVChain instance on the backend to the MainServer? object. Fixes 'dirty' exits of livetv.

comment:29 Changed 14 years ago by Isaac Richards

(In [7866]) Refs #340.

Deleting a recording from a tvchain notifies players now. Still a hole where it could potentially break if something's deleted while the player's in process of changing.

Make the 'short livetv program' autoexpire only delete things that have finished recording by at least a minute.

Call FinishedRecording? on livetv programs, so the endtimes get updated properly.

Add the current PID to the 'playkey' for the inuseprograms table, so the frontend + backend don't try using the same ids & so don't delete the other's inuse flag.

comment:30 Changed 14 years ago by cpinkham

(In [7879]) Refs #340.

Get rid of the "Enable channel change buffer warnings" setting since it is no longer necessary with the new LiveTV code.

comment:31 Changed 14 years ago by Isaac Richards

(In [7893]) Refs #340.

Seeking now works after a seamless file change. nuppeldecoder/ivtvdecoder changes made blind.

comment:32 Changed 14 years ago by Isaac Richards

(In [7894]) Refs #340.

Ignore keypresses while the NVP is waiting for files to switch.

comment:33 Changed 14 years ago by Isaac Richards

(In [7901]) Refs #340.

bttv/plextor/mjpeg/etc (anything generating .nuv) should work in live-tv now. I only had a plextor convertx handy, so bttv could use some testing.

Switching cards works in live-tv. There were a few assumptions in tv_rec that a recorder would only start at the beginning of the chain.

A couple plextor convertx fixes too - mark its actual keyframes in the file for better seeking support.

comment:34 Changed 14 years ago by anonymous

I've been having a problem w/ SVN 7901 when I start live TV. Sometimes it starts fine, but about 1/2 the time it returns to the main menu and the following is output by mythfrontend. I have a PVR-250.

2005-11-17 07:13:17.478 Invalid file handle when opening /mnt/mythtv/1228_20051117071316.mpg.  6 retries remaining.
.
.
.
2005-11-17 07:13:20.514 NVP::OpenFile():  Error, file not found:  /mnt/mythtv/1228_20051117071316.mpg
2005-11-17 07:13:20.515 TV Error:  StartPlayer():  NVP is not playing after 20000 msec
2005-11-17 07:13:20.748 TV Error:  LiveTV not successfully started

comment:35 Changed 14 years ago by cpinkham

(In [7903]) Refs #340.

Change meaning of "inuseprograms" to include only Playing and Recording, and not things like commercial flagging and transcoding. Playing and Recording should block deletion but commercial flagging and transcoding should not so they are no longer considered as in use.

comment:36 Changed 14 years ago by anonymous

Prior post (11/17 12:20) only actually occurs when there is no signal coming in. I have external cable box on PVR-250's s-video input. When the cable box is off, the above behavior occurs. When there's signal, it works as normal.

comment:37 Changed 14 years ago by danielk

It appears the RingBuffer?/NVP has problems with short files.

I'm also seeing a similar problem when trying to address #664.

When you have a short (30 frames or so) file in the livetv buffer, the NVP sometimes falls into prebuffering pause. It never checks whether it should be switching buffers. I guess it is blocking the check somehow? It eventually it gives up and you return to the main menu.

This may be related to another apperent bug where the player gets stuck in a prebuffering pause at the end of scheduled recordings. It eventually it gives up and you return to the main menu. Of course it shouldn't be entering prebuffering pause at all in this case, but should just exit playback normally.

comment:38 Changed 14 years ago by Isaac Richards

(In [7923]) Refs #340.

Deal with missing program data by creating programs that end every half-hour, or the beginning of the next program with good data, whichever's first.

comment:39 Changed 14 years ago by Isaac Richards

Resolution: fixed
Status: assignedclosed

(In [7927]) Closes #340.

Re-enable Live-tv.

There _are_ still bugs, but most things should work reasonably well. One feature that I haven't tested at all is the livetv->scheduled recording switch.

comment:40 Changed 13 years ago by anonymous

About the following:

"- Just use normal files for timeshifting.

  • Automatically change to a new physical file on channel change or program change (from the guide data). Would also need to segment files every few hours, in order to allow very long programs to be timeshifted and still offer the ability to limit space used for timeshifting. Could just punt on this and just require enough recording space, though."

I own a Siemens PVR (it's the Gigaset M740 AV) which is really nice. It has the timeshifting feature well designed: It creates several files while watching TV of about 80MB. Previous versions of the Firmware created files of 300MB. Then there is a file which identifies what show is splited into which files (a crid file, by the way. Check this for more info: http://en.wikipedia.org/wiki/Crid ). In my opinion it's good to split broadcasts into small files (well, you name the size, cause you guys maybe know better how to deal with that and make it optimized) because that helps fine tuning the space used by all the timeshifting data.

Note: See TracTickets for help on using tickets.