зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1724106) for causing Bug 1728715.
CLOSED TREE Backed out changeset 81d1db229eea (bug 1724106) Backed out changeset 8ed4675541c6 (bug 1724106)
This commit is contained in:
Родитель
fa4868fd2d
Коммит
bd2de15f47
|
@ -7374,8 +7374,6 @@ void HTMLMediaElement::AsyncRejectPendingPlayPromises(nsresult aError) {
|
|||
}
|
||||
|
||||
void HTMLMediaElement::GetEMEInfo(dom::EMEDebugInfo& aInfo) {
|
||||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"MediaKeys expects to be interacted with on main thread!");
|
||||
if (!mMediaKeys) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1361,7 +1361,6 @@ MediaDecoderOwner::NextFrameStatus MediaDecoder::NextFrameBufferedStatus() {
|
|||
}
|
||||
|
||||
void MediaDecoder::GetDebugInfo(dom::MediaDecoderDebugInfo& aInfo) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
CopyUTF8toUTF16(nsPrintfCString("%p", this), aInfo.mInstance);
|
||||
aInfo.mChannels = mInfo ? mInfo->mAudio.mChannels : 0;
|
||||
aInfo.mRate = mInfo ? mInfo->mAudio.mRate : 0;
|
||||
|
@ -1370,28 +1369,27 @@ void MediaDecoder::GetDebugInfo(dom::MediaDecoderDebugInfo& aInfo) {
|
|||
CopyUTF8toUTF16(MakeStringSpan(PlayStateStr()), aInfo.mPlayState);
|
||||
aInfo.mContainerType =
|
||||
NS_ConvertUTF8toUTF16(ContainerType().Type().AsString());
|
||||
mReader->GetDebugInfo(aInfo.mReader);
|
||||
}
|
||||
|
||||
RefPtr<GenericPromise> MediaDecoder::RequestDebugInfo(
|
||||
MediaDecoderDebugInfo& aInfo) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
||||
if (!NS_IsMainThread()) {
|
||||
// Run the request on the main thread if it's not already.
|
||||
return InvokeAsync(AbstractThread::MainThread(), __func__,
|
||||
[this, self = RefPtr{this}, &aInfo]() {
|
||||
return RequestDebugInfo(aInfo);
|
||||
});
|
||||
}
|
||||
GetDebugInfo(aInfo);
|
||||
|
||||
return mReader->RequestDebugInfo(aInfo.mReader)
|
||||
->Then(AbstractThread::MainThread(), __func__,
|
||||
[this, self = RefPtr{this}, &aInfo] {
|
||||
if (!GetStateMachine()) {
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
return GetStateMachine()->RequestDebugInfo(aInfo.mStateMachine);
|
||||
});
|
||||
if (!GetStateMachine()) {
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
return GetStateMachine()
|
||||
->RequestDebugInfo(aInfo.mStateMachine)
|
||||
->Then(
|
||||
AbstractThread::MainThread(), __func__,
|
||||
[]() { return GenericPromise::CreateAndResolve(true, __func__); },
|
||||
[]() {
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected RequestDebugInfo() rejection");
|
||||
return GenericPromise::CreateAndResolve(false, __func__);
|
||||
});
|
||||
}
|
||||
|
||||
void MediaDecoder::NotifyAudibleStateChanged() {
|
||||
|
|
|
@ -3004,23 +3004,7 @@ layers::ImageContainer* MediaFormatReader::GetImageContainer() {
|
|||
: nullptr;
|
||||
}
|
||||
|
||||
RefPtr<GenericPromise> MediaFormatReader::RequestDebugInfo(
|
||||
dom::MediaFormatReaderDebugInfo& aInfo) {
|
||||
if (!OnTaskQueue()) {
|
||||
// Run the request on the task queue if it's not already.
|
||||
return InvokeAsync(mTaskQueue, __func__,
|
||||
[this, self = RefPtr{this}, &aInfo] {
|
||||
return RequestDebugInfo(aInfo);
|
||||
});
|
||||
}
|
||||
GetDebugInfo(aInfo);
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
||||
MOZ_ASSERT(OnTaskQueue(),
|
||||
"Don't call this off the task queue, it's going to touch a lot of "
|
||||
"data members");
|
||||
nsCString result;
|
||||
nsAutoCString audioDecoderName("unavailable");
|
||||
nsAutoCString videoDecoderName = audioDecoderName;
|
||||
|
@ -3028,11 +3012,34 @@ void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
|||
nsAutoCString videoType("none");
|
||||
|
||||
AudioInfo audioInfo;
|
||||
{
|
||||
MutexAutoLock lock(mAudio.mMutex);
|
||||
if (HasAudio()) {
|
||||
audioInfo = *mAudio.GetWorkingInfo()->GetAsAudioInfo();
|
||||
audioDecoderName = mAudio.mDecoder ? mAudio.mDecoder->GetDescriptionName()
|
||||
: mAudio.mDescription;
|
||||
audioType = audioInfo.mMimeType;
|
||||
}
|
||||
}
|
||||
|
||||
VideoInfo videoInfo;
|
||||
{
|
||||
MutexAutoLock lock(mVideo.mMutex);
|
||||
if (HasVideo()) {
|
||||
videoInfo = *mVideo.GetWorkingInfo()->GetAsVideoInfo();
|
||||
videoDecoderName = mVideo.mDecoder ? mVideo.mDecoder->GetDescriptionName()
|
||||
: mVideo.mDescription;
|
||||
videoType = videoInfo.mMimeType;
|
||||
}
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(audioDecoderName, aInfo.mAudioDecoderName);
|
||||
CopyUTF8toUTF16(audioType, aInfo.mAudioType);
|
||||
aInfo.mAudioChannels = audioInfo.mChannels;
|
||||
aInfo.mAudioRate = audioInfo.mRate / 1000.0f;
|
||||
aInfo.mAudioFramesDecoded = mAudio.mNumSamplesOutputTotal;
|
||||
|
||||
if (HasAudio()) {
|
||||
audioInfo = *mAudio.GetWorkingInfo()->GetAsAudioInfo();
|
||||
audioDecoderName = mAudio.mDecoder ? mAudio.mDecoder->GetDescriptionName()
|
||||
: mAudio.mDescription;
|
||||
audioType = audioInfo.mMimeType;
|
||||
aInfo.mAudioState.mNeedInput = NeedInput(mAudio);
|
||||
aInfo.mAudioState.mHasPromise = mAudio.HasPromise();
|
||||
aInfo.mAudioState.mWaitingPromise = !mAudio.mWaitingPromise.IsEmpty();
|
||||
|
@ -3056,18 +3063,18 @@ void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
|||
aInfo.mAudioState.mLastStreamSourceID = mAudio.mLastStreamSourceID;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(audioDecoderName, aInfo.mAudioDecoderName);
|
||||
CopyUTF8toUTF16(audioType, aInfo.mAudioType);
|
||||
aInfo.mAudioChannels = audioInfo.mChannels;
|
||||
aInfo.mAudioRate = audioInfo.mRate / 1000.0f;
|
||||
aInfo.mAudioFramesDecoded = mAudio.mNumSamplesOutputTotal;
|
||||
CopyUTF8toUTF16(videoDecoderName, aInfo.mVideoDecoderName);
|
||||
CopyUTF8toUTF16(videoType, aInfo.mVideoType);
|
||||
aInfo.mVideoWidth =
|
||||
videoInfo.mDisplay.width < 0 ? 0 : videoInfo.mDisplay.width;
|
||||
aInfo.mVideoHeight =
|
||||
videoInfo.mDisplay.height < 0 ? 0 : videoInfo.mDisplay.height;
|
||||
aInfo.mVideoRate = mVideo.mMeanRate.Mean();
|
||||
aInfo.mVideoHardwareAccelerated = VideoIsHardwareAccelerated();
|
||||
aInfo.mVideoNumSamplesOutputTotal = mVideo.mNumSamplesOutputTotal;
|
||||
aInfo.mVideoNumSamplesSkippedTotal = mVideo.mNumSamplesSkippedTotal;
|
||||
|
||||
VideoInfo videoInfo;
|
||||
if (HasVideo()) {
|
||||
videoInfo = *mVideo.GetWorkingInfo()->GetAsVideoInfo();
|
||||
videoDecoderName = mVideo.mDecoder ? mVideo.mDecoder->GetDescriptionName()
|
||||
: mVideo.mDescription;
|
||||
videoType = videoInfo.mMimeType;
|
||||
aInfo.mVideoState.mNeedInput = NeedInput(mVideo);
|
||||
aInfo.mVideoState.mHasPromise = mVideo.HasPromise();
|
||||
aInfo.mVideoState.mWaitingPromise = !mVideo.mWaitingPromise.IsEmpty();
|
||||
|
@ -3091,17 +3098,6 @@ void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
|||
aInfo.mVideoState.mLastStreamSourceID = mVideo.mLastStreamSourceID;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(videoDecoderName, aInfo.mVideoDecoderName);
|
||||
CopyUTF8toUTF16(videoType, aInfo.mVideoType);
|
||||
aInfo.mVideoWidth =
|
||||
videoInfo.mDisplay.width < 0 ? 0 : videoInfo.mDisplay.width;
|
||||
aInfo.mVideoHeight =
|
||||
videoInfo.mDisplay.height < 0 ? 0 : videoInfo.mDisplay.height;
|
||||
aInfo.mVideoRate = mVideo.mMeanRate.Mean();
|
||||
aInfo.mVideoHardwareAccelerated = VideoIsHardwareAccelerated();
|
||||
aInfo.mVideoNumSamplesOutputTotal = mVideo.mNumSamplesOutputTotal;
|
||||
aInfo.mVideoNumSamplesSkippedTotal = mVideo.mNumSamplesSkippedTotal;
|
||||
|
||||
// Looking at dropped frames
|
||||
FrameStatisticsData stats = mFrameStats->GetFrameStatisticsData();
|
||||
aInfo.mFrameStats.mDroppedDecodedFrames = stats.mDroppedDecodedFrames;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
# include "SeekTarget.h"
|
||||
# include "mozilla/Atomics.h"
|
||||
# include "mozilla/Maybe.h"
|
||||
# include "mozilla/MozPromise.h"
|
||||
# include "mozilla/Mutex.h"
|
||||
# include "mozilla/StateMirroring.h"
|
||||
# include "mozilla/StaticPrefs_media.h"
|
||||
|
@ -184,11 +183,9 @@ class MediaFormatReader final
|
|||
|
||||
RefPtr<SetCDMPromise> SetCDMProxy(CDMProxy* aProxy);
|
||||
|
||||
// Requests that the MediaFormatReader populates aInfo with debug information.
|
||||
// This may be done asynchronously, and aInfo should *not* be accessed by the
|
||||
// caller until the returned promise is resolved or rejected.
|
||||
RefPtr<GenericPromise> RequestDebugInfo(
|
||||
dom::MediaFormatReaderDebugInfo& aInfo);
|
||||
// Returns a MediaDebugInfo structure
|
||||
// Used for debugging purposes.
|
||||
void GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo);
|
||||
|
||||
// Switch the video decoder to NullDecoderModule. It might takes effective
|
||||
// since a few samples later depends on how much demuxed samples are already
|
||||
|
@ -810,8 +807,6 @@ class MediaFormatReader final
|
|||
MozPromiseHolder<SetCDMPromise> mSetCDMPromise;
|
||||
TrackSet mSetCDMForTracks{};
|
||||
bool IsDecoderWaitingForCDM(TrackType aTrack);
|
||||
|
||||
void GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -629,17 +629,9 @@ already_AddRefed<Promise> MediaSource::MozDebugReaderData(ErrorResult& aRv) {
|
|||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(domPromise);
|
||||
UniquePtr<MediaSourceDecoderDebugInfo> info =
|
||||
MakeUnique<MediaSourceDecoderDebugInfo>();
|
||||
mDecoder->RequestDebugInfo(*info)->Then(
|
||||
mAbstractMainThread, __func__,
|
||||
[domPromise, infoPtr = std::move(info)] {
|
||||
domPromise->MaybeResolve(infoPtr.get());
|
||||
},
|
||||
[] {
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected rejection while getting debug data");
|
||||
});
|
||||
|
||||
MediaSourceDecoderDebugInfo info;
|
||||
mDecoder->GetDebugInfo(info);
|
||||
domPromise->MaybeResolve(info);
|
||||
return domPromise.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -227,22 +227,11 @@ void MediaSourceDecoder::SetMediaSourceDuration(double aDuration) {
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<GenericPromise> MediaSourceDecoder::RequestDebugInfo(
|
||||
dom::MediaSourceDecoderDebugInfo& aInfo) {
|
||||
// This should be safe to call off main thead, but there's no such usage at
|
||||
// time of writing. Can be carefully relaxed if needed.
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Expects to be called on main thread.");
|
||||
if (mReader) {
|
||||
return mReader->RequestDebugInfo(aInfo.mReader)
|
||||
->Then(GetCurrentSerialEventTarget(), __func__,
|
||||
[this, self = RefPtr<MediaSourceDecoder>{this}, &aInfo] {
|
||||
if (mDemuxer) {
|
||||
mDemuxer->GetDebugInfo(aInfo.mDemuxer);
|
||||
}
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
});
|
||||
void MediaSourceDecoder::GetDebugInfo(dom::MediaSourceDecoderDebugInfo& aInfo) {
|
||||
if (mReader && mDemuxer) {
|
||||
mReader->GetDebugInfo(aInfo.mReader);
|
||||
mDemuxer->GetDebugInfo(aInfo.mDemuxer);
|
||||
}
|
||||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
double MediaSourceDecoder::GetDuration() {
|
||||
|
|
|
@ -54,11 +54,9 @@ class MediaSourceDecoder : public MediaDecoder,
|
|||
|
||||
bool IsTransportSeekable() override { return true; }
|
||||
|
||||
// Requests that the MediaSourceDecoder populates aInfo with debug
|
||||
// information. This may be done asynchronously, and aInfo should *not* be
|
||||
// accessed by the caller until the returned promise is resolved or rejected.
|
||||
RefPtr<GenericPromise> RequestDebugInfo(
|
||||
dom::MediaSourceDecoderDebugInfo& aInfo);
|
||||
// Returns a structure describing the state of the MediaSource internal
|
||||
// buffered data. Used for debugging purposes.
|
||||
void GetDebugInfo(dom::MediaSourceDecoderDebugInfo& aInfo);
|
||||
|
||||
void AddSizeOfResources(ResourceSizes* aSizes) override;
|
||||
|
||||
|
|
|
@ -821,7 +821,6 @@ skip-if = toolkit == 'android' # bug 1108558, android(bug 1232305)
|
|||
[test_cueless_webm_seek-2.html]
|
||||
[test_cueless_webm_seek-3.html]
|
||||
[test_currentTime.html]
|
||||
[test_debug_data_helpers.html]
|
||||
[test_decode_error.html]
|
||||
[test_decode_error_crossorigin.html]
|
||||
[test_decoder_disable.html]
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test the special debug APIs give expected data</title>
|
||||
<script 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>
|
||||
<script class="testbody" type="text/javascript">
|
||||
add_task(async function testMozRequestDebugInfo() {
|
||||
let video = document.createElement("video");
|
||||
video.src = "gizmo.mp4";
|
||||
document.body.appendChild(video);
|
||||
await video.play();
|
||||
let debugData = await SpecialPowers.wrap(video).mozRequestDebugInfo();
|
||||
// Verify various members are present and as expected.
|
||||
ok(debugData, "Should get some debug data");
|
||||
ok(debugData.decoder.hasAudio, "Should have audio");
|
||||
ok(debugData.decoder.hasVideo, "Should have video");
|
||||
is(
|
||||
debugData.decoder.reader.videoWidth,
|
||||
560,
|
||||
"Video should have expected width"
|
||||
);
|
||||
is(
|
||||
debugData.decoder.reader.videoHeight,
|
||||
320,
|
||||
"Video should have expected height"
|
||||
);
|
||||
ok(
|
||||
debugData.decoder.stateMachine.mediaTime >= 0,
|
||||
"Media time should be positive"
|
||||
);
|
||||
removeNodeAndSource(video);
|
||||
});
|
||||
|
||||
add_task(async function testMozDebugReaderData() {
|
||||
let video = document.createElement("video");
|
||||
let mediaSource = new MediaSource();
|
||||
video.src = URL.createObjectURL(mediaSource);
|
||||
await once(mediaSource, "sourceopen");
|
||||
const sourceBuffer = mediaSource.addSourceBuffer("video/webm");
|
||||
let fetchResponse = await fetch("bipbop_short_vp8.webm");
|
||||
sourceBuffer.appendBuffer(await fetchResponse.arrayBuffer());
|
||||
await once(sourceBuffer, "updateend");
|
||||
mediaSource.endOfStream();
|
||||
await once(mediaSource, "sourceended");
|
||||
document.body.appendChild(video);
|
||||
await video.play();
|
||||
let debugData = await SpecialPowers.wrap(mediaSource).mozDebugReaderData();
|
||||
// Verify various members are present and as expected.
|
||||
ok(debugData, "Should get some debug data");
|
||||
is(debugData.reader.videoWidth, 400, "Video should have expected width");
|
||||
is(debugData.reader.videoHeight, 300, "Video should have expected height");
|
||||
ok(
|
||||
debugData.demuxer.audioTrack.numSamples > 0,
|
||||
"Audio track should have demuxed some samples"
|
||||
);
|
||||
ok(
|
||||
debugData.demuxer.audioTrack.ranges.length > 0,
|
||||
"Audio track should have some buffered range"
|
||||
);
|
||||
ok(
|
||||
debugData.demuxer.videoTrack.numSamples > 0,
|
||||
"Video track should have demuxed some samples"
|
||||
);
|
||||
ok(
|
||||
debugData.demuxer.videoTrack.ranges.length > 0,
|
||||
"Video track should have some buffered range"
|
||||
);
|
||||
removeNodeAndSource(video);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче