mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-28 11:28:38 +00:00
Backed out 4 changesets (bug 879717) for OSX/Android/B2G mochitest failures.
Backed out changeset 353aee813484 (bug 879717) Backed out changeset cd7d8b93923f (bug 879717) Backed out changeset 78b01186ff85 (bug 879717) Backed out changeset 29f4a39efc29 (bug 879717) CLOSED TREE
This commit is contained in:
parent
a866bfe533
commit
83ec10e366
@ -1013,9 +1013,6 @@ protected:
|
||||
nsMediaNetworkState mNetworkState;
|
||||
nsMediaReadyState mReadyState;
|
||||
|
||||
// Last value passed from codec or stream source to UpdateReadyStateForData.
|
||||
NextFrameStatus mLastNextFrameStatus;
|
||||
|
||||
enum LoadAlgorithmState {
|
||||
// No load algorithm instance is waiting for a source to be added to the
|
||||
// media in order to continue loading.
|
||||
|
@ -71,8 +71,6 @@
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "MediaMetadataManager.h"
|
||||
#include "MediaSourceDecoder.h"
|
||||
#include "AudioStreamTrack.h"
|
||||
#include "VideoStreamTrack.h"
|
||||
|
||||
#include "AudioChannelService.h"
|
||||
|
||||
@ -666,10 +664,7 @@ void HTMLMediaElement::AbortExistingLoads()
|
||||
mHaveQueuedSelectResource = false;
|
||||
mSuspendedForPreloadNone = false;
|
||||
mDownloadSuspendedByCache = false;
|
||||
mHasAudio = false;
|
||||
mHasVideo = false;
|
||||
mSourcePointer = nullptr;
|
||||
mLastNextFrameStatus = NEXT_FRAME_UNINITIALIZED;
|
||||
|
||||
mTags = nullptr;
|
||||
|
||||
@ -1992,7 +1987,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
|
||||
mCurrentLoadID(0),
|
||||
mNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY),
|
||||
mReadyState(nsIDOMHTMLMediaElement::HAVE_NOTHING),
|
||||
mLastNextFrameStatus(NEXT_FRAME_UNINITIALIZED),
|
||||
mLoadWaitStatus(NOT_WAITING),
|
||||
mVolume(1.0),
|
||||
mPreloadAction(PRELOAD_UNDEFINED),
|
||||
@ -2834,21 +2828,6 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
|
||||
if (mPausedForInactiveDocumentOrChannel) {
|
||||
GetSrcMediaStream()->ChangeExplicitBlockerCount(1);
|
||||
}
|
||||
|
||||
nsAutoTArray<nsRefPtr<AudioStreamTrack>,1> audioTracks;
|
||||
aStream->GetAudioTracks(audioTracks);
|
||||
nsAutoTArray<nsRefPtr<VideoStreamTrack>,1> videoTracks;
|
||||
aStream->GetVideoTracks(videoTracks);
|
||||
|
||||
// Clear aTags, but set mHasAudio and mHasVideo
|
||||
MediaInfo mediaInfo;
|
||||
mediaInfo.mAudio.mHasAudio = !audioTracks.IsEmpty();
|
||||
mediaInfo.mVideo.mHasVideo = !videoTracks.IsEmpty();
|
||||
MetadataLoaded(&mediaInfo, nullptr);
|
||||
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("suspend"));
|
||||
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
|
||||
|
||||
ChangeDelayLoadStatus(false);
|
||||
GetSrcMediaStream()->AddAudioOutput(this);
|
||||
GetSrcMediaStream()->SetAudioOutputVolume(this, float(mMuted ? 0.0 : mVolume));
|
||||
@ -2861,6 +2840,10 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
|
||||
// mSrcStream
|
||||
mSrcStream->ConstructMediaTracks(AudioTracks(), VideoTracks());
|
||||
|
||||
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("durationchange"));
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("loadedmetadata"));
|
||||
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_IDLE);
|
||||
AddRemoveSelfReference();
|
||||
// FirstFrameLoaded() will be called when the stream has current data.
|
||||
}
|
||||
@ -2933,11 +2916,6 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
|
||||
mVideoFrameContainer->ForgetElement();
|
||||
mVideoFrameContainer = nullptr;
|
||||
}
|
||||
|
||||
if (IsVideo()) {
|
||||
// Update the screen wakelock in case mHasVideo changed
|
||||
NotifyOwnerDocumentActivityChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLMediaElement::FirstFrameLoaded()
|
||||
@ -2945,7 +2923,6 @@ void HTMLMediaElement::FirstFrameLoaded()
|
||||
NS_ASSERTION(!mSuspendedAfterFirstFrame, "Should not have already suspended");
|
||||
|
||||
ChangeDelayLoadStatus(false);
|
||||
UpdateReadyStateForData(NEXT_FRAME_UNAVAILABLE);
|
||||
|
||||
if (mDecoder && mAllowSuspendAfterFirstFrame && mPaused &&
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) &&
|
||||
@ -3108,8 +3085,6 @@ bool HTMLMediaElement::ShouldCheckAllowOrigin()
|
||||
|
||||
void HTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatus aNextFrame)
|
||||
{
|
||||
mLastNextFrameStatus = aNextFrame;
|
||||
|
||||
if (mReadyState < nsIDOMHTMLMediaElement::HAVE_METADATA) {
|
||||
// aNextFrame might have a next frame because the decoder can advance
|
||||
// on its own thread before MetadataLoaded gets a chance to run.
|
||||
@ -3136,14 +3111,6 @@ void HTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatu
|
||||
return;
|
||||
}
|
||||
|
||||
if (mReadyState < nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA && mHasVideo) {
|
||||
VideoFrameContainer* container = GetVideoFrameContainer();
|
||||
if (container && mMediaSize == nsIntSize(-1,-1)) {
|
||||
// No frame has been set yet. Don't advance.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (aNextFrame != MediaDecoderOwner::NEXT_FRAME_AVAILABLE) {
|
||||
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
|
||||
if (!mWaitingFired && aNextFrame == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING) {
|
||||
@ -3284,14 +3251,14 @@ void HTMLMediaElement::ChangeNetworkState(nsMediaNetworkState aState)
|
||||
|
||||
bool HTMLMediaElement::CanActivateAutoplay()
|
||||
{
|
||||
// For stream inputs, we activate autoplay on HAVE_METADATA because
|
||||
// For stream inputs, we activate autoplay on HAVE_CURRENT_DATA because
|
||||
// this element itself might be blocking the stream from making progress by
|
||||
// being paused.
|
||||
return !mPausedForInactiveDocumentOrChannel &&
|
||||
mAutoplaying &&
|
||||
mPaused &&
|
||||
((mDecoder && mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) ||
|
||||
(mSrcStream && mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA)) &&
|
||||
(mSrcStream && mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA)) &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) &&
|
||||
mAutoplayEnabled &&
|
||||
!IsEditable();
|
||||
@ -3320,14 +3287,24 @@ void HTMLMediaElement::CheckAutoplayDataReady()
|
||||
|
||||
VideoFrameContainer* HTMLMediaElement::GetVideoFrameContainer()
|
||||
{
|
||||
if (mVideoFrameContainer)
|
||||
return mVideoFrameContainer;
|
||||
// If we have loaded the metadata, and the size of the video is still
|
||||
// (-1, -1), the media has no video. Don't go a create a video frame
|
||||
// container.
|
||||
if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA &&
|
||||
mMediaSize == nsIntSize(-1, -1)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Only video frames need an image container.
|
||||
if (!IsVideo()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mHasVideo = true;
|
||||
|
||||
if (mVideoFrameContainer)
|
||||
return mVideoFrameContainer;
|
||||
|
||||
mVideoFrameContainer =
|
||||
new VideoFrameContainer(this, LayerManager::CreateAsynchronousImageContainer());
|
||||
|
||||
@ -3435,7 +3412,6 @@ void HTMLMediaElement::NotifyDecoderPrincipalChanged()
|
||||
void HTMLMediaElement::UpdateMediaSize(nsIntSize size)
|
||||
{
|
||||
mMediaSize = size;
|
||||
UpdateReadyStateForData(mLastNextFrameStatus);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendEvents)
|
||||
|
@ -319,7 +319,6 @@ skip-if = buildapp == 'mulet' || os == 'win' # bug 894922
|
||||
[test_bug686942.html]
|
||||
[test_bug726904.html]
|
||||
[test_bug874897.html]
|
||||
[test_bug879717.html]
|
||||
[test_bug883173.html]
|
||||
[test_bug895091.html]
|
||||
[test_bug895305.html]
|
||||
|
@ -1,65 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for bug 879717, check that a video element can be drawn into a canvas directly on 'play' event</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<video id="v1" autoplay />
|
||||
<video id="v2" autoplay />
|
||||
<canvas id="c1" />
|
||||
<canvas id="c2" />
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var media = getPlayableVideo(gSmallTests);
|
||||
|
||||
var checkDrawImage = function(video, canvas, name) {
|
||||
var exception = null;
|
||||
var exceptionName = "nothing";
|
||||
try {
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
exceptionName = e.name;
|
||||
}
|
||||
ok(exception === null || video.ended,
|
||||
"drawImage shouldn't throw an exception on play of " + name + ", got " + exceptionName);
|
||||
};
|
||||
|
||||
if (media == null) {
|
||||
todo(false, "No media supported.");
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
v1.src = media.name;
|
||||
v2.mozSrcObject = v1.mozCaptureStream();
|
||||
|
||||
var v1Tested = false;
|
||||
var v2Tested = false;
|
||||
|
||||
v1.addEventListener('play', function() {
|
||||
checkDrawImage(v1, c1, media.name);
|
||||
|
||||
v1Tested = true;
|
||||
if (v2Tested) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
|
||||
v2.addEventListener('play', function() {
|
||||
checkDrawImage(v2, c2, "stream of " + media.name);
|
||||
|
||||
v2Tested = true;
|
||||
if (v1Tested) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user