Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include event ID in findSimilarRegion_() check #2077

Closed
sath33sh opened this issue Aug 2, 2019 · 2 comments · Fixed by #2175
Closed

Include event ID in findSimilarRegion_() check #2077

sath33sh opened this issue Aug 2, 2019 · 2 comments · Fixed by #2175
Labels
flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@sath33sh
Copy link
Contributor

sath33sh commented Aug 2, 2019

Have you read the FAQ and checked for duplicate open issues?
Yes

What version of Shaka Player are you using?
v2.5.4

Can you reproduce the issue with our latest release version?
Yes

Can you reproduce the issue with the latest code from master?
Yes

Are you using the demo app or your own custom app?
Custom app

If custom app, can you reproduce the issue using our demo app?
I did not try the demo app

What browser and OS are you using?
Chrome/MacOS

For embedded devices (smart TVs, etc.), what model and firmware version are you using?
N/A

What are the manifest and license server URIs?

Sample manifest which demonstrates the issue:

<Period id="1-340995-128166" start="PT480.04266666666666S">
<EventStream schemeIdUri="urn:mpeg:dash:event:callback:2014" value="1" timescale="90000">
<Event presentationTime="0" duration="0" id="0" messageData="-scrubbed-"></Event>
<Event presentationTime="0" duration="0" id="1" messageData="-scrubbed-"></Event>
<Event presentationTime="0" duration="1354353" id="2" messageData="-scrubbed-"></Event>
<Event presentationTime="0" duration="338588" id="3" messageData="-scrubbed-"></Event>
</EventStream>
...

What did you do?

Play a DASH stream with elements as mentioned above.

What did you expect to happen?
All events are observed via timelineregionadded event listener.

What actually happened?

Events with same presentationTime and duration but different id are currently de-duped by findSimilarRegion_(). This does not work for our use case where we are using to signal Ad beacons. There can be multiple beacons at the same presentationTime offset. The only way to differentiate them is using id.

Following patch fixes the problem. I can submit a pull request if it is acceptable.

diff --git a/lib/media/region_timeline.js b/lib/media/region_timeline.js
index 4ce44f39..35320c59 100644
--- a/lib/media/region_timeline.js
+++ b/lib/media/region_timeline.js
@@ -69,8 +69,8 @@ shaka.media.RegionTimeline = class {
   }
 
   /**
-   * Find a region in the timeline that has the same scheme id uri, start time,
-   * and end time. If these three parameters match, we assume it to be the same
+   * Find a region in the timeline that has the same scheme id uri, id, start time,
+   * and end time. If these four parameters match, we assume it to be the same
    * region. If no similar region can be found, |null| will be returned.
    *
    * @param {shaka.extern.TimelineRegionInfo} region
@@ -79,9 +79,10 @@ shaka.media.RegionTimeline = class {
    */
   findSimilarRegion_(region) {
     for (const existing of this.regions_) {
-      // The same scheme ID and time range means that it is similar-enough to
+      // The same schemeIdUri, id and time range means that it is similar-enough to
       // be the same region.
       const isSimilar = existing.schemeIdUri == region.schemeIdUri &&
+                        existing.id == region.id &&
                         existing.startTime == region.startTime &&
                         existing.endTime == region.endTime;
@TheModMaker TheModMaker added type: bug Something isn't working correctly flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this and removed needs triage labels Aug 5, 2019
@TheModMaker TheModMaker added this to the v2.6 milestone Aug 5, 2019
@TheModMaker
Copy link
Contributor

We'd be happy to accept a PR for this. Please also add a test to verify we don't regress. Thanks.

@sath33sh
Copy link
Contributor Author

sath33sh commented Aug 5, 2019

@TheModMaker I'll submit a pull request shortly

sath33sh added a commit to PhiloInc/shaka-player that referenced this issue Oct 5, 2019
presentationTime and duration but different ID are treated as separate events.

Closes shaka-project#2077
joeyparrish pushed a commit that referenced this issue Oct 9, 2019
Include event ID in findSimilarRegion_() check so that events with same
presentationTime and duration but different ID are treated as separate events.

Closes #2077
TheModMaker pushed a commit that referenced this issue Nov 6, 2019
Include event ID in findSimilarRegion_() check so that events with same
presentationTime and duration but different ID are treated as separate events.

Closes #2077

Change-Id: I1bcef08b2ba12d92d98e304581ef12cfce94a466
@shaka-project shaka-project locked and limited conversation to collaborators Dec 8, 2019
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flag: seeking PR We are actively seeking PRs for this; we do not currently expect the core team will resolve this status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants