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

Suspend media after navigation #24223

Merged
merged 2 commits into from Sep 19, 2019
Merged

Conversation

@ferjm
Copy link
Member

ferjm commented Sep 16, 2019

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #21989 and fix #22763
  • I am not sure how to test this

This depends on servo/media#310


This change is Reviewable

@highfive
Copy link

highfive commented Sep 16, 2019

Heads up! This PR modifies the following files:

@highfive
Copy link

highfive commented Sep 16, 2019

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@ferjm
Copy link
Member Author

ferjm commented Sep 16, 2019

r? @jdm

@highfive highfive assigned jdm and unassigned SimonSapin Sep 16, 2019
@jdm
Copy link
Member

jdm commented Sep 16, 2019

Have you checked if this works with going forwards and backwards in session history as well?

@ferjm
Copy link
Member Author

ferjm commented Sep 17, 2019

Unfortunately, it only works with navigations :\ I'm trying to fix session history browsing as well.

@ferjm ferjm force-pushed the ferjm:suspend.media.playback branch from c070dc8 to ad798bd Sep 18, 2019
@ferjm
Copy link
Member Author

ferjm commented Sep 18, 2019

r? @jdm

It now works with session history browsing as well. It suspends/resume the media action based on the document activity, so browsing to a different context while playing some audio or video pauses playback and it resumes it where you left it if you browse back to that context.

@jdm
jdm approved these changes Sep 18, 2019
@jdm
Copy link
Member

jdm commented Sep 18, 2019

This looks nice and clean!

@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

The latest upstream changes (presumably #24236) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

gterzian left a comment

Have you considered that this might suffer from a similar issue as noted at #24211, in the sense that, in multiprocess mode, the operations performed in the constellation might not affect the media instance used in script since ServoMedia::get() returns an in-process instance.

The proposed changes could make the current workflow more robust to an eventual refactoring required to make media fully support multiprocess.

let child_activity = if activity == DocumentActivity::Inactive {
media.suspend(&client_context_id);

This comment has been minimized.

@gterzian

gterzian Sep 19, 2019

Member

The problem with doing those operations in the constellation is that the media instance will differ from the one in script, if Servo is running in multiprocess mode.

Have you considered doing the suspend and resume operations in script when the document activity changes?

You could move those operations to

pub fn set_activity(&self, activity: DocumentActivity) {

This comment has been minimized.

@ferjm

ferjm Sep 19, 2019

Author Member

Good point! I'm applying your suggestion. Thanks

@ferjm ferjm force-pushed the ferjm:suspend.media.playback branch from ad798bd to d7daaf5 Sep 19, 2019
Cargo.toml Outdated
servo-media-gstreamer = { git = "https://github.com/ferjm/media", branch = "suspend" }
servo-media-audio = { git = "https://github.com/ferjm/media", branch = "suspend" }
servo-media-player = { git = "https://github.com/ferjm/media", branch = "suspend" }
servo-media-streams = { git = "https://github.com/ferjm/media", branch = "suspend" }

This comment has been minimized.

@ceyusa

ceyusa Sep 19, 2019

Collaborator

this is temporal, right?

suspend branch is behind current media master

This comment has been minimized.

@ferjm

ferjm Sep 19, 2019

Author Member

Yes. I will remove the patch as soon as servo/media#310 is merged

@ferjm ferjm force-pushed the ferjm:suspend.media.playback branch from d7daaf5 to d5c52c7 Sep 19, 2019
@ferjm ferjm force-pushed the ferjm:suspend.media.playback branch from d5c52c7 to d7bebce Sep 19, 2019
@ferjm
Copy link
Member Author

ferjm commented Sep 19, 2019

@bors-servo r=jdm,gterzian

@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

📌 Commit d7bebce has been approved by jdm,gterzian

@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

Testing commit d7bebce with merge 9c74d14...

bors-servo added a commit that referenced this pull request Sep 19, 2019
Suspend media after navigation

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #21989 and fix #22763
- [ ] I am not sure how to test this

This depends on servo/media#310

<!-- 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/24223)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Sep 19, 2019

@bors-servo retry

  • network issue?
@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

💣 Failed to start rebuilding: Unknown error

@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

Testing commit d7bebce with merge 9047ae9...

bors-servo added a commit that referenced this pull request Sep 19, 2019
Suspend media after navigation

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #21989 and fix #22763
- [ ] I am not sure how to test this

This depends on servo/media#310

<!-- 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/24223)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: jdm,gterzian
Pushing 9047ae9 to master...

@bors-servo bors-servo merged commit d7bebce into servo:master Sep 19, 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
@ferjm ferjm deleted the ferjm:suspend.media.playback branch Sep 20, 2019
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.

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