Taylor Brandstetter | cf846ad | 2015-12-10 15:52:02 -0800 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
Taylor Brandstetter | cf846ad | 2015-12-10 15:52:02 -0800 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
Taylor Brandstetter | cf846ad | 2015-12-10 15:52:02 -0800 | [diff] [blame] | 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_MEDIA_STREAM_OBSERVER_H_ |
| 12 | #define PC_MEDIA_STREAM_OBSERVER_H_ |
Taylor Brandstetter | cf846ad | 2015-12-10 15:52:02 -0800 | [diff] [blame] | 13 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 14 | #include "api/media_stream_interface.h" |
Mirko Bonadei | d970807 | 2019-01-25 20:26:48 +0100 | [diff] [blame] | 15 | #include "api/scoped_refptr.h" |
Artem Titov | e41c433 | 2018-07-25 15:04:28 +0200 | [diff] [blame] | 16 | #include "rtc_base/third_party/sigslot/sigslot.h" |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | // Helper class which will listen for changes to a stream and emit the |
| 21 | // corresponding signals. |
| 22 | class MediaStreamObserver : public ObserverInterface { |
| 23 | public: |
| 24 | explicit MediaStreamObserver(MediaStreamInterface* stream); |
Mirko Bonadei | 2ffed6d | 2018-07-20 11:09:32 +0200 | [diff] [blame] | 25 | ~MediaStreamObserver() override; |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 26 | |
| 27 | const MediaStreamInterface* stream() const { return stream_; } |
| 28 | |
| 29 | void OnChanged() override; |
| 30 | |
| 31 | sigslot::signal2<AudioTrackInterface*, MediaStreamInterface*> |
| 32 | SignalAudioTrackAdded; |
| 33 | sigslot::signal2<AudioTrackInterface*, MediaStreamInterface*> |
| 34 | SignalAudioTrackRemoved; |
| 35 | sigslot::signal2<VideoTrackInterface*, MediaStreamInterface*> |
| 36 | SignalVideoTrackAdded; |
| 37 | sigslot::signal2<VideoTrackInterface*, MediaStreamInterface*> |
| 38 | SignalVideoTrackRemoved; |
| 39 | |
| 40 | private: |
| 41 | rtc::scoped_refptr<MediaStreamInterface> stream_; |
| 42 | AudioTrackVector cached_audio_tracks_; |
| 43 | VideoTrackVector cached_video_tracks_; |
| 44 | }; |
| 45 | |
| 46 | } // namespace webrtc |
| 47 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 48 | #endif // PC_MEDIA_STREAM_OBSERVER_H_ |