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

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: Created 4 years, 12 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::failOutOfMemory(const WebString& message)
Peter Beverloo 2015/12/22 11:59:35 A few thoughts: (1) I think it's unfortunate th
mcasas 2015/12/22 20:24:40 It is, I filed corresponding issues to track this
228 { 226 {
229 scheduleDispatchEvent(MediaRecorderErrorEvent::create( 227 scheduleDispatchEvent(Event::create(EventTypeNames::error));
230 EventTypeNames::error, false, false, "OutOfMemory", message));
231 228
232 if (m_state == State::Recording) 229 if (m_state == State::Recording)
233 stopRecording(); 230 stopRecording();
234 } 231 }
235 232
236 void MediaRecorder::failIllegalStreamModification(const WebString& message) 233 void MediaRecorder::failIllegalStreamModification(const WebString& message)
237 { 234 {
238 scheduleDispatchEvent(MediaRecorderErrorEvent::create( 235 scheduleDispatchEvent(Event::create(EventTypeNames::error));
239 EventTypeNames::error, false, false, "IllegalStreamModification", messag e));
240 236
241 if (m_state == State::Recording) 237 if (m_state == State::Recording)
242 stopRecording(); 238 stopRecording();
243 } 239 }
244 240
245 void MediaRecorder::failOtherRecordingError(const WebString& message) 241 void MediaRecorder::failOtherRecordingError(const WebString& message)
246 { 242 {
247 scheduleDispatchEvent(MediaRecorderErrorEvent::create( 243 scheduleDispatchEvent(Event::create(EventTypeNames::error));
248 EventTypeNames::error, false, false, "OtherRecordingError", message));
249 244
250 if (m_state == State::Recording) 245 if (m_state == State::Recording)
251 stopRecording(); 246 stopRecording();
252 } 247 }
253 248
254 void MediaRecorder::createBlobEvent(Blob* blob) 249 void MediaRecorder::createBlobEvent(Blob* blob)
255 { 250 {
256 // TODO(mcasas): Consider launching an Event with a TypedArray inside, see h ttps://github.com/w3c/mediacapture-record/issues/17. 251 // 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) ); 252 scheduleDispatchEvent(BlobEvent::create(EventTypeNames::dataavailable, blob) );
258 } 253 }
(...skipping 27 matching lines...) Expand all
286 281
287 DEFINE_TRACE(MediaRecorder) 282 DEFINE_TRACE(MediaRecorder)
288 { 283 {
289 visitor->trace(m_stream); 284 visitor->trace(m_stream);
290 visitor->trace(m_scheduledEvents); 285 visitor->trace(m_scheduledEvents);
291 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi sitor); 286 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi sitor);
292 ActiveDOMObject::trace(visitor); 287 ActiveDOMObject::trace(visitor);
293 } 288 }
294 289
295 } // namespace blink 290 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698