Skip to content

[GST] Dynamic insertion of decryptor element #1490

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

Open
wants to merge 1 commit into
base: wpe-2.46
Choose a base branch
from

Conversation

asurdej-comcast
Copy link

@asurdej-comcast asurdej-comcast commented Apr 11, 2025

We have a use-case in one of our web apps where MSE encrypted playback is mixed with a clear one in single SourceBuffer. This is because of add-insertion where clear add is appended to the same SourceBuffer during encrypted video playback. As a result there is CAPS change in GST pipeline between encrypted and clear ones.

There are two main cases:

  1. Main content (encrypted) starts first and add starts later in time. In such case initial encrypted CAPS make parsebin to set up a pipeline with a decryptor element (thunder decrypt in our case). Switching to clear CAPS is not a big deal as the decryptor will enter passthrough mode and the playback will continue. Going back to encrypted makes CAPS switch again and the decryptor operates in regular mode.
  2. Add playback (clear) starts first and the pipeline is prepared for clear playback only. Switching to encrypted in such case causes buffer push failure from source (webkit media src) with "not-negotiated" error. CAPS doesn't match. No decrypter is in the pipeline and parsebin/decodebin/playbin don't auto adjust to new CAPS.

We have a change to handle that, created when playback pipeline was using appsource element instead of webkit media src (2.22 or earlier) where the decrypter is inserted dynamically into the playback pipeline based on caps from source element.
It's not the perfect solution but good enough to start discussion on how we can handle that, and if that's the valid use-case at all.
There are two parts there:

  1. Insert a decryptor when encrypted caps are detected
  2. Always insert svppay payloader element to force secure video path on Amlogic device. Without that the pipeline will be set in regular memory so on encrypted caps we will have to replace more elements, for sure a parser element

Please let me know what you think on that?
202bd4e

Build-Tests Layout-Tests
✅ 🛠 wpe-246-amd64-build ❌ 🧪 wpe-246-amd64-layout
✅ 🛠 wpe-246-arm32-build ❌ 🧪 wpe-246-arm32-layout

Create and insert a GST decryptor element on the fly
once encrypted CAPS arrives
@asurdej-comcast asurdej-comcast requested a review from philn as a code owner April 11, 2025 12:07
@asurdej-comcast
Copy link
Author

@philn
Copy link

philn commented Apr 11, 2025

I had the same use-case in another project, I solved it by adding a new decryptor, a bin that would contain the real decryptor and a decodebin... That bin had a higher rank, so was auto-plugged. In there I had a pad probe, a bit similar to what you did, to know if I should plug decodebin or not (iirc).

I don't think modifying the MSE code is a good solution.

@asurdej-comcast
Copy link
Author

Could you please share more details on that? Considering playbin3, I think the only element that is autoplugging a pipeline is a parsebin and it should be possible to provide a high ranked bin element that will accept all caps - we need to always have it, even for clear caps. And do the dynamic decryptor insertion there. I'm not entirely sure if parsebin will autoplug such element really, will need to double check

Whatever the final solution will be, the other question is, if this is something to be included in downstream repo or we should go with custom impl?

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

Successfully merging this pull request may close these issues.

3 participants