Chromium Code Reviews| Index: Source/modules/mediarecorder/MediaRecorder.cpp |
| diff --git a/Source/modules/mediarecorder/MediaRecorder.cpp b/Source/modules/mediarecorder/MediaRecorder.cpp |
| index 3183ca6005282f21e176fabf76c8c5c3bf8d7d43..59675b88a56281cfaa972a212e48ec900ce7ec25 100644 |
| --- a/Source/modules/mediarecorder/MediaRecorder.cpp |
| +++ b/Source/modules/mediarecorder/MediaRecorder.cpp |
| @@ -9,6 +9,7 @@ |
| #include "core/fileapi/Blob.h" |
| #include "modules/EventModules.h" |
| #include "modules/EventTargetModules.h" |
| +#include "modules/mediarecorder/BlobEvent.h" |
| #include "modules/mediarecorder/MediaRecorderErrorEvent.h" |
| #include "platform/NotImplemented.h" |
| #include "platform/blob/BlobData.h" |
| @@ -152,7 +153,7 @@ void MediaRecorder::requestData(ExceptionState& exceptionState) |
| return; |
| } |
| - createBlobEvent(BlobData::create()); |
| + createBlobEvent(nullptr, 0); |
| } |
| String MediaRecorder::canRecordMimeType(const String& mimeType) |
| @@ -205,17 +206,13 @@ void MediaRecorder::stop() |
| void MediaRecorder::writeData(const char* data, size_t length, bool lastInSlice) |
| { |
| - if (!lastInSlice && m_stopped) { |
| + if (m_stopped) { |
| m_stopped = false; |
| scheduleDispatchEvent(Event::create(EventTypeNames::start)); |
| } |
| // TODO(mcasas): Act as |m_ignoredMutedMedia| instructs if |m_stream| track(s) is in muted() state. |
| - // TODO(mcasas): Use |lastInSlice| to indicate to JS that recording is done. |
| - |
| - OwnPtr<BlobData> blobData = BlobData::create(); |
| - blobData->appendBytes(data, length); |
| - createBlobEvent(blobData.release()); |
| + createBlobEvent(data, length); |
| } |
| void MediaRecorder::failOutOfMemory(const WebString& message) |
| @@ -245,10 +242,12 @@ void MediaRecorder::failOtherRecordingError(const WebString& message) |
| stopRecording(); |
| } |
| -void MediaRecorder::createBlobEvent(PassOwnPtr<BlobData> blobData) |
| +void MediaRecorder::createBlobEvent(const char* data, size_t length) |
|
Peter Beverloo
2015/09/18 13:07:26
Out of interest, why do you find passing |data| an
mcasas
2015/09/21 15:24:15
Hmm this is just hanging around from the experimen
|
| { |
| // TODO(mcasas): Launch a BlobEvent when that class is landed, but also see https://github.com/w3c/mediacapture-record/issues/17. |
|
Peter Beverloo
2015/09/18 13:07:26
This TODO is now redundant.
mcasas
2015/09/21 15:24:15
Rephrased.
|
| - notImplemented(); |
| + OwnPtr<BlobData> blobData = BlobData::create(); |
| + blobData->appendBytes(data, length); |
| + scheduleDispatchEvent(BlobEvent::create(EventTypeNames::dataavailable, false, false, Blob::create(BlobDataHandle::create(blobData.release(), length)))); |
| } |
| void MediaRecorder::stopRecording() |
| @@ -258,7 +257,7 @@ void MediaRecorder::stopRecording() |
| m_recorderHandler->stop(); |
| - createBlobEvent(BlobData::create()); |
| + createBlobEvent(nullptr, 0); |
| scheduleDispatchEvent(Event::create(EventTypeNames::stop)); |
| } |