Repository navigation
media: Plumb a release closure through MSE append path - #12846
Conversation
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
|
There was a problem hiding this comment.
Code Review
This pull request introduces a zero-copy media source parser feature (kCobaltZeroCopyMediaSourceParser) for Cobalt, allowing stream parsers to parse appended data in place by borrowing the data span and managing its lifetime with a base::ScopedClosureRunner. The feedback highlights critical compilation issues where base::ScopedClosureRunner is incorrectly used in boolean contexts (as it lacks operator bool() and operator!), and suggests using .is_null() instead. Additionally, a defensive null check is recommended in RetainAppendedArrayBuffer to prevent potential null pointer dereferences.
9def73a to
2e289f1
Compare
2e289f1 to
e5a5930
Compare
e5a5930 to
4437ab8
Compare
4437ab8 to
1a47f8d
Compare
1a47f8d to
0b61567
Compare
0b61567 to
b6d7802
Compare
b6d7802 to
0806986
Compare
Thread a base::ScopedClosureRunner alongside the data from SourceBuffer down to StreamParser, so that a parser can borrow the span instead of copying it. The caller guarantees the span stays valid until the runner is destroyed. The parser destroys it once it no longer needs the bytes, which may happen on any thread. Every layer from SourceBuffer down to SourceBufferState carries the runner unconditionally, so each has a single AppendToParseBuffer() whose signature differs between builds, rather than a second overload beside the existing one. StreamParser is the exception: there the new overload is non-pure and copies by default, which leaves the five existing parsers and MockStreamParser untouched. Gate this on kCobaltInPlaceMediaSourceParser, disabled by default, as retaining the ArrayBuffer deviates from the specification. No behavior change yet with the feature off SourceBuffer passes a null runner, and with it on the parsers still take StreamParser's copying default. Bug: 558350763 TAG=agy CONV=f7ab1644-7417-41cb-a782-c47dc051b09f
0806986 to
04ac47b
Compare
yell0wd0g
left a comment
There was a problem hiding this comment.
Some comments on the ergonomics and some question
but in general makes sense? //third_party LGTM.
…h MSE append path Refer to original PR: #12846 Thread a base::ScopedClosureRunner alongside the data from SourceBuffer down to StreamParser, so that a parser can borrow the span instead of copying it. The caller guarantees the span stays valid until the runner is destroyed. The parser destroys it once it no longer needs the bytes, which may happen on any thread. Every layer from SourceBuffer down to SourceBufferState carries the runner unconditionally, so each has a single AppendToParseBuffer() whose signature differs between builds, rather than a second overload beside the existing one. StreamParser is the exception: there the new overload is non-pure and copies by default, which leaves the five existing parsers and MockStreamParser untouched. Gate this on kCobaltZeroCopyMediaSourceParser, disabled by default, as retaining the ArrayBuffer deviates from the specification. No behavior change yet with the feature off SourceBuffer passes a null runner, and with it on the parsers still take StreamParser's copying default. Bug: 558350763 TAG=agy CONV=f7ab1644-7417-41cb-a782-c47dc051b09f (cherry picked from commit 7299a39)
…ugh MSE append path (#13035) Automated cherry-pick roll to staging. Original pull requests: - #12846 CONFLICTED files: ``` third_party/blink/renderer/modules/mediasource/source_buffer.cc ``` To merge these changes, run the autoroll script: ```bash GITHUB_REPOSITORY=youtube/cobalt python3 cobalt/devinfra/github/autoroll/merge_autoroll.py \ --source-branch main \ --target-branch staging ```⚠️ This PR has conflicts that must be resolved manually (don't forget to update the `.github/AUTOROLL` file). Use the following commands to checkout the branch locally and resolve the conflicts in a separate commit: ```bash gh pr checkout <pull_request_number> -R youtube/cobalt # Resolve conflicts and update .github/AUTOROLL then git add <resolved_files> # Copy CONFLICTED commit's message and metadata # Replace CONFLICTED in title with RESOLVED git commit -c <conflicted_sha> git push origin autoroll-main-to-staging ``` --------- Co-authored-by: Jason <jasonzh@google.com>
…end path Refer to original PR: #12846 Thread a base::ScopedClosureRunner alongside the data from SourceBuffer down to StreamParser, so that a parser can borrow the span instead of copying it. The caller guarantees the span stays valid until the runner is destroyed. The parser destroys it once it no longer needs the bytes, which may happen on any thread. Every layer from SourceBuffer down to SourceBufferState carries the runner unconditionally, so each has a single AppendToParseBuffer() whose signature differs between builds, rather than a second overload beside the existing one. StreamParser is the exception: there the new overload is non-pure and copies by default, which leaves the five existing parsers and MockStreamParser untouched. Gate this on kCobaltZeroCopyMediaSourceParser, disabled by default, as retaining the ArrayBuffer deviates from the specification. No behavior change yet with the feature off SourceBuffer passes a null runner, and with it on the parsers still take StreamParser's copying default. Bug: 558350763 TAG=agy CONV=f7ab1644-7417-41cb-a782-c47dc051b09f (cherry picked from commit 7299a39)
Thread a base::ScopedClosureRunner alongside the data from SourceBuffer down to StreamParser, so that a parser can borrow the span instead of copying it. The caller guarantees the span stays valid until the runner is destroyed. The parser destroys it once it no longer needs the bytes, which may happen on any thread.
Every layer from SourceBuffer down to SourceBufferState carries the runner unconditionally, so each has a single AppendToParseBuffer() whose signature differs between builds, rather than a second overload beside the existing one. StreamParser is the exception: there the new overload is non-pure and copies by default, which leaves the five existing parsers and MockStreamParser untouched.
Gate this on kCobaltZeroCopyMediaSourceParser, disabled by default, as retaining the ArrayBuffer deviates from the specification.
No behavior change yet with the feature off SourceBuffer passes a null runner, and with it on the parsers still take StreamParser's copying default.
Bug: 558350763
TAG=agy
CONV=f7ab1644-7417-41cb-a782-c47dc051b09f