зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1582294 - Set up HTMLMediaElement to convey video track alpha channel when playing a MediaStream. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D92898
This commit is contained in:
Родитель
420e2b99a6
Коммит
d5227f851c
|
@ -2660,6 +2660,9 @@ void HTMLMediaElement::NotifyMediaTrackEnabled(dom::MediaTrack* aTrack) {
|
|||
if (mSecondaryMediaStreamRenderer) {
|
||||
mSecondaryMediaStreamRenderer->AddTrack(mSelectedVideoStreamTrack);
|
||||
}
|
||||
if (mMediaInfo.HasVideo()) {
|
||||
mMediaInfo.mVideo.SetAlpha(mSelectedVideoStreamTrack->HasAlpha());
|
||||
}
|
||||
nsContentUtils::CombineResourcePrincipals(
|
||||
&mSrcStreamVideoPrincipal, mSelectedVideoStreamTrack->GetPrincipal());
|
||||
}
|
||||
|
@ -5825,6 +5828,9 @@ void HTMLMediaElement::UpdateReadyStateInternal() {
|
|||
}
|
||||
if (hasVideoTracks) {
|
||||
mediaInfo.EnableVideo();
|
||||
if (mSelectedVideoStreamTrack) {
|
||||
mediaInfo.mVideo.SetAlpha(mSelectedVideoStreamTrack->HasAlpha());
|
||||
}
|
||||
}
|
||||
MetadataLoaded(&mediaInfo, nullptr);
|
||||
}
|
||||
|
|
|
@ -141,6 +141,12 @@ class MediaStreamTrackSource : public nsISupports {
|
|||
*/
|
||||
void GetLabel(nsAString& aLabel) { aLabel.Assign(mLabel); }
|
||||
|
||||
/**
|
||||
* Whether this TrackSource provides video frames with an alpha channel. Only
|
||||
* applies to video sources. Used by HTMLVideoElement.
|
||||
*/
|
||||
virtual bool HasAlpha() const { return false; }
|
||||
|
||||
/**
|
||||
* Forwards a photo request to backends that support it. Other backends return
|
||||
* NS_ERROR_NOT_IMPLEMENTED to indicate that a MediaTrackGraph-based fallback
|
||||
|
|
|
@ -35,6 +35,11 @@ class VideoStreamTrack : public MediaStreamTrack {
|
|||
void RemoveVideoOutput(VideoFrameContainer* aSink);
|
||||
void RemoveVideoOutput(VideoOutput* aOutput);
|
||||
|
||||
/**
|
||||
* Whether this VideoStreamTrack's video frames will have an alpha channel.
|
||||
*/
|
||||
bool HasAlpha() const { return GetSource().HasAlpha(); }
|
||||
|
||||
// WebIDL
|
||||
void GetKind(nsAString& aKind) override { aKind.AssignLiteral("video"); }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче