Comcast / gots

MPEG Transport Stream handling in Go
Other
308 stars 88 forks source link

Do not return ErrSCTE35MissingOut when implicitly closing the only open signal. #113

Closed nehashanbhag closed 5 years ago

nehashanbhag commented 5 years ago

In VDE, we were seeing an issue where :

36

/DBLAAEs/S0UAP/wBQb+AAAAAAA1AjNDVUVJT///9X//AACky4AJH1NJR05BTDoyWURWeCtSKzlWc0FBQUFBQUFBQkFRPT02AAD9DXQ/

37-1 /DBGAAEtT5LUAP/wBQb+AAAAAAAwAi5DVUVJT///9X+/CR9TSUdOQUw6MllEVngrUis5VnNBQUFBQUFBQUJBZz09NwEDU/ktPg==

35

/DAvAAD5dbEbAP/wBQb+M+6KUwAZAhdDVUVJQAAAPn+fCAgAAAAALecjUzUAALuiqds=

37-2

/DBGAAEteMW0AP/wBQb+AAAAAAAwAi5DVUVJT///9X+/CR9TSUdOQUw6MllEVngrUis5VnNBQUFBQUFBQUJBdz09NwID1nPQRg==

37-3

/DBGAAEtofiUAP/wBQb+AAAAAAAwAi5DVUVJT///9X+/CR9TSUdOQUw6MllEVngrUis5VnNBQUFBQUFBQUJCQT09NwMDJVJ1Mg==

0x35 should have closed 0x36, but it doesn't and the period which was created when 0x36 came in, stays forever.

nehashanbhag commented 5 years ago

I tested this using the VDE pcap containing 0x36,0x37,0x35,0x37,0x37 signals and before the fix --the period created by 0x36 was not being removed from the mpd. After the fix the period created by 0x36 was removed and wasn't present in the manifest. I have added a unit test to test this exact same scenario in gots as well.

mikereedell commented 5 years ago

Additional documentation for the added unit test:

Before the fix: 0x36 - one open signal 0x37 - nothing closed, one open signal 0x35 - 0x36 closed (and returned), no open signals, ERROR ErrNoMatchingOut 0x37 - nothing closed, no open signals, ERROR ErrNoMatchingOut 0x37- nothing closed, no open signals, ERROR ErrNoMatchingOut

After the fix: 0x36 - one open signal 0x37 - nothing closed, one open signal 0x35 - 0x36 closed (and returned), no open signals, no errors 0x37 - nothing closed, no open signals, ERROR ErrNoMatchingOut 0x37 - nothing closed, no open signals, ERROR ErrNoMatchingOut

The only difference between the two is the fixed code won't return the "ErrMissingOut" when the 0x36 is closed.