Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp

Issue 1540303003: MediaRecorder: update to spec (3/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reverted DEPS to master Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "core/dom/DOMError.h" 9 #include "core/events/Event.h"
10 #include "core/fileapi/Blob.h" 10 #include "core/fileapi/Blob.h"
11 #include "modules/EventModules.h"
12 #include "modules/EventTargetModules.h" 11 #include "modules/EventTargetModules.h"
13 #include "modules/mediarecorder/BlobEvent.h" 12 #include "modules/mediarecorder/BlobEvent.h"
14 #include "modules/mediarecorder/MediaRecorderErrorEvent.h"
15 #include "platform/ContentType.h" 13 #include "platform/ContentType.h"
16 #include "platform/NotImplemented.h" 14 #include "platform/NotImplemented.h"
17 #include "platform/blob/BlobData.h" 15 #include "platform/blob/BlobData.h"
18 #include "public/platform/Platform.h" 16 #include "public/platform/Platform.h"
19 #include "public/platform/WebMediaStream.h" 17 #include "public/platform/WebMediaStream.h"
20 18
21 namespace blink { 19 namespace blink {
22 20
23 namespace { 21 namespace {
24 22
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 m_blobData->appendBytes(data, length); 215 m_blobData->appendBytes(data, length);
218 216
219 if (!lastInSlice) 217 if (!lastInSlice)
220 return; 218 return;
221 219
222 // Cache |m_blobData->length()| before release()ng it. 220 // Cache |m_blobData->length()| before release()ng it.
223 const long long blobDataLength = m_blobData->length(); 221 const long long blobDataLength = m_blobData->length();
224 createBlobEvent(Blob::create(BlobDataHandle::create(m_blobData.release(), bl obDataLength))); 222 createBlobEvent(Blob::create(BlobDataHandle::create(m_blobData.release(), bl obDataLength)));
225 } 223 }
226 224
227 void MediaRecorder::failOutOfMemory(const WebString& message) 225 void MediaRecorder::onError(const WebString& message)
228 { 226 {
229 scheduleDispatchEvent(MediaRecorderErrorEvent::create( 227 // TODO(mcasas): Beef up the Error Event and add the |message|, see https:// github.com/w3c/mediacapture-record/issues/31
230 EventTypeNames::error, false, false, "OutOfMemory", message)); 228 scheduleDispatchEvent(Event::create(EventTypeNames::error));
231 229
232 if (m_state == State::Recording) 230 if (m_state == State::Recording)
233 stopRecording(); 231 stopRecording();
234 }
235
236 void MediaRecorder::failIllegalStreamModification(const WebString& message)
237 {
238 scheduleDispatchEvent(MediaRecorderErrorEvent::create(
239 EventTypeNames::error, false, false, "IllegalStreamModification", messag e));
240
241 if (m_state == State::Recording)
242 stopRecording();
243 }
244
245 void MediaRecorder::failOtherRecordingError(const WebString& message)
246 {
247 scheduleDispatchEvent(MediaRecorderErrorEvent::create(
248 EventTypeNames::error, false, false, "OtherRecordingError", message));
249
250 if (m_state == State::Recording)
251 stopRecording();
252 } 232 }
253 233
254 void MediaRecorder::createBlobEvent(Blob* blob) 234 void MediaRecorder::createBlobEvent(Blob* blob)
255 { 235 {
256 // TODO(mcasas): Consider launching an Event with a TypedArray inside, see h ttps://github.com/w3c/mediacapture-record/issues/17. 236 // TODO(mcasas): Consider launching an Event with a TypedArray inside, see h ttps://github.com/w3c/mediacapture-record/issues/17.
257 scheduleDispatchEvent(BlobEvent::create(EventTypeNames::dataavailable, blob) ); 237 scheduleDispatchEvent(BlobEvent::create(EventTypeNames::dataavailable, blob) );
258 } 238 }
259 239
260 void MediaRecorder::stopRecording() 240 void MediaRecorder::stopRecording()
261 { 241 {
(...skipping 24 matching lines...) Expand all
286 266
287 DEFINE_TRACE(MediaRecorder) 267 DEFINE_TRACE(MediaRecorder)
288 { 268 {
289 visitor->trace(m_stream); 269 visitor->trace(m_stream);
290 visitor->trace(m_scheduledEvents); 270 visitor->trace(m_scheduledEvents);
291 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi sitor); 271 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi sitor);
292 ActiveDOMObject::trace(visitor); 272 ActiveDOMObject::trace(visitor);
293 } 273 }
294 274
295 } // namespace blink 275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698