OLD | NEW |
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" |
11 #include "modules/EventTargetModules.h" | 11 #include "modules/EventTargetModules.h" |
12 #include "modules/mediarecorder/BlobEvent.h" | 12 #include "modules/mediarecorder/BlobEvent.h" |
13 #include "platform/ContentType.h" | 13 #include "platform/ContentType.h" |
14 #include "platform/blob/BlobData.h" | 14 #include "platform/blob/BlobData.h" |
15 #include "public/platform/Platform.h" | 15 #include "public/platform/Platform.h" |
16 #include "public/platform/WebMediaStream.h" | 16 #include "public/platform/WebMediaStream.h" |
17 #include "wtf/PtrUtil.h" | 17 #include "wtf/PtrUtil.h" |
18 #include <algorithm> | 18 #include <algorithm> |
| 19 #include <limits> |
19 | 20 |
20 namespace blink { | 21 namespace blink { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 const char* kDefaultMimeType = "video/webm"; | 25 const char* kDefaultMimeType = "video/webm"; |
25 | 26 |
26 // Boundaries of Opus bitrate from https://www.opus-codec.org/. | 27 // Boundaries of Opus bitrate from https://www.opus-codec.org/. |
27 const int kSmallestPossibleOpusBitRate = 6000; | 28 const int kSmallestPossibleOpusBitRate = 6000; |
28 const int kLargestAutoAllocatedOpusBitRate = 128000; | 29 const int kLargestAutoAllocatedOpusBitRate = 128000; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return; | 200 return; |
200 } | 201 } |
201 m_stopped = false; | 202 m_stopped = false; |
202 } | 203 } |
203 | 204 |
204 String MediaRecorder::state() const { | 205 String MediaRecorder::state() const { |
205 return stateToString(m_state); | 206 return stateToString(m_state); |
206 } | 207 } |
207 | 208 |
208 void MediaRecorder::start(ExceptionState& exceptionState) { | 209 void MediaRecorder::start(ExceptionState& exceptionState) { |
209 start(0 /* timeSlice */, exceptionState); | 210 start(std::numeric_limits<int>::max() /* timeSlice */, exceptionState); |
210 } | 211 } |
211 | 212 |
212 void MediaRecorder::start(int timeSlice, ExceptionState& exceptionState) { | 213 void MediaRecorder::start(int timeSlice, ExceptionState& exceptionState) { |
213 if (m_state != State::Inactive) { | 214 if (m_state != State::Inactive) { |
214 exceptionState.throwDOMException( | 215 exceptionState.throwDOMException( |
215 InvalidStateError, | 216 InvalidStateError, |
216 "The MediaRecorder's state is '" + stateToString(m_state) + "'."); | 217 "The MediaRecorder's state is '" + stateToString(m_state) + "'."); |
217 return; | 218 return; |
218 } | 219 } |
219 m_state = State::Recording; | 220 m_state = State::Recording; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 393 |
393 DEFINE_TRACE(MediaRecorder) { | 394 DEFINE_TRACE(MediaRecorder) { |
394 visitor->trace(m_stream); | 395 visitor->trace(m_stream); |
395 visitor->trace(m_dispatchScheduledEventRunner); | 396 visitor->trace(m_dispatchScheduledEventRunner); |
396 visitor->trace(m_scheduledEvents); | 397 visitor->trace(m_scheduledEvents); |
397 EventTargetWithInlineData::trace(visitor); | 398 EventTargetWithInlineData::trace(visitor); |
398 ActiveDOMObject::trace(visitor); | 399 ActiveDOMObject::trace(visitor); |
399 } | 400 } |
400 | 401 |
401 } // namespace blink | 402 } // namespace blink |
OLD | NEW |