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

fix: Destroy correctly unused transmuxer #7059

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

avelad
Copy link
Member

@avelad avelad commented Jul 18, 2024

No description provided.

@avelad avelad requested a review from theodab July 18, 2024 09:20
@avelad avelad added type: bug Something isn't working correctly type: performance A performance issue priority: P2 Smaller impact or easy workaround labels Jul 18, 2024
@avelad avelad added this to the v4.11 milestone Jul 18, 2024
@avelad avelad force-pushed the destroy-unused-transmuxer branch from 914bff7 to e7aac37 Compare July 18, 2024 09:37
@shaka-bot
Copy link
Collaborator

shaka-bot commented Jul 18, 2024

Incremental code coverage: 62.50%

@avelad avelad force-pushed the destroy-unused-transmuxer branch from e7aac37 to d7a12a5 Compare July 18, 2024 10:20
this.transmuxers_[contentType] = transmuxer;
} else if (transmuxer) {
// Compare if the transmuxer is different
if (this.transmuxers_[contentType] &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Whenever codecSwitchIfNecessary_ detects that a transmuxer is needed, it creates a new instance of the desired transmuxer. It never recycles the old transmuxer. So doesn't that mean that this is always going to delete the old transmuxer?

I was going to say that we should be comparing the respective shaka.extern.TransmuxerPlugin to see if the two transmuxers are of the same type, instead of seeing if they are the same object. However, looking at the transmuxers we have now, none of them look to be stateless. Most of them have internal variables like frameIndex_ which maybe we do want to reset by remaking the transmuxer.

If that is the case, and we never want to keep the old transmuxer, this whole segment could be greatly simplified.

if (this.transmuxers_[contentType]) {
  this.transmuxers_[contentType].destroy();
  delete this.transmuxers_[contentType];
}
if (transmuxer) {
  this.transmuxers_[contentType] = transmuxer;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

yes we want to keep the transmuxer, because then we don't have to generate the initialization segment again

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, also I see now that this isn't comparing the transmuxers themselves, it's comparing their transmux methods. I guess that works as a way to ensure they came from the same plugin.

@avelad avelad requested a review from theodab July 18, 2024 11:12
this.transmuxers_[contentType] = transmuxer;
} else if (transmuxer) {
// Compare if the transmuxer is different
if (this.transmuxers_[contentType] &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, also I see now that this isn't comparing the transmuxers themselves, it's comparing their transmux methods. I guess that works as a way to ensure they came from the same plugin.

@avelad avelad merged commit f161a1c into shaka-project:main Jul 18, 2024
6 of 16 checks passed
@avelad avelad deleted the destroy-unused-transmuxer branch July 18, 2024 11:52
avelad added a commit that referenced this pull request Jul 18, 2024
avelad added a commit that referenced this pull request Jul 18, 2024
avelad pushed a commit that referenced this pull request Jul 18, 2024
🤖 I have created a release *beep* *boop*
---


##
[4.10.7](v4.10.6...v4.10.7)
(2024-07-18)


### Bug Fixes

* Allow reference mimeType change in StreamingEngine
([#7061](#7061))
([2fe4dcc](2fe4dcc))
* **DASH:** Prioritize highest bandwidth in PeriodCombiner
([#7045](#7045))
([30cdd61](30cdd61))
* Destroy correctly unused transmuxer
([#7059](#7059))
([7641475](7641475))
* Fix MSE polyfill for iOS
([#7049](#7049))
([44dc9a9](44dc9a9))
* **HLS:** Remove init segment on formats without init segment
([#7060](#7060))
([ee179ad](ee179ad))
* **Transmuxer:** Fix init segment between discontinuities
([#7042](#7042))
([dd2a6d7](dd2a6d7))
* **ttml:** Handle escaped special characters.
([#7047](#7047))
([451a41e](451a41e)),
closes
[#7044](#7044)
* **UI:** Fix resolution label when the stream has not resolution
([#7043](#7043))
([9e468f4](9e468f4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Sep 16, 2024
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Sep 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P2 Smaller impact or easy workaround status: archived Archived and locked; will not be updated type: bug Something isn't working correctly type: performance A performance issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants