Ticket #1356: dtvrecorder_patch.3

File dtvrecorder_patch.3, 2.6 KB (added by mark.goodman+mythtv@…, 18 years ago)

Minimal patch to fix firewire recording glitches

Line 
1--- /home/mythtv/work2/mythtv-0.19/libs/libmythtv/dtvrecorder.h 2005-12-14 07:54:48.000000000 -0800
2+++ libs/libmythtv/dtvrecorder.h        2006-02-23 21:22:20.000000000 -0800
3@@ -59,7 +59,6 @@
4     // used for scanning pes headers for keyframes
5     uint      _header_pos;
6     int       _first_keyframe;
7-    unsigned long long _last_gop_seen;
8     unsigned long long _last_seq_seen;
9     unsigned long long _last_keyframe_seen;
10 
11--- /home/mythtv/work2/mythtv-0.19/libs/libmythtv/dtvrecorder.cpp       2006-02-07 13:56:06.000000000 -0800
12+++ libs/libmythtv/dtvrecorder.cpp      2006-02-24 00:08:51.000000000 -0800
13@@ -16,7 +16,7 @@
14 #define LOC QString("DTVRec(%1): ").arg(tvrec->GetCaptureCardNum())
15 #define LOC_ERR QString("DTVRec(%1) Error: ").arg(tvrec->GetCaptureCardNum())
16 
17-const uint DTVRecorder::kMaxKeyFrameDistance = 32;
18+const uint DTVRecorder::kMaxKeyFrameDistance = 48;
19 
20 /** \class DTVRecorder
21  *  \brief This is a specialization of RecorderBase used to
22@@ -37,7 +37,7 @@
23     _stream_fd(-1),
24     // used for scanning pes headers for keyframes
25     _header_pos(0),                 _first_keyframe(-1),
26-    _last_gop_seen(0),              _last_seq_seen(0),
27+    _last_seq_seen(0),
28     _last_keyframe_seen(0),
29     // settings
30     _request_recording(false),
31@@ -127,7 +127,6 @@
32     _header_pos                 = 0;
33     _first_keyframe             =-1;
34     _last_keyframe_seen         = 0;
35-    _last_gop_seen              = 0;
36     _last_seq_seen              = 0;
37     //_recording
38     _error                      = false;
39@@ -236,13 +235,12 @@
40                 hasFrame = true;
41             else if (PESStreamID::GOPStartCode == stream_id)
42             {
43-                _last_gop_seen  = _frames_seen_count;
44-                hasKeyFrame    |= true;
45+                hasKeyFrame    = true;
46             }
47             else if (PESStreamID::SequenceStartCode == stream_id)
48             {
49                 _last_seq_seen  = _frames_seen_count;
50-                hasKeyFrame    |=(_last_gop_seen + maxKFD)<_frames_seen_count;
51+                hasKeyFrame    = true;
52             }
53         }
54     }
55@@ -250,11 +248,10 @@
56     if (hasFrame && !hasKeyFrame)
57     {
58         // If we have seen kMaxKeyFrameDistance frames since the
59-        // last GOP or SEQ stream_id, then pretend this picture
60+        // SEQ stream_id, then pretend this picture
61         // is a keyframe. We may get artifacts but at least
62         // we will be able to skip frames.
63         hasKeyFrame = !(_frames_seen_count & 0xf);
64-        hasKeyFrame &= (_last_gop_seen + maxKFD) < _frames_seen_count;
65         hasKeyFrame &= (_last_seq_seen + maxKFD) < _frames_seen_count;
66     }
67