Skip to content

Commit 39d5cb3

Browse files
Ev0-BHHuevos
authored andcommitted
Try fix for Cutlist editor to restore missing .ap and .sc files.
Two separate bugs were introduced in 5.6.003 with the SoftCSA changes: Bug 1 — lib/dvb/pvrparse.cpp processPacket() was changed to return -2 for a "broken startcode" (was return 0 in 5.6.002). The new parseData() propagates this via early exit, and asyncWrite() treats -2 as stream corruption and calls return len before the actual disk write — meaning recording data is silently discarded. This affects channels where a PUSI packet's PES payload doesn't begin with 0x000001 (CI-decrypted channels, MPEG-1 audio, subtitle streams, etc.). Fix: revert broken startcode to return 0. A missing PES start code means "skip PTS extraction for this packet" — it is not stream corruption. Bug 2 — lib/dvb/filepush.cpp (the intermittent ~1/3 cause) eFilePushThreadRecorder::m_protocol was never initialized in the constructor. 5.6.003 added a !getProtocol() guard before calling m_ts_parser.parseData() in asyncWrite(). When the recorder object is allocated from previously-used heap memory, m_protocol contains garbage from a prior session. !getProtocol() then returns false, parseData() is never called, no PTS timestamps are collected, and stopSave() finds no access points and skips writing .ap entirely. This explains the intermittent pattern: the first recording after a reboot uses fresh zero-initialized memory (works), later recordings reuse freed heap (fails ~1/3 of the time depending on what the allocator returns). Fix: add m_protocol(0), m_session_id(0), m_stream_id(0), m_packet_no(0) to the constructor initializer list in filepush.cpp. Thx @the bandit
1 parent a171015 commit 39d5cb3

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/dvb/filepush.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,11 @@ eFilePushThreadRecorder::eFilePushThreadRecorder(unsigned char* buffer, size_t b
345345
m_stop(1),
346346
m_buffer_fill(0),
347347
m_buffer_min_write(0),
348-
m_messagepump(eApp, 0, "eFilePushThreadRecorder")
348+
m_messagepump(eApp, 0, "eFilePushThreadRecorder"),
349+
m_protocol(0),
350+
m_session_id(0),
351+
m_stream_id(0),
352+
m_packet_no(0)
349353
{
350354
CONNECT(m_messagepump.recv_msg, eFilePushThreadRecorder::recvEvent);
351355

lib/dvb/pvrparse.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,14 @@ int eMPEGStreamParserTS::processPacket(const unsigned char *pkt, off_t offset)
922922
//}
923923
//eDebugNoNewLine("\n");
924924

925-
return -2;
925+
/* Return 0 (not -2): a missing/invalid PES start code means we
926+
* cannot extract a PTS from this packet, but the stream is not
927+
* corrupt — CI-decrypted streams, MPEG-1 audio, and similar
928+
* sources regularly produce PUSI packets without a 0x000001
929+
* start code. Returning -2 caused parseData() to abort early
930+
* and asyncWrite() to skip writing data to disk, resulting in
931+
* empty recordings and missing .ap/.sc files. */
932+
return 0;
926933
}
927934

928935
if (pkt[7] & 0x80) // PTS present?

0 commit comments

Comments
 (0)