xref: /aosp_15_r20/external/webrtc/pc/media_stream_track_proxy.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2011 The WebRTC project authors. All Rights Reserved.
3  *
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.
9  */
10 
11 // This file includes proxy classes for tracks. The purpose is
12 // to make sure tracks are only accessed from the signaling thread.
13 
14 #ifndef PC_MEDIA_STREAM_TRACK_PROXY_H_
15 #define PC_MEDIA_STREAM_TRACK_PROXY_H_
16 
17 #include <string>
18 
19 #include "api/media_stream_interface.h"
20 #include "pc/proxy.h"
21 
22 namespace webrtc {
23 
24 // TODO(deadbeef): Move this to .cc file. What threads methods are called on is
25 // an implementation detail.
26 BEGIN_PRIMARY_PROXY_MAP(AudioTrack)
27 PROXY_PRIMARY_THREAD_DESTRUCTOR()
28 BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
29 BYPASS_PROXY_CONSTMETHOD0(std::string, id)
30 PROXY_CONSTMETHOD0(TrackState, state)
31 PROXY_CONSTMETHOD0(bool, enabled)
32 BYPASS_PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
33 PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*)
34 PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*)
35 PROXY_METHOD1(bool, GetSignalLevel, int*)
36 PROXY_METHOD0(rtc::scoped_refptr<AudioProcessorInterface>, GetAudioProcessor)
37 PROXY_METHOD1(bool, set_enabled, bool)
38 PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
39 PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
40 END_PROXY_MAP(AudioTrack)
41 
42 BEGIN_PROXY_MAP(VideoTrack)
43 PROXY_PRIMARY_THREAD_DESTRUCTOR()
44 BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
45 BYPASS_PROXY_CONSTMETHOD0(std::string, id)
46 PROXY_SECONDARY_CONSTMETHOD0(TrackState, state)
47 PROXY_CONSTMETHOD0(bool, enabled)
48 PROXY_METHOD1(bool, set_enabled, bool)
49 PROXY_CONSTMETHOD0(ContentHint, content_hint)
50 PROXY_METHOD1(void, set_content_hint, ContentHint)
51 PROXY_SECONDARY_METHOD2(void,
52                         AddOrUpdateSink,
53                         rtc::VideoSinkInterface<VideoFrame>*,
54                         const rtc::VideoSinkWants&)
55 PROXY_SECONDARY_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
56 PROXY_SECONDARY_METHOD0(void, RequestRefreshFrame)
57 BYPASS_PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
58 
59 PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
60 PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
61 END_PROXY_MAP(VideoTrack)
62 
63 }  // namespace webrtc
64 
65 #endif  // PC_MEDIA_STREAM_TRACK_PROXY_H_
66