| 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 #ifndef MediaRecorder_h | 5 #ifndef MediaRecorder_h |
| 6 #define MediaRecorder_h | 6 #define MediaRecorder_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "core/dom/SuspendableObject.h" | 9 #include "core/dom/SuspendableObject.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 static MediaRecorder* create(ExecutionContext*, | 40 static MediaRecorder* create(ExecutionContext*, |
| 41 MediaStream*, | 41 MediaStream*, |
| 42 const MediaRecorderOptions&, | 42 const MediaRecorderOptions&, |
| 43 ExceptionState&); | 43 ExceptionState&); |
| 44 | 44 |
| 45 virtual ~MediaRecorder() {} | 45 virtual ~MediaRecorder() {} |
| 46 | 46 |
| 47 MediaStream* stream() const { return m_stream.get(); } | 47 MediaStream* stream() const { return m_stream.get(); } |
| 48 const String& mimeType() const { return m_mimeType; } | 48 const String& mimeType() const { return m_mimeType; } |
| 49 String state() const; | 49 String state() const; |
| 50 bool ignoreMutedMedia() const { return m_ignoreMutedMedia; } | |
| 51 void setIgnoreMutedMedia(bool ignoreMutedMedia) { | |
| 52 m_ignoreMutedMedia = ignoreMutedMedia; | |
| 53 } | |
| 54 unsigned long videoBitsPerSecond() const { return m_videoBitsPerSecond; } | 50 unsigned long videoBitsPerSecond() const { return m_videoBitsPerSecond; } |
| 55 unsigned long audioBitsPerSecond() const { return m_audioBitsPerSecond; } | 51 unsigned long audioBitsPerSecond() const { return m_audioBitsPerSecond; } |
| 56 | 52 |
| 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); | 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); |
| 58 DEFINE_ATTRIBUTE_EVENT_LISTENER(stop); | 54 DEFINE_ATTRIBUTE_EVENT_LISTENER(stop); |
| 59 DEFINE_ATTRIBUTE_EVENT_LISTENER(dataavailable); | 55 DEFINE_ATTRIBUTE_EVENT_LISTENER(dataavailable); |
| 60 DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); | 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); |
| 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(resume); | 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(resume); |
| 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 58 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 63 | 59 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 76 | 72 |
| 77 // SuspendableObject | 73 // SuspendableObject |
| 78 void suspend() override; | 74 void suspend() override; |
| 79 void resume() override; | 75 void resume() override; |
| 80 void contextDestroyed() override; | 76 void contextDestroyed() override; |
| 81 | 77 |
| 82 // ScriptWrappable | 78 // ScriptWrappable |
| 83 bool hasPendingActivity() const final { return !m_stopped; } | 79 bool hasPendingActivity() const final { return !m_stopped; } |
| 84 | 80 |
| 85 // WebMediaRecorderHandlerClient | 81 // WebMediaRecorderHandlerClient |
| 86 void writeData(const char* data, size_t length, bool lastInSlice) override; | 82 void writeData(const char* data, |
| 83 size_t length, |
| 84 bool lastInSlice, |
| 85 double timecode) override; |
| 87 void onError(const WebString& message) override; | 86 void onError(const WebString& message) override; |
| 88 | 87 |
| 89 DECLARE_VIRTUAL_TRACE(); | 88 DECLARE_VIRTUAL_TRACE(); |
| 90 | 89 |
| 91 private: | 90 private: |
| 92 MediaRecorder(ExecutionContext*, | 91 MediaRecorder(ExecutionContext*, |
| 93 MediaStream*, | 92 MediaStream*, |
| 94 const MediaRecorderOptions&, | 93 const MediaRecorderOptions&, |
| 95 ExceptionState&); | 94 ExceptionState&); |
| 96 | 95 |
| 97 void createBlobEvent(Blob*); | 96 void createBlobEvent(Blob*, double); |
| 98 | 97 |
| 99 void stopRecording(); | 98 void stopRecording(); |
| 100 void scheduleDispatchEvent(Event*); | 99 void scheduleDispatchEvent(Event*); |
| 101 void dispatchScheduledEvent(); | 100 void dispatchScheduledEvent(); |
| 102 | 101 |
| 103 Member<MediaStream> m_stream; | 102 Member<MediaStream> m_stream; |
| 104 size_t m_streamAmountOfTracks; | 103 size_t m_streamAmountOfTracks; |
| 105 String m_mimeType; | 104 String m_mimeType; |
| 106 bool m_stopped; | 105 bool m_stopped; |
| 107 bool m_ignoreMutedMedia; | |
| 108 int m_audioBitsPerSecond; | 106 int m_audioBitsPerSecond; |
| 109 int m_videoBitsPerSecond; | 107 int m_videoBitsPerSecond; |
| 110 | 108 |
| 111 State m_state; | 109 State m_state; |
| 112 | 110 |
| 113 std::unique_ptr<BlobData> m_blobData; | 111 std::unique_ptr<BlobData> m_blobData; |
| 114 | 112 |
| 115 std::unique_ptr<WebMediaRecorderHandler> m_recorderHandler; | 113 std::unique_ptr<WebMediaRecorderHandler> m_recorderHandler; |
| 116 | 114 |
| 117 Member<AsyncMethodRunner<MediaRecorder>> m_dispatchScheduledEventRunner; | 115 Member<AsyncMethodRunner<MediaRecorder>> m_dispatchScheduledEventRunner; |
| 118 HeapVector<Member<Event>> m_scheduledEvents; | 116 HeapVector<Member<Event>> m_scheduledEvents; |
| 119 }; | 117 }; |
| 120 | 118 |
| 121 } // namespace blink | 119 } // namespace blink |
| 122 | 120 |
| 123 #endif // MediaRecorder_h | 121 #endif // MediaRecorder_h |
| OLD | NEW |