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

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

Issue 2207613003: MediaRecorder: add mime type to recorded blobs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-requestData.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4d415e037144b1782a40ef9da17f3d794897f129..406d8aa248889b171946e48868deb992dd678f84 100644
--- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
+++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -21,6 +21,8 @@ namespace blink {
namespace {
+const char* kDefaultMimeType = "video/webm";
+
// Boundaries of Opus bitrate from https://www.opus-codec.org/.
const int kSmallestPossibleOpusBitRate = 6000;
const int kLargestAutoAllocatedOpusBitRate = 128000;
@@ -136,7 +138,7 @@ MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, con
, ActiveDOMObject(context)
, m_stream(stream)
, m_streamAmountOfTracks(stream->getTracks().size())
- , m_mimeType(options.mimeType())
+ , m_mimeType(options.hasMimeType() ? options.mimeType() : kDefaultMimeType)
, m_stopped(true)
, m_ignoreMutedMedia(true)
, m_audioBitsPerSecond(0)
@@ -297,8 +299,10 @@ void MediaRecorder::writeData(const char* data, size_t length, bool lastInSlice)
// TODO(mcasas): Act as |m_ignoredMutedMedia| instructs if |m_stream| track(s) is in muted() state.
- if (!m_blobData)
+ if (!m_blobData) {
m_blobData = BlobData::create();
+ m_blobData->setContentType(m_mimeType);
+ }
if (data)
m_blobData->appendBytes(data, length);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-requestData.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698