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

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: 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 4794fb735b3c032c29bcda1e64efdd3ba18c0ce3..90ca5bd784e57b85ac7c25aafec68d7a2f045b03 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 "modules/EventModules.h"
@@ -39,24 +40,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)
@@ -151,20 +152,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)
{
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'.
+ 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] http://w3c.github.io/mediacapture-record/MediaRecorder.html#methods
Peter Beverloo 2015/12/10 20:28:53 nit: the [1] reference is gone
mcasas 2015/12/10 21:40:40 I was probably messing up with the github, I just
- return handler->canSupportMimeType(mimeType) ? "maybe" : emptyString();
+ return handler->canSupportMimeType(type);
}
const AtomicString& MediaRecorder::interfaceName() const

Powered by Google App Engine
This is Rietveld 408576698