зеркало из https://github.com/mozilla/gecko-dev.git
bug 804875: backout due to regressions of various uses of .src/mozSrcObject (bugs 836011/835705) rs=kinetik
This commit is contained in:
Родитель
183ebb351b
Коммит
6c1ea9f313
|
@ -120,7 +120,6 @@ public:
|
|||
virtual void MetadataLoaded(int aChannels,
|
||||
int aRate,
|
||||
bool aHasAudio,
|
||||
bool aHasVideo,
|
||||
const MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
// Called by the video decoder object, on the main thread,
|
||||
|
@ -476,12 +475,6 @@ protected:
|
|||
*/
|
||||
void QueueSelectResourceTask();
|
||||
|
||||
/**
|
||||
* When loading a new source on an existing media element, make sure to reset
|
||||
* everything that is accessible using the media element API.
|
||||
*/
|
||||
void ResetState();
|
||||
|
||||
/**
|
||||
* The resource-fetch algorithm step of the load algorithm.
|
||||
*/
|
||||
|
|
|
@ -123,7 +123,7 @@ nsHTMLAudioElement::MozSetup(uint32_t aChannels, uint32_t aRate)
|
|||
return rv;
|
||||
}
|
||||
|
||||
MetadataLoaded(aChannels, aRate, true, false, nullptr);
|
||||
MetadataLoaded(aChannels, aRate, true, nullptr);
|
||||
mAudioStream->SetVolume(mVolume);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -733,20 +733,10 @@ NS_IMETHODIMP nsHTMLMediaElement::Load()
|
|||
AbortExistingLoads();
|
||||
SetPlaybackRate(mDefaultPlaybackRate);
|
||||
QueueSelectResourceTask();
|
||||
ResetState();
|
||||
mIsRunningLoadMethod = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLMediaElement::ResetState()
|
||||
{
|
||||
mMediaSize = nsIntSize(-1, -1);
|
||||
VideoFrameContainer* container = GetVideoFrameContainer();
|
||||
if (container) {
|
||||
container->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
static bool HasSourceChildren(nsIContent *aElement)
|
||||
{
|
||||
for (nsIContent* child = aElement->GetFirstChild();
|
||||
|
@ -2607,7 +2597,6 @@ void nsHTMLMediaElement::ProcessMediaFragmentURI()
|
|||
void nsHTMLMediaElement::MetadataLoaded(int aChannels,
|
||||
int aRate,
|
||||
bool aHasAudio,
|
||||
bool aHasVideo,
|
||||
const MetadataTags* aTags)
|
||||
{
|
||||
mChannels = aChannels;
|
||||
|
@ -2621,13 +2610,6 @@ void nsHTMLMediaElement::MetadataLoaded(int aChannels,
|
|||
ProcessMediaFragmentURI();
|
||||
mDecoder->SetFragmentEndTime(mFragmentEnd);
|
||||
}
|
||||
|
||||
// If this element had a video track, but consists only of an audio track now,
|
||||
// delete the VideoFrameContainer. This happens when the src is changed to an
|
||||
// audio only file.
|
||||
if (!aHasVideo) {
|
||||
mVideoFrameContainer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded)
|
||||
|
@ -2971,14 +2953,6 @@ void nsHTMLMediaElement::NotifyAutoplayDataReady()
|
|||
|
||||
VideoFrameContainer* nsHTMLMediaElement::GetVideoFrameContainer()
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (mVideoFrameContainer)
|
||||
return mVideoFrameContainer;
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ public:
|
|||
// Return true if the transport layer supports seeking.
|
||||
virtual bool IsMediaSeekable() = 0;
|
||||
|
||||
virtual void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) = 0;
|
||||
virtual void QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) = 0;
|
||||
virtual void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags) = 0;
|
||||
virtual void QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags) = 0;
|
||||
|
||||
// Set the media end time in microseconds
|
||||
virtual void SetMediaEndTime(int64_t aTime) = 0;
|
||||
|
@ -119,25 +119,23 @@ class AudioMetadataEventRunner : public nsRunnable
|
|||
private:
|
||||
nsRefPtr<AbstractMediaDecoder> mDecoder;
|
||||
public:
|
||||
AudioMetadataEventRunner(AbstractMediaDecoder* aDecoder, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags)
|
||||
AudioMetadataEventRunner(AbstractMediaDecoder* aDecoder, int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags)
|
||||
: mDecoder(aDecoder),
|
||||
mChannels(aChannels),
|
||||
mRate(aRate),
|
||||
mHasAudio(aHasAudio),
|
||||
mHasVideo(aHasVideo),
|
||||
mTags(aTags)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mDecoder->MetadataLoaded(mChannels, mRate, mHasAudio, mHasVideo, mTags);
|
||||
mDecoder->MetadataLoaded(mChannels, mRate, mHasAudio, mTags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int mChannels;
|
||||
int mRate;
|
||||
bool mHasAudio;
|
||||
bool mHasVideo;
|
||||
MetadataTags* mTags;
|
||||
};
|
||||
|
||||
|
|
|
@ -641,13 +641,12 @@ void MediaDecoder::QueueMetadata(int64_t aPublishTime,
|
|||
int aChannels,
|
||||
int aRate,
|
||||
bool aHasAudio,
|
||||
bool aHasVideo,
|
||||
MetadataTags* aTags)
|
||||
{
|
||||
NS_ASSERTION(mDecoderStateMachine->OnDecodeThread(),
|
||||
"Should be on decode thread.");
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
mDecoderStateMachine->QueueMetadata(aPublishTime, aChannels, aRate, aHasAudio, aHasVideo, aTags);
|
||||
mDecoderStateMachine->QueueMetadata(aPublishTime, aChannels, aRate, aHasAudio, aTags);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -660,7 +659,7 @@ MediaDecoder::IsDataCachedToEndOfResource()
|
|||
mResource->IsDataCachedToEndOfResource(mDecoderPosition));
|
||||
}
|
||||
|
||||
void MediaDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags)
|
||||
void MediaDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mShuttingDown) {
|
||||
|
@ -682,7 +681,7 @@ void MediaDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool
|
|||
// Make sure the element and the frame (if any) are told about
|
||||
// our new size.
|
||||
Invalidate();
|
||||
mOwner->MetadataLoaded(aChannels, aRate, aHasAudio, aHasVideo, aTags);
|
||||
mOwner->MetadataLoaded(aChannels, aRate, aHasAudio, aTags);
|
||||
}
|
||||
|
||||
if (!mCalledResourceLoaded) {
|
||||
|
|
|
@ -658,7 +658,6 @@ public:
|
|||
int aChannels,
|
||||
int aRate,
|
||||
bool aHasAudio,
|
||||
bool aHasVideo,
|
||||
MetadataTags* aTags);
|
||||
|
||||
/******
|
||||
|
@ -677,7 +676,7 @@ public:
|
|||
|
||||
// Called when the metadata from the media file has been loaded by the
|
||||
// state machine. Call on the main thread only.
|
||||
void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags);
|
||||
void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags);
|
||||
|
||||
// Called when the first frame has been loaded.
|
||||
// Call on the main thread only.
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
virtual void MetadataLoaded(int aChannels,
|
||||
int aRate,
|
||||
bool aHasAudio,
|
||||
bool aHasVideo,
|
||||
const MetadataTags* aTags) = 0;
|
||||
|
||||
// Called by the video decoder object, on the main thread,
|
||||
|
|
|
@ -1861,7 +1861,6 @@ nsresult MediaDecoderStateMachine::DecodeMetadata()
|
|||
mInfo.mAudioChannels,
|
||||
mInfo.mAudioRate,
|
||||
HasAudio(),
|
||||
HasVideo(),
|
||||
tags);
|
||||
NS_DispatchToMainThread(metadataLoadedEvent, NS_DISPATCH_NORMAL);
|
||||
|
||||
|
@ -2787,12 +2786,7 @@ bool MediaDecoderStateMachine::IsShutdown()
|
|||
return GetState() == DECODER_STATE_SHUTDOWN;
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::QueueMetadata(int64_t aPublishTime,
|
||||
int aChannels,
|
||||
int aRate,
|
||||
bool aHasAudio,
|
||||
bool aHasVideo,
|
||||
MetadataTags* aTags)
|
||||
void MediaDecoderStateMachine::QueueMetadata(int64_t aPublishTime, int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags)
|
||||
{
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
|
|
@ -319,7 +319,7 @@ public:
|
|||
// shutting down. The decoder monitor must be held while calling this.
|
||||
bool IsShutdown();
|
||||
|
||||
void QueueMetadata(int64_t aPublishTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags);
|
||||
void QueueMetadata(int64_t aPublishTime, int aChannels, int aRate, bool aHasAudio, MetadataTags* aTags);
|
||||
|
||||
protected:
|
||||
virtual uint32_t GetAmpleVideoFrames() { return mAmpleVideoFrames; }
|
||||
|
|
|
@ -28,8 +28,6 @@ namespace mozilla {
|
|||
int mChannels;
|
||||
// True if this media has an audio track.
|
||||
bool mHasAudio;
|
||||
// True if this media has a video track.
|
||||
bool mHasVideo;
|
||||
};
|
||||
|
||||
// This class encapsulate the logic to give the metadata from the reader to
|
||||
|
@ -55,7 +53,6 @@ namespace mozilla {
|
|||
metadata->mChannels,
|
||||
metadata->mRate,
|
||||
metadata->mHasAudio,
|
||||
metadata->mHasVideo,
|
||||
metadata->mTags.forget());
|
||||
NS_DispatchToMainThread(metadataUpdatedEvent, NS_DISPATCH_NORMAL);
|
||||
mMetadataQueue.popFirst();
|
||||
|
|
|
@ -67,15 +67,7 @@ void VideoFrameContainer::SetCurrentFrame(const gfxIntSize& aIntrinsicSize,
|
|||
mPaintTarget = aTargetTime;
|
||||
}
|
||||
|
||||
void VideoFrameContainer::Reset()
|
||||
{
|
||||
ClearCurrentFrame(true);
|
||||
Invalidate();
|
||||
mPaintDelay = TimeDuration();
|
||||
mImageContainer->ResetPaintCount();
|
||||
}
|
||||
|
||||
void VideoFrameContainer::ClearCurrentFrame(bool aResetSize)
|
||||
void VideoFrameContainer::ClearCurrentFrame()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
|
@ -84,7 +76,6 @@ void VideoFrameContainer::ClearCurrentFrame(bool aResetSize)
|
|||
nsRefPtr<Image> kungFuDeathGrip;
|
||||
kungFuDeathGrip = mImageContainer->LockCurrentImage();
|
||||
mImageContainer->UnlockCurrentImage();
|
||||
mImageSizeChanged = aResetSize;
|
||||
|
||||
mImageContainer->SetCurrentImage(nullptr);
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ public:
|
|||
// Call on any thread
|
||||
void SetCurrentFrame(const gfxIntSize& aIntrinsicSize, Image* aImage,
|
||||
TimeStamp aTargetTime);
|
||||
void ClearCurrentFrame(bool aResetSize = false);
|
||||
// Reset the VideoFrameContainer
|
||||
void Reset();
|
||||
void ClearCurrentFrame();
|
||||
// Time in seconds by which the last painted video frame was late by.
|
||||
// E.g. if the last painted frame should have been painted at time t,
|
||||
// but was actually painted at t+n, this returns n in seconds. Threadsafe.
|
||||
|
|
|
@ -732,7 +732,6 @@ bool OggReader::ReadOggChain()
|
|||
channels,
|
||||
rate,
|
||||
HasAudio(),
|
||||
HasVideo(),
|
||||
tags);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -133,7 +133,6 @@ MOCHITEST_FILES = \
|
|||
test_media_sniffer.html \
|
||||
contentType.sjs \
|
||||
test_streams_srcObject.html \
|
||||
test_reset_src.html \
|
||||
$(filter disabled-for-intermittent-failures--bug-608634, test_error_in_video_document.html) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=804875
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Test for bug 804875</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=804875">Mozilla Bug 804875</a>
|
||||
|
||||
<video style="border: 4px solid red" controls></video>
|
||||
<canvas></canvas>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function onLoadedMetadata_Audio(e) {
|
||||
var t = e.target;
|
||||
is(t.videoHeight, 0, "Audio should a zero for videoHeight.");
|
||||
is(t.videoWidth, 0, "Audio should a zero for videoWidth.");
|
||||
is(t.mozPaintedFrames, 0, "Audio should a zero for mozPaintedFrames.");
|
||||
is(t.mozFrameDelay, 0, "Audio should a zero for mozFrameDelay.");
|
||||
var c = document.getElementsByTagName("canvas")[0].getContext("2d");
|
||||
try {
|
||||
c.drawImage(t, 0, 0, t.videoHeight, t.videoWidth);
|
||||
} catch (e) {
|
||||
ok(true, "Trying to draw to a canvas should throw, since we don't have a frame anymore");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
ok(false, "We should not succeed to draw a video frame on the canvas.");
|
||||
}
|
||||
|
||||
function onTimeUpdate_Video(e) {
|
||||
var t = e.target;
|
||||
if (t.currentTime < t.duration / 4) {
|
||||
return;
|
||||
}
|
||||
t.removeEventListener("timeupdate", onTimeUpdate_Video);
|
||||
ok(t.mozPaintedFrames > 0, "mozPaintedFrames should be positive, is " + t.mozPaintedFrames + ".");
|
||||
ok(t.mozFrameDelay >= 0, "mozFrameDelay should be positive, is " + t.mozFrameDelay + ".");
|
||||
|
||||
var source = getPlayableAudio(gPlayTests);
|
||||
if (!source) {
|
||||
todo("No audio file available.")
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
t.removeEventListener("loadedmetadata", onLoadedMetadata_Video);
|
||||
t.addEventListener("loadedmetadata", onLoadedMetadata_Audio);
|
||||
t.src = source.name;
|
||||
}
|
||||
}
|
||||
|
||||
function onLoadedMetadata_Video(e) {
|
||||
var t = e.target;
|
||||
ok(t.videoHeight != 0, "We should have a videoHeight.");
|
||||
ok(t.videoWidth != 0, "We should have a videoWidth.");
|
||||
t.addEventListener("timeupdate", onTimeUpdate_Video);
|
||||
t.play();
|
||||
}
|
||||
|
||||
var v = document.getElementsByTagName("video")[0];
|
||||
var source = getPlayableVideo(gPlayTests);
|
||||
if (!source) {
|
||||
todo("No video file available.");
|
||||
} else {
|
||||
v.addEventListener("loadedmetadata", onLoadedMetadata_Video);
|
||||
v.src = source.name;
|
||||
dump(source.name);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -443,15 +443,6 @@ public:
|
|||
return mPaintCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the paint count to zero.
|
||||
* Can be called from any thread.
|
||||
*/
|
||||
void ResetPaintCount() {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mPaintCount = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments mPaintCount if this is the first time aPainted has been
|
||||
* painted, and sets mPaintTime if the painted image is the current image.
|
||||
|
|
Загрузка…
Ссылка в новой задаче