| 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 15 matching lines...) Expand all Loading... |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 <memory> | 35 #include <memory> |
| 36 #include <utility> |
| 37 |
| 36 #include "platform/PlatformExport.h" | 38 #include "platform/PlatformExport.h" |
| 37 #include "platform/audio/AudioDestinationConsumer.h" | 39 #include "platform/audio/AudioDestinationConsumer.h" |
| 38 #include "platform/wtf/Allocator.h" | 40 #include "platform/wtf/Allocator.h" |
| 41 #include "platform/wtf/Optional.h" |
| 39 #include "platform/wtf/ThreadingPrimitives.h" | 42 #include "platform/wtf/ThreadingPrimitives.h" |
| 40 #include "platform/wtf/Vector.h" | 43 #include "platform/wtf/Vector.h" |
| 41 #include "platform/wtf/text/WTFString.h" | 44 #include "platform/wtf/text/WTFString.h" |
| 42 #include "public/platform/WebMediaConstraints.h" | 45 #include "public/platform/WebMediaConstraints.h" |
| 43 #include "public/platform/WebMediaStreamTrack.h" | 46 #include "public/platform/WebMediaStreamTrack.h" |
| 44 | 47 |
| 45 namespace blink { | 48 namespace blink { |
| 46 | 49 |
| 47 class PLATFORM_EXPORT MediaStreamSource final | 50 class PLATFORM_EXPORT MediaStreamSource final |
| 48 : public GarbageCollectedFinalized<MediaStreamSource> { | 51 : public GarbageCollectedFinalized<MediaStreamSource> { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void SetReadyState(ReadyState); | 86 void SetReadyState(ReadyState); |
| 84 ReadyState GetReadyState() const { return ready_state_; } | 87 ReadyState GetReadyState() const { return ready_state_; } |
| 85 | 88 |
| 86 void AddObserver(Observer*); | 89 void AddObserver(Observer*); |
| 87 | 90 |
| 88 ExtraData* GetExtraData() const { return extra_data_.get(); } | 91 ExtraData* GetExtraData() const { return extra_data_.get(); } |
| 89 void SetExtraData(std::unique_ptr<ExtraData> extra_data) { | 92 void SetExtraData(std::unique_ptr<ExtraData> extra_data) { |
| 90 extra_data_ = std::move(extra_data); | 93 extra_data_ = std::move(extra_data); |
| 91 } | 94 } |
| 92 | 95 |
| 96 void SetEchoCancellation(bool echo_cancellation) { |
| 97 echo_cancellation_ = WTF::make_optional(echo_cancellation); |
| 98 } |
| 99 |
| 93 void SetConstraints(WebMediaConstraints constraints) { | 100 void SetConstraints(WebMediaConstraints constraints) { |
| 94 constraints_ = constraints; | 101 constraints_ = constraints; |
| 95 } | 102 } |
| 96 WebMediaConstraints Constraints() { return constraints_; } | 103 WebMediaConstraints Constraints() { return constraints_; } |
| 97 void GetSettings(WebMediaStreamTrack::Settings&); | 104 void GetSettings(WebMediaStreamTrack::Settings&); |
| 98 | 105 |
| 99 void SetAudioFormat(size_t number_of_channels, float sample_rate); | 106 void SetAudioFormat(size_t number_of_channels, float sample_rate); |
| 100 void ConsumeAudio(AudioBus*, size_t number_of_frames); | 107 void ConsumeAudio(AudioBus*, size_t number_of_frames); |
| 101 | 108 |
| 102 bool RequiresAudioConsumer() const { return requires_consumer_; } | 109 bool RequiresAudioConsumer() const { return requires_consumer_; } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 124 StreamType type_; | 131 StreamType type_; |
| 125 String name_; | 132 String name_; |
| 126 bool remote_; | 133 bool remote_; |
| 127 ReadyState ready_state_; | 134 ReadyState ready_state_; |
| 128 bool requires_consumer_; | 135 bool requires_consumer_; |
| 129 HeapHashSet<WeakMember<Observer>> observers_; | 136 HeapHashSet<WeakMember<Observer>> observers_; |
| 130 Mutex audio_consumers_lock_; | 137 Mutex audio_consumers_lock_; |
| 131 HashSet<AudioDestinationConsumer*> audio_consumers_; | 138 HashSet<AudioDestinationConsumer*> audio_consumers_; |
| 132 std::unique_ptr<ExtraData> extra_data_; | 139 std::unique_ptr<ExtraData> extra_data_; |
| 133 WebMediaConstraints constraints_; | 140 WebMediaConstraints constraints_; |
| 141 WTF::Optional<bool> echo_cancellation_; |
| 134 }; | 142 }; |
| 135 | 143 |
| 136 typedef HeapVector<Member<MediaStreamSource>> MediaStreamSourceVector; | 144 typedef HeapVector<Member<MediaStreamSource>> MediaStreamSourceVector; |
| 137 | 145 |
| 138 } // namespace blink | 146 } // namespace blink |
| 139 | 147 |
| 140 #endif // MediaStreamSource_h | 148 #endif // MediaStreamSource_h |
| OLD | NEW |