| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/mediarecorder/MediaRecorder.h" | 6 #include "modules/mediarecorder/MediaRecorder.h" |
| 7 | 7 |
| 8 #include "core/dom/DOMError.h" | 8 #include "core/dom/DOMError.h" |
| 9 #include "core/fileapi/Blob.h" | 9 #include "core/fileapi/Blob.h" |
| 10 #include "modules/EventModules.h" | 10 #include "modules/EventModules.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, con
st String& mimeType, ExceptionState& exceptionState) | 54 MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, con
st String& mimeType, ExceptionState& exceptionState) |
| 55 : ActiveDOMObject(context) | 55 : ActiveDOMObject(context) |
| 56 , m_stream(stream) | 56 , m_stream(stream) |
| 57 , m_mimeType(mimeType) | 57 , m_mimeType(mimeType) |
| 58 , m_stopped(true) | 58 , m_stopped(true) |
| 59 , m_ignoreMutedMedia(true) | 59 , m_ignoreMutedMedia(true) |
| 60 , m_state(State::Inactive) | 60 , m_state(State::Inactive) |
| 61 , m_dispatchScheduledEventRunner(this, &MediaRecorder::dispatchScheduledEven
t) | 61 , m_dispatchScheduledEventRunner(this, &MediaRecorder::dispatchScheduledEven
t) |
| 62 { | 62 { |
| 63 ASSERT(m_stream->getTracks().size()); |
| 64 |
| 63 m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler
()); | 65 m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler
()); |
| 64 | 66 ASSERT(m_recorderHandler); |
| 65 // TODO(mcasas): Once http://crbug.com/262211 has landed the Chromium parts, | |
| 66 // and more concretetely the createMediaRecorderHandler() implementation, | |
| 67 // ASSERT() here for |m_recorderHandler|. | |
| 68 | 67 |
| 69 // We deviate from the spec by not returning |UnsupportedOption|, see https:
//github.com/w3c/mediacapture-record/issues/18 | 68 // We deviate from the spec by not returning |UnsupportedOption|, see https:
//github.com/w3c/mediacapture-record/issues/18 |
| 70 if (!m_recorderHandler) { | 69 if (!m_recorderHandler) { |
| 71 exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder ha
ndler can be created."); | 70 exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder ha
ndler can be created."); |
| 72 return; | 71 return; |
| 73 } | 72 } |
| 74 if (!m_recorderHandler->initialize(this, stream->descriptor(), m_mimeType))
{ | 73 if (!m_recorderHandler->initialize(this, stream->descriptor(), m_mimeType))
{ |
| 75 exceptionState.throwDOMException(NotSupportedError, "Failed to initializ
e native MediaRecorder, the type provided " + m_mimeType + "is unsupported." ); | 74 exceptionState.throwDOMException(NotSupportedError, "Failed to initializ
e native MediaRecorder, the type provided " + m_mimeType + "is unsupported." ); |
| 76 return; | 75 return; |
| 77 } | 76 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 282 |
| 284 DEFINE_TRACE(MediaRecorder) | 283 DEFINE_TRACE(MediaRecorder) |
| 285 { | 284 { |
| 286 visitor->trace(m_stream); | 285 visitor->trace(m_stream); |
| 287 visitor->trace(m_scheduledEvents); | 286 visitor->trace(m_scheduledEvents); |
| 288 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi
sitor); | 287 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi
sitor); |
| 289 ActiveDOMObject::trace(visitor); | 288 ActiveDOMObject::trace(visitor); |
| 290 } | 289 } |
| 291 | 290 |
| 292 } // namespace blink | 291 } // namespace blink |
| OLD | NEW |