Mailing List Archive

Re: [mythtv-commits] [MythTV/mythtv] 035a52: No discontinuity for first TS packet of PID
On Sat, 29 Aug 2020 at 23:05, kmdewaal <noreply@github.com> wrote:

> Branch: refs/heads/master
> Home: https://github.com/MythTV/mythtv
> Commit: 035a528bd813d5ca86999618875bba72162d8429
>
> https://github.com/MythTV/mythtv/commit/035a528bd813d5ca86999618875bba72162d8429
> Author: David Engel <david@istwok.net>
> Date: 2020-08-29 (Sat, 29 Aug 2020)
>
> Changed paths:
> M mythtv/libs/libmythtv/recorders/dtvrecorder.cpp
> M mythtv/libs/libmythtv/recorders/dtvrecorder.h
>
> Log Message:
> -----------
> No discontinuity for first TS packet of PID
>
> Improved version of commit cf8015eaf4a2fde6ece423e7ade99c86f7f9d076
> The previous version did remove all false positives but it
> suppressed 1/16th of the first real discontinuities.
>
>
> I do feel a bit silly. It looks like the only thing that needs to be done
to fix the code is to initialize all elements of m_continuityCounter to
0xff. The function CheckCC in dtvrecorder.h does already test for value
0xff. In mythv version 30 a memset is used to set all elements of
continuity_counter (as it was called then) to 0xff.
Somewhere along the way the initialization must have been lost. To be
continued.

Klaas.
Re: [mythtv-commits] [MythTV/mythtv] 035a52: No discontinuity for first TS packet of PID [ In reply to ]
On Sat, Aug 29, 2020 at 11:27:01PM +0200, Klaas de Waal wrote:
> I do feel a bit silly. It looks like the only thing that needs to be done
> to fix the code is to initialize all elements of m_continuityCounter to
> 0xff. The function CheckCC in dtvrecorder.h does already test for value
> 0xff. In mythv version 30 a memset is used to set all elements of
> continuity_counter (as it was called then) to 0xff.
> Somewhere along the way the initialization must have been lost. To be
> continued.

That happens all to often with subtle code and developer churn. I
have a saying I came up with several years ago after many times trying
to reconstruct the logic behind code that had seen many iterations.
It goes like this:

Every line of code had a reason for being at one time. It might not
have been a good reason then, now or ever, but there was a reason. If
you don't know what that reason was, be very careful removing or
modifying that code.

David
--
David Engel
david@istwok.net
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org