Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10765 closed Patch - Bug Fix (fixed)

HD-PVR: Rework SignalMonitor to avoid reading from device

Reported by: jpoet Owned by: jpoet
Priority: minor Milestone: 0.25.1
Component: MythTV - General Version: 0.25
Severity: medium Keywords: HDPVR LiveTV
Cc: Ticket locked: no

Description

The HD-PVR does not like to be opened/closed/opened repeatedly. The attach patch reworks the signal monitor to stabilize purely based on the detected resolution information provided by the driver.

This seems to greatly improve the LiveTV experience with this device.

Attachments (4)

HD-PVR-signalmonitor.patch (8.2 KB) - added by jpoet 12 years ago.
New HD-PVR signal monitor
HD-PVR-signalmonitor-v2.patch (8.8 KB) - added by jpoet 12 years ago.
Fix a possible bus error
HD-PVR-signalmonitor-v2a.patch (8.9 KB) - added by jpoet 12 years ago.
Move m_stable_time init to the ctor.
analogsignalmonitor.patch (1.9 KB) - added by djo <david.osguthorpe@…> 12 years ago.

Download all attachments as: .zip

Change History (13)

Changed 12 years ago by jpoet

Attachment: HD-PVR-signalmonitor.patch added

New HD-PVR signal monitor

comment:1 Changed 12 years ago by jpoet

Owner: set to jpoet
Status: newaccepted

comment:2 Changed 12 years ago by jpoet

Milestone: unknown0.25.1

Changed 12 years ago by jpoet

Fix a possible bus error

Changed 12 years ago by jpoet

Move m_stable_time init to the ctor.

comment:3 Changed 12 years ago by jpoet

Patch version 2a has no functional change. It just moves where a variable is initialized, and documents that var better.

comment:4 Changed 12 years ago by John Patrick Poet <jpoet@…>

Resolution: fixed
Status: acceptedclosed

In d0c33e38efedf2acca665a63b7710e67eb8f4eed/mythtv:

HD-PVR LiveTV: Rework HD-PVR SignalMonitor? to avoid encoding start/stops.

The HD-PVR does not behave well when told to switch encoding on/off
quickly. Only use the video resolution reported by the driver to determine
if the HD-PVR has stabilized: If the driver reports the same resolution
consistently for two seconds, then assume a good lock.

Fixes #10765
0.25/fixes commit: [d3a5b0a59]

comment:5 Changed 12 years ago by Raymond Wagner

Version: Unspecified0.25

Changed 12 years ago by djo <david.osguthorpe@…>

Attachment: analogsignalmonitor.patch added

comment:6 in reply to:  4 Changed 12 years ago by djo <david.osguthorpe@…>

This is a great patch - the double start encode for HDPVR has bugged me as well.
I just updated to 0.25 fixes from Ubuntu PPA.
Unfortunately there is an issue with the audio encoding for me - I do not think the audtype should be decremented by 1.
For me this leads to AAC encodings not AC3 - USB HDPVR 1212 audio encodings are 3 to 4 - and V4L2_MPEG_AUDIO_ENCODING_AC3 is 4 in the linux headers.
Ive attached a git diff analogsignalmonitor.cpp patch which seems to be working for me - at least restored prior audio behaviour after updating - now have single encode start and AC3 audio

comment:7 Changed 12 years ago by Steven Adeff <adeffs.mythtv@…>

this patch has almost completely broken HDPVR recordings for me.

right now "upcoming recordings" shows three recordings from yesterday that are on our first hdpvr (of two), none of which look to actually have been recorded as they do not show up in the "recorded" table and no file is created.

before this, recordings worked fine.

comment:8 Changed 12 years ago by Steven Adeff <adeffs.mythtv@…>

here's the log from one such "recording" that never actually takes place:

Jun  4 19:59:59 MythCenter mythbackend[17394]: I Scheduler tv_rec.cpp:407 (StartRecording) TVRec(5): StartRecording("The Killing":Bulldog)
Jun  4 19:59:59 MythCenter mythbackend[17394]: N Scheduler autoexpire.cpp:263 (CalcParams) AutoExpire: CalcParams(): Max required Free Space: 4.0 GB w/freq: 15 min
Jun  4 19:59:59 MythCenter mythbackend[17394]: I Scheduler scheduler.cpp:2459 (HandleRecordingStatusChange) Started recording: "The Killing":Bulldog: channel 1479 on cardid 5, sourceid 1
Jun  4 19:59:59 MythCenter mythbackend[17394]: I ProcessRequest tv_rec.cpp:2763 (StopLiveTV) TVRec(5): StopLiveTV(void) curRec: 0xffffffffa1f129f8 pseudoRec: 0xffffffffa2257948
Jun  4 19:59:59 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:1014 (HandleStateChange) TVRec(5): Changing from WatchingLiveTV to None
Jun  4 19:59:59 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4158 (ClearFlags) TVRec(5): ClearFlags(FrontendReady,CancelNextRecording,) -> RunMainLoop,RecorderRunning,RingBufferReady,
Jun  4 19:59:59 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:3370 (HandleTuning) TVRec(5): HandleTuning Request: Program(NULL) channel() input() flags(KillRec,KillRingBuffer,)
Jun  4 19:59:59 MythCenter mythbackend[17394]: I TVRecEvent mpegrecorder.cpp:1332 (StopEncoding) MPEGRec(/dev/hdpvr1): StopEncoding
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent mpegrecorder.cpp:1348 (StopEncoding) MPEGRec(/dev/hdpvr1): Encoding stopped
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent DeviceReadBuffer.cpp:171 (Stop) DevRdB(/dev/hdpvr1): Stop() -- begin
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent DeviceReadBuffer.cpp:180 (Stop) DevRdB(/dev/hdpvr1): Stop() -- end
Jun  4 20:00:01 MythCenter mythbackend[17394]: E RecThread mpegrecorder.cpp:1017 (run) MPEGRec(/dev/hdpvr1): Device EOF detected
Jun  4 20:00:01 MythCenter mythbackend[17394]: I RecThread mpegrecorder.cpp:1113 (run) MPEGRec(/dev/hdpvr1): run finishing up
Jun  4 20:00:01 MythCenter mythbackend[17394]: I RecThread mpegrecorder.cpp:1332 (StopEncoding) MPEGRec(/dev/hdpvr1): StopEncoding
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4158 (ClearFlags) TVRec(5): ClearFlags(RecorderRunning,) -> RunMainLoop,RingBufferReady,
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent mpegrecorder.cpp:1332 (StopEncoding) MPEGRec(/dev/hdpvr1): StopEncoding
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent recorderbase.cpp:89 (SetRecording) RecBase(5:/dev/hdpvr1): SetRecording(0x0)
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:812 (FinishedRecording) TVRec(5): FinishedRecording(1446_2012-06-04T19:34:46) damaged recq:<RecordingQuality overall_score="0" key="1446_2012-06-04T19:34:46" countinuity_error_count="0" packet_count="8358164">#012    <Gap start="2012-06-04T19:00:00" end="2012-06-04T19:34:47" duration="2087" />#012</RecordingQuality>
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:862 (FinishedRecording) TVRec(5): FinishedRecording(1446_2012-06-04T19:34:46)#012#011#011#011title: The Last Word With Lawrence O'Donnell#012#011#011#011in recgroup: LiveTV status: Recorder Failed:Recorder Failed not_dummy finished_now
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent livetvchain.cpp:130 (FinishedRecording) Chain: Updated endtime for '1446_20120604193446' to 20120604200001
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent programinfo.cpp:3806 (SaveVideoProperties) SaveVideoProperties(0x38, 0x20)
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4158 (ClearFlags) TVRec(5): ClearFlags(RecorderRunning,) -> RunMainLoop,RingBufferReady,
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:3548 (TuningShutdowns) TVRec(5): Tearing down RingBuffer
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4158 (ClearFlags) TVRec(5): ClearFlags(PENDINGACTIONS,) -> RunMainLoop,RingBufferReady,
Jun  4 20:00:01 MythCenter mythbackend[17394]: I ProcessRequest mainserver.cpp:1360 (HandleAnnounce) MainServer::ANN Playback
Jun  4 20:00:01 MythCenter mythbackend[17394]: I ProcessRequest mainserver.cpp:1362 (HandleAnnounce) adding: blackie as a client (events: 0)
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:1014 (HandleStateChange) TVRec(6): Changing from None to WatchingLiveTV
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4158 (ClearFlags) TVRec(6): ClearFlags(FrontendReady,CancelNextRecording,) -> RunMainLoop,
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:3370 (HandleTuning) TVRec(6): HandleTuning Request: Program(NULL) channel() input() flags(LiveTV,)
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:3459 (TuningCheckForHWChange) TVRec(6): HW Tuner: 6->6
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4158 (ClearFlags) TVRec(6): ClearFlags(PENDINGACTIONS,) -> RunMainLoop,
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:3392 (HandleTuning) TVRec(6): No recorder yet, calling TuningFrequency
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent v4lchannel.cpp:661 (SetInputAndFormat) V4LChannel(/dev/hdpvr2): SetInputAndFormat(2, NTSC) (v4l v2) input_switch: 0 mode_switch: 0
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4363 (CreateLiveTVRingBuffer) TVRec(6): CreateLiveTVRingBuffer(479)
Jun  4 20:00:01 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:4269 (GetProgramRingBufferForLiveTV) TVRec(6): GetProgramRingBufferForLiveTV()
Jun  4 20:00:01 MythCenter mythbackend[17394]: N CoreContext autoexpire.cpp:263 (CalcParams) AutoExpire: CalcParams(): Max required Free Space: 4.0 GB w/freq: 15 min
Jun  4 20:00:02 MythCenter mythbackend[17394]: I TVRecEvent tv_rec.cpp:782 (StartedRecording) TVRec(6): StartedRecording(1479_2012-06-04T20:00:01) fn(/media/mythtv/3/tv/1479_20120604200001.mpg)
Jun  4 20:00:02 MythCenter mythbackend[17394]: I TVRecEvent livetvchain.cpp:106 (AppendNewProgram) Chain: Appended@6 '1479_20120604200001'


comment:9 Changed 12 years ago by Steven Adeff <adeffs.mythtv@…>

I just experienced this on my HDPVR-less system, a recording on my Ceton tuner shows as started, but there is no file, nothing in the recordings table, and the recording never "stopped" ie it is still shown in the upcoming recordings list.

this may be another issue altogether it just happened to start happening after this patch went in to place.

Note: See TracTickets for help on using tickets.