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

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

Issue 1652373004: MediaRecorder: add and wire read {video,audio}BitsPerSecond props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reviewers@ comments Created 4 years, 10 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 "modules/mediarecorder/MediaRecorder.h" 5 #include "modules/mediarecorder/MediaRecorder.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "core/events/Event.h" 8 #include "core/events/Event.h"
9 #include "core/fileapi/Blob.h" 9 #include "core/fileapi/Blob.h"
10 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return recorder; 133 return recorder;
134 } 134 }
135 135
136 MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, con st MediaRecorderOptions& options, ExceptionState& exceptionState) 136 MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, con st MediaRecorderOptions& options, ExceptionState& exceptionState)
137 : ActiveDOMObject(context) 137 : ActiveDOMObject(context)
138 , m_stream(stream) 138 , m_stream(stream)
139 , m_streamAmountOfTracks(stream->getTracks().size()) 139 , m_streamAmountOfTracks(stream->getTracks().size())
140 , m_mimeType(options.mimeType()) 140 , m_mimeType(options.mimeType())
141 , m_stopped(true) 141 , m_stopped(true)
142 , m_ignoreMutedMedia(true) 142 , m_ignoreMutedMedia(true)
143 , m_audioBitsPerSecond(0)
144 , m_videoBitsPerSecond(0)
143 , m_state(State::Inactive) 145 , m_state(State::Inactive)
144 , m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaRecorder>::create(th is, &MediaRecorder::dispatchScheduledEvent)) 146 , m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaRecorder>::create(th is, &MediaRecorder::dispatchScheduledEvent))
145 { 147 {
146 ASSERT(m_stream->getTracks().size()); 148 ASSERT(m_stream->getTracks().size());
147 149
148 m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler ()); 150 m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler ());
149 ASSERT(m_recorderHandler); 151 ASSERT(m_recorderHandler);
150 152
151 if (!m_recorderHandler) { 153 if (!m_recorderHandler) {
152 exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder ha ndler can be created."); 154 exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder ha ndler can be created.");
153 return; 155 return;
154 } 156 }
155 157
156 int32_t audioBitsPerSecond = 0; 158 AllocateVideoAndAudioBitrates(exceptionState, context, options, stream, &m_a udioBitsPerSecond, &m_videoBitsPerSecond);
157 int32_t videoBitsPerSecond = 0;
158 AllocateVideoAndAudioBitrates(exceptionState, context, options, stream, &aud ioBitsPerSecond, &videoBitsPerSecond);
159 159
160 const ContentType contentType(m_mimeType); 160 const ContentType contentType(m_mimeType);
161 if (!m_recorderHandler->initialize(this, stream->descriptor(), contentType.t ype(), contentType.parameter("codecs"), audioBitsPerSecond, videoBitsPerSecond)) { 161 if (!m_recorderHandler->initialize(this, stream->descriptor(), contentType.t ype(), contentType.parameter("codecs"), m_audioBitsPerSecond, m_videoBitsPerSeco nd)) {
philipj_slow 2016/02/03 03:31:05 Assuming that the internal representation isn't un
162 exceptionState.throwDOMException(NotSupportedError, "Failed to initializ e native MediaRecorder the type provided (" + m_mimeType + ") is not supported." ); 162 exceptionState.throwDOMException(NotSupportedError, "Failed to initializ e native MediaRecorder the type provided (" + m_mimeType + ") is not supported." );
163 return; 163 return;
164 } 164 }
165 m_stopped = false; 165 m_stopped = false;
166 } 166 }
167 167
168 String MediaRecorder::state() const 168 String MediaRecorder::state() const
169 { 169 {
170 return stateToString(m_state); 170 return stateToString(m_state);
171 } 171 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 DEFINE_TRACE(MediaRecorder) 353 DEFINE_TRACE(MediaRecorder)
354 { 354 {
355 visitor->trace(m_stream); 355 visitor->trace(m_stream);
356 visitor->trace(m_dispatchScheduledEventRunner); 356 visitor->trace(m_dispatchScheduledEventRunner);
357 visitor->trace(m_scheduledEvents); 357 visitor->trace(m_scheduledEvents);
358 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi sitor); 358 RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder>::trace(vi sitor);
359 ActiveDOMObject::trace(visitor); 359 ActiveDOMObject::trace(visitor);
360 } 360 }
361 361
362 } // namespace blink 362 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698