Skip to content

Commit

Permalink
Merge pull request #114 from bitmovin-engineering/fix/PW-20529/ssai-m…
Browse files Browse the repository at this point in the history
…odule-crashes

[PW-20529] Fix ssai module crashes
  • Loading branch information
Andr3wid authored Oct 10, 2024
2 parents c32668e + 2767f7f commit 7b5f6a9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Develop

## v2.9.0

### Fixed
- collector crashes for certain SSAI workflows
https://bitmovin.atlassian.net/browse/PW-20529

## v2.8.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions collectorCore/ssaiService.brs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sub resetSsaiHelpers()
m.currentAdMetadata = {}
m.isFirstSampleOfAd = false
m.adCustomData = {}
m.lastAdStartTimer = m.AD_TIMER_INIT_VALUE
m.lastAdStartTimer = invalid
m.hasErrorBeenReportedForCurrentAd = false

resetAdValues = {
Expand All @@ -40,7 +40,7 @@ function getSsaiAdSample()

adSample.adType = m.AD_TYPE.SSAI

if m.lastAdStartTimer = m.AD_TIMER_INIT_VALUE
if m.lastAdStartTimer = invalid
adSample.timeSinceAdStartedInMs = m.AD_TIMER_INIT_VALUE
else
adSample.timeSinceAdStartedInMs = m.lastAdStartTimer.TotalMilliseconds()
Expand Down
39 changes: 39 additions & 0 deletions testing/source/tests/SsaiService.spec.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace tests

@SGNode("collectorCore")
@suite("SsaiService")
class SsaiServiceTests extends rooibos.BaseTestSuite
protected override function beforeEach()
'bs:disable-next-line
initializeAnalytics()
'bs:disable-next-line
setupSsaiService()
end function

@describe("getSsaiAdSample")
@it("should set the elapsed time to -1 if no timer is active")
function _()
expectedTime = -1

'bs:disable-next-line
sample = getSsaiAdSample()

m.assertEqual(sample.timeSinceAdStartedInMs, expectedTime)
end function

@it("should set the elapsed time since adStart if an ad is in progress")
function _()
'bs:disable-next-line
adBreakStart()
'bs:disable-next-line
adStart()

'bs:disable-next-line
sample = getSsaiAdSample()

m.assertTrue(sample.timeSinceAdStartedInMs >= 0)
end function

end class

end namespace

0 comments on commit 7b5f6a9

Please sign in to comment.