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

Feature: detect duplicate resource ids in virtual track #350

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

danielhdz13-netflix
Copy link
Contributor

Spec says:
"The Id element shall identify this specific Resource instance. The means of identifying the underlying Asset is
left to subclasses. No two Resouces shall have the same ID value unless they are identical."

This is not currently being enforced. This PR adds a check for this condition.

return false;
}
IMFTrackFileResourceType otherImfTrackFileResourceType = (IMFTrackFileResourceType) o;
return equivalent(otherImfTrackFileResourceType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good idea to keep fields used in the implementation of equals and hashCode identical to each other. In this case, if the equivalent method implementation goes through some changes then equals and hashcode will not match.

@@ -236,6 +226,25 @@ private static Map<UUID, List<IMFBaseResourceType>> getVirtualTrackResourceMap(@
if (virtualTrackResourceMap.get(uuid) == null) {
virtualTrackResourceMap.put(uuid, new ArrayList<IMFBaseResourceType>());
}
/*
Ensure that no two resources use the same ID, unless they are the same resource. ST-2067-3:2020, 6.11.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on this statement the equals and hashcode methods for the resource should include all the elements defined in the resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the PR so that the equals and hashcode methods include all elements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would interpret 6.11.1 as meaning that Resource IDs are unique throughout the entire composition:
"No two Resouces shall have the same ID value unless they are identical."

It looks like this check is limited to detecting duplicates only within the same Sequence.
As a practical matter, that is generally good enough. But I believe there are other possible scenarios that this check would still miss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants