Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef MediaStreamSource_h | 32 #ifndef MediaStreamSource_h |
| 33 #define MediaStreamSource_h | 33 #define MediaStreamSource_h |
| 34 | 34 |
| 35 #include "platform/PlatformExport.h" | 35 #include "platform/PlatformExport.h" |
| 36 #include "platform/audio/AudioDestinationConsumer.h" | 36 #include "platform/audio/AudioDestinationConsumer.h" |
| 37 #include "public/platform/WebMediaConstraints.h" | 37 #include "public/platform/WebMediaConstraints.h" |
| 38 #include "public/platform/WebMediaStreamTrack.h" | |
| 38 #include "wtf/Allocator.h" | 39 #include "wtf/Allocator.h" |
| 39 #include "wtf/ThreadingPrimitives.h" | 40 #include "wtf/ThreadingPrimitives.h" |
| 40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 41 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 42 #include <memory> | 43 #include <memory> |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class PLATFORM_EXPORT MediaStreamSource final | 47 class PLATFORM_EXPORT MediaStreamSource final |
| 47 : public GarbageCollectedFinalized<MediaStreamSource> { | 48 : public GarbageCollectedFinalized<MediaStreamSource> { |
| 48 public: | 49 public: |
| 49 class PLATFORM_EXPORT Observer : public GarbageCollectedMixin { | 50 class PLATFORM_EXPORT Observer : public GarbageCollectedMixin { |
| 50 public: | 51 public: |
| 51 virtual ~Observer() {} | 52 virtual ~Observer() {} |
| 52 virtual void sourceChangedState() = 0; | 53 virtual void sourceChangedState() = 0; |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 class ExtraData { | 56 class ExtraData { |
|
Guido Urdaneta
2017/01/19 15:28:06
nit: Maybe rename to SourceData, as it was done wi
| |
| 56 USING_FAST_MALLOC(ExtraData); | 57 USING_FAST_MALLOC(ExtraData); |
| 57 | 58 |
| 58 public: | 59 public: |
| 59 virtual ~ExtraData() {} | 60 virtual ~ExtraData() {} |
| 61 virtual void getSettings(WebMediaStreamTrack::Settings&) = 0; | |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 enum StreamType { TypeAudio, TypeVideo }; | 64 enum StreamType { TypeAudio, TypeVideo }; |
| 63 | 65 |
| 64 enum ReadyState { | 66 enum ReadyState { |
| 65 ReadyStateLive = 0, | 67 ReadyStateLive = 0, |
| 66 ReadyStateMuted = 1, | 68 ReadyStateMuted = 1, |
| 67 ReadyStateEnded = 2 | 69 ReadyStateEnded = 2 |
| 68 }; | 70 }; |
| 69 | 71 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 86 | 88 |
| 87 ExtraData* getExtraData() const { return m_extraData.get(); } | 89 ExtraData* getExtraData() const { return m_extraData.get(); } |
| 88 void setExtraData(std::unique_ptr<ExtraData> extraData) { | 90 void setExtraData(std::unique_ptr<ExtraData> extraData) { |
| 89 m_extraData = std::move(extraData); | 91 m_extraData = std::move(extraData); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void setConstraints(WebMediaConstraints constraints) { | 94 void setConstraints(WebMediaConstraints constraints) { |
| 93 m_constraints = constraints; | 95 m_constraints = constraints; |
| 94 } | 96 } |
| 95 WebMediaConstraints constraints() { return m_constraints; } | 97 WebMediaConstraints constraints() { return m_constraints; } |
| 98 void getSettings(WebMediaStreamTrack::Settings&); | |
| 96 | 99 |
| 97 void setAudioFormat(size_t numberOfChannels, float sampleRate); | 100 void setAudioFormat(size_t numberOfChannels, float sampleRate); |
| 98 void consumeAudio(AudioBus*, size_t numberOfFrames); | 101 void consumeAudio(AudioBus*, size_t numberOfFrames); |
| 99 | 102 |
| 100 bool requiresAudioConsumer() const { return m_requiresConsumer; } | 103 bool requiresAudioConsumer() const { return m_requiresConsumer; } |
| 101 void addAudioConsumer(AudioDestinationConsumer*); | 104 void addAudioConsumer(AudioDestinationConsumer*); |
| 102 bool removeAudioConsumer(AudioDestinationConsumer*); | 105 bool removeAudioConsumer(AudioDestinationConsumer*); |
| 103 const HeapHashSet<Member<AudioDestinationConsumer>>& audioConsumers() { | 106 const HeapHashSet<Member<AudioDestinationConsumer>>& audioConsumers() { |
| 104 return m_audioConsumers; | 107 return m_audioConsumers; |
| 105 } | 108 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 129 HeapHashSet<Member<AudioDestinationConsumer>> m_audioConsumers; | 132 HeapHashSet<Member<AudioDestinationConsumer>> m_audioConsumers; |
| 130 std::unique_ptr<ExtraData> m_extraData; | 133 std::unique_ptr<ExtraData> m_extraData; |
| 131 WebMediaConstraints m_constraints; | 134 WebMediaConstraints m_constraints; |
| 132 }; | 135 }; |
| 133 | 136 |
| 134 typedef HeapVector<Member<MediaStreamSource>> MediaStreamSourceVector; | 137 typedef HeapVector<Member<MediaStreamSource>> MediaStreamSourceVector; |
| 135 | 138 |
| 136 } // namespace blink | 139 } // namespace blink |
| 137 | 140 |
| 138 #endif // MediaStreamSource_h | 141 #endif // MediaStreamSource_h |
| OLD | NEW |