Skip to content

Commit

Permalink
fix #399: only skip one field after something's been decoded already
Browse files Browse the repository at this point in the history
  • Loading branch information
happycube committed Feb 6, 2022
1 parent 69ac008 commit b80d8c8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lddecode/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,7 @@ def __init__(
keepraw=True,
prevfield=None,
initphase=False,
fields_written=0,
readloc=0,
):
self.rawdata = decode["input"]
Expand All @@ -1447,6 +1448,7 @@ def __init__(
self.readloc = readloc

self.prevfield = prevfield
self.fields_written = fields_written

# XXX: need a better way to prevent memory leaks than this
# For now don't let a previous frame keep it's prev frame
Expand Down Expand Up @@ -2156,8 +2158,13 @@ def compute_linelocs(self):

self.rawpulses = self.getpulses()
if self.rawpulses is None or len(self.rawpulses) == 0:
logger.error("Unable to find any sync pulses, jumping one second")
return None, None, int(self.rf.freq_hz)
if self.fields_written:
logger.error("Unable to find any sync pulses, skipping one field")
return None, None, None
else:
logger.error("Unable to find any sync pulses, skipping one second")
return None, None, int(self.rf.freq_hz)


self.validpulses = validpulses = self.refinepulses()

Expand Down Expand Up @@ -3529,6 +3536,7 @@ def decodefield(self, initphase=False):
audio_offset=self.audio_offset,
prevfield=self.curfield,
initphase=initphase,
fields_written=self.fields_written,
readloc=self.rawdecode["startloc"],
)

Expand Down

0 comments on commit b80d8c8

Please sign in to comment.