mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 16:37:31 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
b0345ff809
35 changed files with 789 additions and 133 deletions
|
|
@ -453,8 +453,6 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
|
|||
mWatchManager.Watch(mLogicallySeeking, &MediaDecoder::SeekingChanged);
|
||||
|
||||
mWatchManager.Watch(mIsAudioDataAudible, &MediaDecoder::NotifyAudibleStateChanged);
|
||||
|
||||
MediaShutdownManager::InitStatics();
|
||||
}
|
||||
|
||||
#undef INIT_MIRROR
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "WebVTTListener.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h"
|
||||
#include "mozilla/dom/TextTrackCue.h"
|
||||
#include "mozilla/dom/TextTrackRegion.h"
|
||||
#include "mozilla/dom/VTTRegionBinding.h"
|
||||
|
|
@ -34,9 +35,22 @@ LazyLogModule gTextTrackLog("TextTrack");
|
|||
|
||||
WebVTTListener::WebVTTListener(HTMLTrackElement* aElement)
|
||||
: mElement(aElement)
|
||||
, mParserWrapperError(NS_OK)
|
||||
{
|
||||
MOZ_ASSERT(mElement, "Must pass an element to the callback");
|
||||
VTT_LOG("WebVTTListener created.");
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
CycleCollectedJSContext::Get() &&
|
||||
!CycleCollectedJSContext::Get()->IsInStableOrMetaStableState());
|
||||
mParserWrapper = do_CreateInstance(NS_WEBVTTPARSERWRAPPER_CONTRACTID,
|
||||
&mParserWrapperError);
|
||||
if (NS_SUCCEEDED(mParserWrapperError)) {
|
||||
nsPIDOMWindowInner* window = mElement->OwnerDoc()->GetInnerWindow();
|
||||
mParserWrapperError = mParserWrapper->LoadParser(window);
|
||||
}
|
||||
if (NS_SUCCEEDED(mParserWrapperError)) {
|
||||
mParserWrapperError = mParserWrapper->Watch(this);
|
||||
}
|
||||
}
|
||||
|
||||
WebVTTListener::~WebVTTListener()
|
||||
|
|
@ -54,16 +68,8 @@ WebVTTListener::GetInterface(const nsIID &aIID,
|
|||
nsresult
|
||||
WebVTTListener::LoadResource()
|
||||
{
|
||||
nsresult rv;
|
||||
mParserWrapper = do_CreateInstance(NS_WEBVTTPARSERWRAPPER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsPIDOMWindowInner* window = mElement->OwnerDoc()->GetInnerWindow();
|
||||
rv = mParserWrapper->LoadParser(window);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mParserWrapper->Watch(this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Exit if we failed to create the WebVTTParserWrapper (vtt.jsm)
|
||||
NS_ENSURE_SUCCESS(mParserWrapperError, mParserWrapperError);
|
||||
|
||||
mElement->SetReadyState(TextTrackReadyState::Loading);
|
||||
return NS_OK;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ private:
|
|||
|
||||
RefPtr<HTMLTrackElement> mElement;
|
||||
nsCOMPtr<nsIWebVTTParserWrapper> mParserWrapper;
|
||||
nsresult mParserWrapperError;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
|||
|
|
@ -59,15 +59,30 @@ public:
|
|||
switch (event) {
|
||||
case MediaStreamGraphEvent::EVENT_FINISHED:
|
||||
{
|
||||
RefPtr<SynthStreamListener> self = this;
|
||||
if (!mStarted) {
|
||||
mStarted = true;
|
||||
nsCOMPtr<nsIRunnable> startRunnable =
|
||||
NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
|
||||
nsCOMPtr<nsIRunnable> startRunnable = NS_NewRunnableFunction(
|
||||
[self] {
|
||||
// "start" event will be fired in DoNotifyStarted() which is
|
||||
// not allowed in stable state, so we do it asynchronously in
|
||||
// next run.
|
||||
NS_DispatchToMainThread(NewRunnableMethod(
|
||||
self,
|
||||
&SynthStreamListener::DoNotifyStarted));
|
||||
});
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(startRunnable.forget());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> endRunnable =
|
||||
NewRunnableMethod(this, &SynthStreamListener::DoNotifyFinished);
|
||||
nsCOMPtr<nsIRunnable> endRunnable = NS_NewRunnableFunction(
|
||||
[self] {
|
||||
// "end" event will be fired in DoNotifyFinished() which is
|
||||
// not allowed in stable state, so we do it asynchronously in
|
||||
// next run.
|
||||
NS_DispatchToMainThread(NewRunnableMethod(
|
||||
self,
|
||||
&SynthStreamListener::DoNotifyFinished));
|
||||
});
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(endRunnable.forget());
|
||||
}
|
||||
break;
|
||||
|
|
@ -85,8 +100,16 @@ public:
|
|||
{
|
||||
if (aBlocked == MediaStreamListener::UNBLOCKED && !mStarted) {
|
||||
mStarted = true;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
|
||||
RefPtr<SynthStreamListener> self = this;
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction(
|
||||
[self] {
|
||||
// "start" event will be fired in DoNotifyStarted() which is
|
||||
// not allowed in stable state, so we do it asynchronously in
|
||||
// next run.
|
||||
NS_DispatchToMainThread(NewRunnableMethod(
|
||||
self,
|
||||
&SynthStreamListener::DoNotifyStarted));
|
||||
});
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue