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

Media fragment parser #23774

Merged
merged 1 commit into from Jul 23, 2019
Merged

Media fragment parser #23774

merged 1 commit into from Jul 23, 2019

Conversation

@sreeise
Copy link
Contributor

sreeise commented Jul 15, 2019

Media fragment parser for audio and video.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #22366 (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___

This change is Reviewable

@highfive
Copy link

highfive commented Jul 15, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/audiotrack.rs, components/script/dom/mod.rs, components/script/dom/htmlmediaelement.rs, components/script/dom/mediafragmentparser.rs, components/script/dom/videotrack.rs
  • @KiChjang: components/script/dom/audiotrack.rs, components/script/dom/mod.rs, components/script/dom/htmlmediaelement.rs, components/script/dom/mediafragmentparser.rs, components/script/dom/videotrack.rs
@sreeise
Copy link
Contributor Author

sreeise commented Jul 15, 2019

Hey guys. There are some odd parts about the specification that I wanted to note as it relates to the changes in the PR.

First, when a video track is added to the HTML media element the spec says:

If either the media resource or the URL of the current media resource indicate a particular set of video tracks to enable, or if the user agent has information that would facilitate the selection of specific video tracks to improve the user's experience, then: if this video track is the first such video track, then set enable to true, otherwise, set enable to false.

When it describes the track as the first such track I assumed this to mean the video track at the zeroth index in the video track list but I can see how this could also mean if this track is the first such track with that specific media fragment.

Second, I didn't include SMPTE for temporal fragments. I wasn't sure if Servo would use the frames portion of the fragment which is the only difference between SMPTE and NPT. This can be included rather easy if needed.

Last, the spec for HTML media element is not clear on using the end time. I am thinking that somehow the duration could be set to the end time and the player would need to stop at that time. Or, the start and end time could be used to request only that portion of the resource.

@sreeise
Copy link
Contributor Author

sreeise commented Jul 15, 2019

For real world clock time I followed RFC 2326 section 3.7.

@ferjm ferjm assigned ferjm and unassigned nox Jul 15, 2019
@ferjm
ferjm approved these changes Jul 18, 2019
Copy link
Member

ferjm left a comment

Beautiful work!

@@ -0,0 +1,39 @@
<!doctype html>

This comment has been minimized.

Copy link
@ferjm

ferjm Jul 18, 2019

Member

This is a nice test. I would move it to web-platform-tests/html/semantics/embedded-content/media-elements so it is pushed upstream.

This comment has been minimized.

Copy link
@ferjm

ferjm Jul 18, 2019

Member

FYI, there is also a very complete set of tests at https://www.w3.org/2008/WebVideo/Fragments/TC/ua-test-cases in case that you want to port some of them here.

This comment has been minimized.

Copy link
@sreeise

sreeise Jul 23, 2019

Author Contributor

Ahh thats good. I incorporated some of those in the test case. I can add more if you would like or another test for invalid semantics.

This comment has been minimized.

Copy link
@ferjm

ferjm Jul 23, 2019

Member

Thanks. Up to you :) More tests can be added as a follow-up.

@@ -0,0 +1,355 @@
/* This Source Code Form is subject to the terms of the Mozilla Public

This comment has been minimized.

Copy link
@ferjm

ferjm Jul 18, 2019

Member

This can probably be tweaked a little bit (removing the DOMString dependency) so it can be published as a standalone crate. File a follow-up issue for this, please.

This comment has been minimized.

Copy link
@sreeise

sreeise Jul 23, 2019

Author Contributor

Sounds good.

@ferjm
Copy link
Member

ferjm commented Jul 18, 2019

I am thinking that somehow the duration could be set to the end time and the player would need to stop at that time. Or, the start and end time could be used to request only that portion of the resource.

The former looks like a better option to me, as the latter likely depends on byte-range requests support.

@ferjm
Copy link
Member

ferjm commented Jul 18, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Jul 18, 2019

Trying commit 6fea137 with merge 4a74194...

bors-servo added a commit that referenced this pull request Jul 18, 2019
Media fragment parser

<!-- Please describe your changes on the following line: -->
Media fragment parser for audio and video.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22366 (GitHub issue number if applicable)

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23774)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 18, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
State: approved= try=True

@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Jul 23, 2019

Opened new PR for upstreamable changes.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#17987.

@ferjm
Copy link
Member

ferjm commented Jul 23, 2019

Thanks!
@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jul 23, 2019

📌 Commit dc11219 has been approved by ferjm

@bors-servo
Copy link
Contributor

bors-servo commented Jul 23, 2019

Testing commit dc11219 with merge fdbb317...

bors-servo added a commit that referenced this pull request Jul 23, 2019
Media fragment parser

<!-- Please describe your changes on the following line: -->
Media fragment parser for audio and video.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22366 (GitHub issue number if applicable)

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23774)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 23, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: ferjm
Pushing fdbb317 to master...

@bors-servo bors-servo merged commit dc11219 into servo:master Jul 23, 2019
3 checks passed
3 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
}

// Parse a full URL or a relative URL without a base retaining the query and/or fragment.
fn split_url(s: &str) -> (DOMString, DOMString) {

This comment has been minimized.

Copy link
@nox

nox Jul 25, 2019

Member

Shouldn't this and other parts of this module be using the url crate?

This comment has been minimized.

Copy link
@sreeise

sreeise Jul 25, 2019

Author Contributor

This is mostly for relative URL's which could be passed to the parser from HTMLMediaElement for the video/audio src. These may have a relative file location with a query or fragment such as: resources/video.mp4#t=10

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

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.