Bug 1074614 - Remove ChangeToHaveMetadata and WAIT_FOR_MSE_DATA frame status. r=cajbir

This commit is contained in:
Matthew Gregan 2014-09-30 17:12:45 +13:00
parent fa9ac0b845
commit aa46f041d1
5 changed files with 51 additions and 37 deletions

View File

@ -3095,14 +3095,6 @@ void HTMLMediaElement::UpdateReadyStateForData(MediaDecoderOwner::NextFrameStatu
return;
}
// Section 2.4.3.1 of the Media Source Extensions spec requires
// changing to HAVE_METADATA when seeking into an unbuffered
// range.
if (aNextFrame == MediaDecoderOwner::NEXT_FRAME_WAIT_FOR_MSE_DATA) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
return;
}
if (aNextFrame == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_SEEKING) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
return;

View File

@ -114,9 +114,6 @@ public:
NEXT_FRAME_UNAVAILABLE_SEEKING,
// The next frame of audio/video is unavailable for some other reasons
NEXT_FRAME_UNAVAILABLE,
// The next frame is unavailable due to waiting for more Media Source
// Extensions data to become available.
NEXT_FRAME_WAIT_FOR_MSE_DATA,
// Sentinel value
NEXT_FRAME_UNINITIALIZED
};

View File

@ -371,25 +371,6 @@ MediaSourceReader::OnTrackBufferConfigured(TrackBuffer* aTrackBuffer, const Medi
mDecoder->NotifyWaitingForResourcesStatusChanged();
}
class ChangeToHaveMetadata : public nsRunnable {
public:
explicit ChangeToHaveMetadata(AbstractMediaDecoder* aDecoder) :
mDecoder(aDecoder)
{
}
NS_IMETHOD Run() MOZ_OVERRIDE MOZ_FINAL {
auto owner = mDecoder->GetOwner();
if (owner) {
owner->UpdateReadyStateForData(MediaDecoderOwner::NEXT_FRAME_WAIT_FOR_MSE_DATA);
}
return NS_OK;
}
private:
nsRefPtr<AbstractMediaDecoder> mDecoder;
};
void
MediaSourceReader::WaitForTimeRange(int64_t aTime)
{
@ -434,11 +415,6 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
mLastAudioTime = aTime;
mLastVideoTime = aTime;
if (!TrackBuffersContainTime(aTime)) {
MSE_DEBUG("MediaSourceReader(%p)::Seek no active buffer contains target=%lld", this, aTime);
NS_DispatchToMainThread(new ChangeToHaveMetadata(mDecoder));
}
WaitForTimeRange(aTime);
if (IsShutdown()) {

View File

@ -5,10 +5,11 @@ support-files =
seek.webm seek.webm^headers^
seek_lowres.webm seek_lowres.webm^headers^
[test_BufferedSeek.html]
[test_FrameSelection.html]
[test_MediaSource.html]
[test_MediaSource_disabled.html]
[test_BufferedSeek.html]
[test_FrameSelection.html]
[test_HaveMetadataUnbufferedSeek.html]
[test_SeekableAfterEndOfStream.html]
[test_SeekableAfterEndOfStreamSplit.html]
[test_SeekableBeforeEndOfStream.html]

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<head>
<title>MSE: seekable attribute before end of stream</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(function (ms, v) {
ms.addEventListener("sourceopen", function () {
var sb = ms.addSourceBuffer("video/webm");
fetchWithXHR("seek.webm", function (arrayBuffer) {
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 67833));
});
var target = 2;
v.addEventListener("canplay", function oncanplay() {
v.removeEventListener("canplay", oncanplay);
ok(v.readyState >= v.HAVE_FUTURE_DATA, "readyState is >= FUTURE_DATA");
v.currentTime = target;
});
v.addEventListener("seeking", function () {
is(v.readyState, v.HAVE_METADATA, "readyState is HAVE_METADATA");
fetchWithXHR("seek.webm", function (arrayBuffer) {
sb.appendBuffer(new Uint8Array(arrayBuffer, 67833));
});
});
v.addEventListener("seeked", function () {
ok(v.readyState >= v.HAVE_FUTURE_DATA, "readyState is >= FUTURE_DATA");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>