summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp')
-rw-r--r--dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp b/dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp
index 43f34c456f..8fa0bade00 100644
--- a/dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp
+++ b/dom/media/webrtc/jsapi/RTCRtpScriptTransform.cpp
@@ -47,6 +47,22 @@ already_AddRefed<RTCRtpScriptTransform> RTCRtpScriptTransform::Constructor(
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
+
+ // The spec currently fails to describe what to do when the worker is closing
+ // or closed; the following placeholder text can be found in the spec at:
+ // https://w3c.github.io/webrtc-encoded-transform/#dom-rtcrtpscripttransform-rtcrtpscripttransform
+ //
+ // > FIXME: Describe error handling (worker closing flag true at
+ // > RTCRtpScriptTransform creation time. And worker being terminated while
+ // > transform is processing data).
+ //
+ // Because our worker runnables do not like to be pointed at a nonexistant
+ // worker, we throw in this case.
+ if (!aWorker.IsEligibleForMessaging()) {
+ aRv.Throw(NS_ERROR_FAILURE);
+ return nullptr;
+ }
+
auto newTransform = MakeRefPtr<RTCRtpScriptTransform>(ownerWindow);
RefPtr<RTCTransformEventRunnable> runnable =
new RTCTransformEventRunnable(aWorker, &newTransform->GetProxy());