Skip to content

Feature: detect duplicate resource ids in virtual track#350

Open
danielhdz13-netflix wants to merge 9 commits intomasterfrom
feature/detect-duplicate-resource-ids-in-virtual-track
Open

Feature: detect duplicate resource ids in virtual track#350
danielhdz13-netflix wants to merge 9 commits intomasterfrom
feature/detect-duplicate-resource-ids-in-virtual-track

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.

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