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" | |
18 #include <algorithm> | 17 #include <algorithm> |
19 | 18 |
20 namespace blink { | 19 namespace blink { |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 // Boundaries of Opus bitrate from https://www.opus-codec.org/. | 23 // Boundaries of Opus bitrate from https://www.opus-codec.org/. |
25 const int kSmallestPossibleOpusBitRate = 6000; | 24 const int kSmallestPossibleOpusBitRate = 6000; |
26 const int kLargestAutoAllocatedOpusBitRate = 128000; | 25 const int kLargestAutoAllocatedOpusBitRate = 128000; |
27 | 26 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 , m_mimeType(options.mimeType()) | 138 , m_mimeType(options.mimeType()) |
140 , m_stopped(true) | 139 , m_stopped(true) |
141 , m_ignoreMutedMedia(true) | 140 , m_ignoreMutedMedia(true) |
142 , m_audioBitsPerSecond(0) | 141 , m_audioBitsPerSecond(0) |
143 , m_videoBitsPerSecond(0) | 142 , m_videoBitsPerSecond(0) |
144 , m_state(State::Inactive) | 143 , m_state(State::Inactive) |
145 , m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaRecorder>::create(th
is, &MediaRecorder::dispatchScheduledEvent)) | 144 , m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaRecorder>::create(th
is, &MediaRecorder::dispatchScheduledEvent)) |
146 { | 145 { |
147 DCHECK(m_stream->getTracks().size()); | 146 DCHECK(m_stream->getTracks().size()); |
148 | 147 |
149 m_recorderHandler = wrapUnique(Platform::current()->createMediaRecorderHandl
er()); | 148 m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler
()); |
150 DCHECK(m_recorderHandler); | 149 DCHECK(m_recorderHandler); |
151 | 150 |
152 if (!m_recorderHandler) { | 151 if (!m_recorderHandler) { |
153 exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder ha
ndler can be created."); | 152 exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder ha
ndler can be created."); |
154 return; | 153 return; |
155 } | 154 } |
156 | 155 |
157 AllocateVideoAndAudioBitrates(exceptionState, context, options, stream, &m_a
udioBitsPerSecond, &m_videoBitsPerSecond); | 156 AllocateVideoAndAudioBitrates(exceptionState, context, options, stream, &m_a
udioBitsPerSecond, &m_videoBitsPerSecond); |
158 | 157 |
159 const ContentType contentType(m_mimeType); | 158 const ContentType contentType(m_mimeType); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 DEFINE_TRACE(MediaRecorder) | 351 DEFINE_TRACE(MediaRecorder) |
353 { | 352 { |
354 visitor->trace(m_stream); | 353 visitor->trace(m_stream); |
355 visitor->trace(m_dispatchScheduledEventRunner); | 354 visitor->trace(m_dispatchScheduledEventRunner); |
356 visitor->trace(m_scheduledEvents); | 355 visitor->trace(m_scheduledEvents); |
357 EventTargetWithInlineData::trace(visitor); | 356 EventTargetWithInlineData::trace(visitor); |
358 ActiveDOMObject::trace(visitor); | 357 ActiveDOMObject::trace(visitor); |
359 } | 358 } |
360 | 359 |
361 } // namespace blink | 360 } // namespace blink |
OLD | NEW |