Back out 4 changesets (bug 1240478) for somehow causing bug 1242085
Backed out changeset 31629671c71c (bug 1240478) Backed out changeset bc9a56a067b5 (bug 1240478) Backed out changeset 485bd08acb96 (bug 1240478) Backed out changeset 38ef99bddd74 (bug 1240478)
This commit is contained in:
@@ -3056,36 +3056,41 @@ class HTMLMediaElement::StreamSizeListener : public MediaStreamListener {
|
|||||||
public:
|
public:
|
||||||
explicit StreamSizeListener(HTMLMediaElement* aElement) :
|
explicit StreamSizeListener(HTMLMediaElement* aElement) :
|
||||||
mElement(aElement),
|
mElement(aElement),
|
||||||
mInitialSizeFound(false)
|
mMutex("HTMLMediaElement::StreamSizeListener")
|
||||||
{}
|
{}
|
||||||
void Forget() { mElement = nullptr; }
|
void Forget() { mElement = nullptr; }
|
||||||
|
|
||||||
void ReceivedSize(gfx::IntSize aSize)
|
void ReceivedSize()
|
||||||
{
|
{
|
||||||
if (!mElement) {
|
if (!mElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
gfx::IntSize size;
|
||||||
|
{
|
||||||
|
MutexAutoLock lock(mMutex);
|
||||||
|
size = mInitialSize;
|
||||||
|
}
|
||||||
RefPtr<HTMLMediaElement> deathGrip = mElement;
|
RefPtr<HTMLMediaElement> deathGrip = mElement;
|
||||||
mElement->UpdateInitialMediaSize(aSize);
|
mElement->UpdateInitialMediaSize(size);
|
||||||
}
|
}
|
||||||
|
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
|
||||||
void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
|
StreamTime aTrackOffset,
|
||||||
StreamTime aTrackOffset,
|
uint32_t aTrackEvents,
|
||||||
uint32_t aTrackEvents,
|
const MediaSegment& aQueuedMedia,
|
||||||
const MediaSegment& aQueuedMedia,
|
MediaStream* aInputStream,
|
||||||
MediaStream* aInputStream,
|
TrackID aInputTrackID) override
|
||||||
TrackID aInputTrackID) override
|
|
||||||
{
|
{
|
||||||
if (mInitialSizeFound || aQueuedMedia.GetType() != MediaSegment::VIDEO) {
|
MutexAutoLock lock(mMutex);
|
||||||
|
if (mInitialSize != gfx::IntSize(0,0) ||
|
||||||
|
aQueuedMedia.GetType() != MediaSegment::VIDEO) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const VideoSegment& video = static_cast<const VideoSegment&>(aQueuedMedia);
|
const VideoSegment& video = static_cast<const VideoSegment&>(aQueuedMedia);
|
||||||
for (VideoSegment::ConstChunkIterator c(video); !c.IsEnded(); c.Next()) {
|
for (VideoSegment::ConstChunkIterator c(video); !c.IsEnded(); c.Next()) {
|
||||||
if (c->mFrame.GetIntrinsicSize() != gfx::IntSize(0,0)) {
|
if (c->mFrame.GetIntrinsicSize() != gfx::IntSize(0,0)) {
|
||||||
|
mInitialSize = c->mFrame.GetIntrinsicSize();
|
||||||
nsCOMPtr<nsIRunnable> event =
|
nsCOMPtr<nsIRunnable> event =
|
||||||
NS_NewRunnableMethodWithArgs<gfx::IntSize>(
|
NS_NewRunnableMethod(this, &StreamSizeListener::ReceivedSize);
|
||||||
this, &StreamSizeListener::ReceivedSize,
|
|
||||||
c->mFrame.GetIntrinsicSize());
|
|
||||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3095,8 +3100,9 @@ private:
|
|||||||
// These fields may only be accessed on the main thread
|
// These fields may only be accessed on the main thread
|
||||||
HTMLMediaElement* mElement;
|
HTMLMediaElement* mElement;
|
||||||
|
|
||||||
// These fields may only be accessed on the MSG thread
|
// mMutex protects the fields below; they can be accessed on any thread
|
||||||
bool mInitialSizeFound;
|
Mutex mMutex;
|
||||||
|
gfx::IntSize mInitialSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HTMLMediaElement::MediaStreamTracksAvailableCallback:
|
class HTMLMediaElement::MediaStreamTracksAvailableCallback:
|
||||||
@@ -3166,7 +3172,9 @@ void HTMLMediaElement::UpdateSrcMediaStreamPlaying(uint32_t aFlags)
|
|||||||
|
|
||||||
mMediaStreamListener = new StreamListener(this,
|
mMediaStreamListener = new StreamListener(this,
|
||||||
"HTMLMediaElement::mMediaStreamListener");
|
"HTMLMediaElement::mMediaStreamListener");
|
||||||
|
mMediaStreamSizeListener = new StreamSizeListener(this);
|
||||||
stream->AddListener(mMediaStreamListener);
|
stream->AddListener(mMediaStreamListener);
|
||||||
|
stream->AddListener(mMediaStreamSizeListener);
|
||||||
|
|
||||||
mWatchManager.Watch(*mMediaStreamListener,
|
mWatchManager.Watch(*mMediaStreamListener,
|
||||||
&HTMLMediaElement::UpdateReadyStateInternal);
|
&HTMLMediaElement::UpdateReadyStateInternal);
|
||||||
@@ -3183,6 +3191,7 @@ void HTMLMediaElement::UpdateSrcMediaStreamPlaying(uint32_t aFlags)
|
|||||||
mSrcStreamPausedCurrentTime = CurrentTime();
|
mSrcStreamPausedCurrentTime = CurrentTime();
|
||||||
|
|
||||||
stream->RemoveListener(mMediaStreamListener);
|
stream->RemoveListener(mMediaStreamListener);
|
||||||
|
stream->RemoveListener(mMediaStreamSizeListener);
|
||||||
|
|
||||||
stream->RemoveAudioOutput(this);
|
stream->RemoveAudioOutput(this);
|
||||||
VideoFrameContainer* container = GetVideoFrameContainer();
|
VideoFrameContainer* container = GetVideoFrameContainer();
|
||||||
@@ -3198,6 +3207,8 @@ void HTMLMediaElement::UpdateSrcMediaStreamPlaying(uint32_t aFlags)
|
|||||||
|
|
||||||
mMediaStreamListener->Forget();
|
mMediaStreamListener->Forget();
|
||||||
mMediaStreamListener = nullptr;
|
mMediaStreamListener = nullptr;
|
||||||
|
mMediaStreamSizeListener->Forget();
|
||||||
|
mMediaStreamSizeListener = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3216,9 +3227,6 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
|
|||||||
RefPtr<MediaStream> stream = GetSrcMediaStream();
|
RefPtr<MediaStream> stream = GetSrcMediaStream();
|
||||||
if (stream) {
|
if (stream) {
|
||||||
stream->SetAudioChannelType(mAudioChannel);
|
stream->SetAudioChannelType(mAudioChannel);
|
||||||
|
|
||||||
mMediaStreamSizeListener = new StreamSizeListener(this);
|
|
||||||
stream->AddListener(mMediaStreamSizeListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSrcMediaStreamPlaying();
|
UpdateSrcMediaStreamPlaying();
|
||||||
@@ -3245,13 +3253,6 @@ void HTMLMediaElement::EndSrcMediaStreamPlayback()
|
|||||||
|
|
||||||
UpdateSrcMediaStreamPlaying(REMOVING_SRC_STREAM);
|
UpdateSrcMediaStreamPlaying(REMOVING_SRC_STREAM);
|
||||||
|
|
||||||
RefPtr<MediaStream> stream = GetSrcMediaStream();
|
|
||||||
if (stream) {
|
|
||||||
stream->RemoveListener(mMediaStreamSizeListener);
|
|
||||||
}
|
|
||||||
mMediaStreamSizeListener->Forget();
|
|
||||||
mMediaStreamSizeListener = nullptr;
|
|
||||||
|
|
||||||
mSrcStream->UnregisterTrackListener(mMediaStreamTrackListener);
|
mSrcStream->UnregisterTrackListener(mMediaStreamTrackListener);
|
||||||
mMediaStreamTrackListener = nullptr;
|
mMediaStreamTrackListener = nullptr;
|
||||||
|
|
||||||
@@ -3400,10 +3401,6 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
|
|||||||
if (IsVideo() && HasVideo()) {
|
if (IsVideo() && HasVideo()) {
|
||||||
DispatchAsyncEvent(NS_LITERAL_STRING("resize"));
|
DispatchAsyncEvent(NS_LITERAL_STRING("resize"));
|
||||||
}
|
}
|
||||||
NS_ASSERTION(!HasVideo() ||
|
|
||||||
(mMediaInfo.mVideo.mDisplay.width > 0 &&
|
|
||||||
mMediaInfo.mVideo.mDisplay.height > 0),
|
|
||||||
"Video resolution must be known on 'loadedmetadata'");
|
|
||||||
DispatchAsyncEvent(NS_LITERAL_STRING("loadedmetadata"));
|
DispatchAsyncEvent(NS_LITERAL_STRING("loadedmetadata"));
|
||||||
if (mDecoder && mDecoder->IsTransportSeekable() && mDecoder->IsMediaSeekable()) {
|
if (mDecoder && mDecoder->IsTransportSeekable() && mDecoder->IsMediaSeekable()) {
|
||||||
ProcessMediaFragmentURI();
|
ProcessMediaFragmentURI();
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ skip-if = (toolkit == 'gonk' || buildapp == 'mulet' && debug) # debug-only failu
|
|||||||
[test_getUserMedia_callbacks.html]
|
[test_getUserMedia_callbacks.html]
|
||||||
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # Bug 1063290, intermittent timeout # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
|
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # Bug 1063290, intermittent timeout # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
|
||||||
[test_getUserMedia_gumWithinGum.html]
|
[test_getUserMedia_gumWithinGum.html]
|
||||||
[test_getUserMedia_loadedmetadata.html]
|
|
||||||
[test_getUserMedia_mediaStreamConstructors.html]
|
[test_getUserMedia_mediaStreamConstructors.html]
|
||||||
[test_getUserMedia_playAudioTwice.html]
|
[test_getUserMedia_playAudioTwice.html]
|
||||||
[test_getUserMedia_playVideoAudioTwice.html]
|
[test_getUserMedia_playVideoAudioTwice.html]
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<pre id="test">
|
|
||||||
<script type="application/javascript">
|
|
||||||
createHTML({
|
|
||||||
title: "getUserMedia in media element should have video dimensions on loadedmetadata",
|
|
||||||
bug: "1240478"
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* Tests that assigning a stream to a media element results in the
|
|
||||||
* "loadedmetadata" event without having to play() the media element.
|
|
||||||
*
|
|
||||||
* Also makes sure that the video size has been set on "loadedmetadata".
|
|
||||||
*/
|
|
||||||
runTest(function () {
|
|
||||||
var v = document.createElement("video");
|
|
||||||
v.preload = "metadata";
|
|
||||||
|
|
||||||
var constraints = {video: true, audio: true};
|
|
||||||
return getUserMedia(constraints).then(stream => new Promise(resolve => {
|
|
||||||
v.srcObject = stream;
|
|
||||||
v.onloadedmetadata = resolve;
|
|
||||||
})).then(() => {
|
|
||||||
isnot(v.videoWidth, 0, "videoWidth shall be set on 'loadedmetadata'");
|
|
||||||
isnot(v.videoHeight, 0, "videoHeight shall be set on 'loadedmetadata'");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user