blob: 317997640490222a32e582e06b710b1591f6c55d [file] [log] [blame]
Taylor Brandstettercf846ad2015-12-10 23:52:021/*
kjellanderb24317b2016-02-10 15:54:432 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
Taylor Brandstettercf846ad2015-12-10 23:52:023 *
kjellanderb24317b2016-02-10 15:54:434 * 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 Brandstettercf846ad2015-12-10 23:52:029 */
10
Henrik Kjellander15583c12016-02-10 09:53:1211#ifndef WEBRTC_API_MEDIASTREAMOBSERVER_H_
12#define WEBRTC_API_MEDIASTREAMOBSERVER_H_
Taylor Brandstettercf846ad2015-12-10 23:52:0213
Henrik Kjellander15583c12016-02-10 09:53:1214#include "webrtc/api/mediastreaminterface.h"
deadbeefeb459812015-12-16 03:24:4315#include "webrtc/base/scoped_ref_ptr.h"
16#include "webrtc/base/sigslot.h"
17
18namespace webrtc {
19
20// Helper class which will listen for changes to a stream and emit the
21// corresponding signals.
22class MediaStreamObserver : public ObserverInterface {
23 public:
24 explicit MediaStreamObserver(MediaStreamInterface* stream);
25 ~MediaStreamObserver();
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
Henrik Kjellander15583c12016-02-10 09:53:1248#endif // WEBRTC_API_MEDIASTREAMOBSERVER_H_