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

Unified Diff: third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp

Issue 1507183002: MediaRecorder: update to spec (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased to http://crrev.com/1497883002 (just landed) Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
index d84100f9a9833c78e507ddaa57471df3f2888181..767bac623260d947345c21a5960ccbc531ed4c8f 100644
--- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
+++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -5,6 +5,7 @@
#include "config.h"
#include "modules/mediarecorder/MediaRecorder.h"
+#include "bindings/core/v8/Dictionary.h"
#include "core/dom/DOMError.h"
#include "core/fileapi/Blob.h"
#include "core/frame/ConsoleTypes.h"
@@ -41,24 +42,24 @@ String stateToString(MediaRecorder::State state)
MediaRecorder* MediaRecorder::create(ExecutionContext* context, MediaStream* stream, ExceptionState& exceptionState)
{
- MediaRecorder* recorder = new MediaRecorder(context, stream, String(), exceptionState);
+ MediaRecorder* recorder = new MediaRecorder(context, stream, MediaRecorderOptions(), exceptionState);
recorder->suspendIfNeeded();
return recorder;
}
-MediaRecorder* MediaRecorder::create(ExecutionContext* context, MediaStream* stream, const String& mimeType, ExceptionState& exceptionState)
+MediaRecorder* MediaRecorder::create(ExecutionContext* context, MediaStream* stream, const MediaRecorderOptions& options, ExceptionState& exceptionState)
{
- MediaRecorder* recorder = new MediaRecorder(context, stream, mimeType, exceptionState);
+ MediaRecorder* recorder = new MediaRecorder(context, stream, options, exceptionState);
recorder->suspendIfNeeded();
return recorder;
}
-MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, const String& mimeType, ExceptionState& exceptionState)
+MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, const MediaRecorderOptions& options, ExceptionState& exceptionState)
: ActiveDOMObject(context)
, m_stream(stream)
- , m_mimeType(mimeType)
+ , m_mimeType(options.mimeType())
, m_stopped(true)
, m_ignoreMutedMedia(true)
, m_state(State::Inactive)
@@ -158,20 +159,18 @@ void MediaRecorder::requestData(ExceptionState& exceptionState)
writeData(nullptr /* data */, 0 /* length */, true /* lastInSlice */);
}
-String MediaRecorder::canRecordMimeType(const String& mimeType)
+bool MediaRecorder::isTypeSupported(const String& type)
philipj_slow 2015/12/11 08:29:03 Can you use this in the constructor, where the "th
philipj_slow 2015/12/18 20:18:10 I've filed https://code.google.com/p/chromium/issu
{
RawPtr<WebMediaRecorderHandler> handler = Platform::current()->createMediaRecorderHandler();
if (!handler)
- return emptyString();
-
- // MediaRecorder canRecordMimeType() MUST return 'probably' "if the UA is
- // confident that mimeType represents a type that it can record" [1], but a
- // number of reasons could prevent the recording from happening as expected,
- // so 'maybe' is a better option: "Implementors are encouraged to return
- // "maybe" unless the type can be confidently established as being supported
- // or not.". Hence this method returns '' or 'maybe', never 'probably'.
- // [1] http://w3c.github.io/mediacapture-record/MediaRecorder.html#methods
- return handler->canSupportMimeType(mimeType) ? "maybe" : emptyString();
+ return false;
+
+ // If true is returned from this method, it only indicates that the
+ // MediaRecorder implementation is capable of recording Blob objects for the
+ // specified MIME type. Recording may still fail if sufficient resources are
+ // not available to support the concrete media encoding.
+ // [1] https://w3c.github.io/mediacapture-record/MediaRecorder.html#methods
+ return handler->canSupportMimeType(type);
}
const AtomicString& MediaRecorder::interfaceName() const

Powered by Google App Engine
This is Rietveld 408576698