Fix remaining bugs and issues with PiP

This commit is contained in:
wuggy 2026-09-13 13:02:36 -07:00
commit 27af37ea7b
3 changed files with 24 additions and 5 deletions

View file

@ -2404,6 +2404,12 @@ void HTMLMediaElement::SetVolumeInternal()
float effectiveVolume = ComputedVolume();
if (mDecoder) {
// PiP applies content mute at its playback element, after the capture
// queue. Keep those samples available for immediate unmute, while still
// honoring audio-channel, playback-rate and disabled-track muting.
if (mPictureInPicture && !(mMuted & ~MUTED_BY_CONTENT)) {
effectiveVolume = float(mVolume * mAudioChannelVolume);
}
mDecoder->SetVolume(effectiveVolume);
} else if (MediaStream* stream = GetSrcMediaStream()) {
if (mSrcStreamIsPlaying) {
@ -5188,6 +5194,7 @@ void HTMLMediaElement::SetMozPictureInPicture(bool aEnabled)
MOZ_ASSERT(NS_IsMainThread());
mPictureInPicture = aEnabled;
if (mDecoder && !mShuttingDown) {
SetVolumeInternal();
mDecoder->NotifyOwnerActivityChanged(!IsHidden());
}
}