summaryrefslogtreecommitdiff
path: root/dom/media/imagecapture/CaptureTask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/imagecapture/CaptureTask.cpp')
-rw-r--r--dom/media/imagecapture/CaptureTask.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/dom/media/imagecapture/CaptureTask.cpp b/dom/media/imagecapture/CaptureTask.cpp
index 9f1eea9ef6..589ba5a429 100644
--- a/dom/media/imagecapture/CaptureTask.cpp
+++ b/dom/media/imagecapture/CaptureTask.cpp
@@ -15,6 +15,24 @@
namespace mozilla {
+class CaptureTask::MediaStreamEventListener : public MediaStreamTrackListener
+{
+public:
+ explicit MediaStreamEventListener(CaptureTask* aCaptureTask)
+ : mCaptureTask(aCaptureTask) {};
+
+ // MediaStreamListener methods.
+ void NotifyEnded() override
+ {
+ if(!mCaptureTask->mImageGrabbedOrTrackEnd) {
+ mCaptureTask->PostTrackEndEvent();
+ }
+ }
+
+private:
+ CaptureTask* mCaptureTask;
+};
+
CaptureTask::CaptureTask(dom::ImageCapture* aImageCapture)
: mImageCapture(aImageCapture)
, mEventListener(new MediaStreamEventListener(this))