mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
Avoid proxy thread hops for reading const properties.
This bypasses the proxy for the following properties: * MediaStream::id() * AudioTrack::kind() and AudioTrack::id() * VideoTrack::kind() and VideoTrack::id() * RtpReceiver::media_type() and RtpReceiver::id() * RtpSender::media_type() and RtpSender::id() * VideoTrackSource::remote() and VideoTrackSource::is_screencast() * RtpTransceiver::media_type() Bug: webrtc:11923 Change-Id: If7edea1781f778af3775515fc4af9a9e151c8103 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183767 Reviewed-by: Chen Xing <chxg@google.com> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32071}
This commit is contained in:
parent
8750c16f46
commit
fc83cdc819
9 changed files with 14 additions and 15 deletions
|
@ -22,7 +22,7 @@ namespace webrtc {
|
||||||
// are called on is an implementation detail.
|
// are called on is an implementation detail.
|
||||||
BEGIN_SIGNALING_PROXY_MAP(MediaStream)
|
BEGIN_SIGNALING_PROXY_MAP(MediaStream)
|
||||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
|
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
|
||||||
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
|
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
|
||||||
PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
|
PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
|
||||||
|
|
|
@ -26,8 +26,8 @@ namespace webrtc {
|
||||||
|
|
||||||
BEGIN_SIGNALING_PROXY_MAP(AudioTrack)
|
BEGIN_SIGNALING_PROXY_MAP(AudioTrack)
|
||||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(std::string, kind)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
|
||||||
PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_CONSTMETHOD0(TrackState, state)
|
PROXY_CONSTMETHOD0(TrackState, state)
|
||||||
PROXY_CONSTMETHOD0(bool, enabled)
|
PROXY_CONSTMETHOD0(bool, enabled)
|
||||||
PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
|
PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
|
||||||
|
@ -42,8 +42,8 @@ END_PROXY_MAP()
|
||||||
|
|
||||||
BEGIN_PROXY_MAP(VideoTrack)
|
BEGIN_PROXY_MAP(VideoTrack)
|
||||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(std::string, kind)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
|
||||||
PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_CONSTMETHOD0(TrackState, state)
|
PROXY_CONSTMETHOD0(TrackState, state)
|
||||||
PROXY_CONSTMETHOD0(bool, enabled)
|
PROXY_CONSTMETHOD0(bool, enabled)
|
||||||
PROXY_METHOD1(bool, set_enabled, bool)
|
PROXY_METHOD1(bool, set_enabled, bool)
|
||||||
|
|
|
@ -128,8 +128,8 @@ PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
||||||
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
||||||
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<MediaStreamInterface>>,
|
PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<MediaStreamInterface>>,
|
||||||
streams)
|
streams)
|
||||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||||
PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_CONSTMETHOD0(RtpParameters, GetParameters)
|
PROXY_CONSTMETHOD0(RtpParameters, GetParameters)
|
||||||
PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*)
|
PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*)
|
||||||
PROXY_METHOD1(void, SetJitterBufferMinimumDelay, absl::optional<double>)
|
PROXY_METHOD1(void, SetJitterBufferMinimumDelay, absl::optional<double>)
|
||||||
|
|
|
@ -110,8 +110,8 @@ PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtlsTransportInterface>, dtls_transport)
|
||||||
PROXY_CONSTMETHOD0(uint32_t, ssrc)
|
PROXY_CONSTMETHOD0(uint32_t, ssrc)
|
||||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||||
PROXY_CONSTMETHOD0(std::string, id)
|
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
|
||||||
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids)
|
||||||
PROXY_CONSTMETHOD0(std::vector<RtpEncodingParameters>, init_send_encodings)
|
PROXY_CONSTMETHOD0(std::vector<RtpEncodingParameters>, init_send_encodings)
|
||||||
PROXY_CONSTMETHOD0(RtpParameters, GetParameters)
|
PROXY_CONSTMETHOD0(RtpParameters, GetParameters)
|
||||||
|
|
|
@ -23,8 +23,8 @@ namespace webrtc {
|
||||||
BEGIN_PROXY_MAP(VideoTrackSource)
|
BEGIN_PROXY_MAP(VideoTrackSource)
|
||||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(SourceState, state)
|
PROXY_CONSTMETHOD0(SourceState, state)
|
||||||
PROXY_CONSTMETHOD0(bool, remote)
|
BYPASS_PROXY_CONSTMETHOD0(bool, remote)
|
||||||
PROXY_CONSTMETHOD0(bool, is_screencast)
|
BYPASS_PROXY_CONSTMETHOD0(bool, is_screencast)
|
||||||
PROXY_CONSTMETHOD0(absl::optional<bool>, needs_denoising)
|
PROXY_CONSTMETHOD0(absl::optional<bool>, needs_denoising)
|
||||||
PROXY_METHOD1(bool, GetStats, Stats*)
|
PROXY_METHOD1(bool, GetStats, Stats*)
|
||||||
PROXY_WORKER_METHOD2(void,
|
PROXY_WORKER_METHOD2(void,
|
||||||
|
|
|
@ -39,7 +39,6 @@ AudioTrack::~AudioTrack() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AudioTrack::kind() const {
|
std::string AudioTrack::kind() const {
|
||||||
RTC_DCHECK(thread_checker_.IsCurrent());
|
|
||||||
return kAudioKind;
|
return kAudioKind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MediaStream : public Notifier<MediaStreamInterface> {
|
||||||
template <typename TrackVector>
|
template <typename TrackVector>
|
||||||
bool RemoveTrack(TrackVector* Tracks, MediaStreamTrackInterface* track);
|
bool RemoveTrack(TrackVector* Tracks, MediaStreamTrackInterface* track);
|
||||||
|
|
||||||
std::string id_;
|
const std::string id_;
|
||||||
AudioTrackVector audio_tracks_;
|
AudioTrackVector audio_tracks_;
|
||||||
VideoTrackVector video_tracks_;
|
VideoTrackVector video_tracks_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,7 @@ class MediaStreamTrack : public Notifier<T> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
std::string id_;
|
const std::string id_;
|
||||||
MediaStreamTrackInterface::TrackState state_;
|
MediaStreamTrackInterface::TrackState state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ class RtpTransceiver final
|
||||||
|
|
||||||
BEGIN_SIGNALING_PROXY_MAP(RtpTransceiver)
|
BEGIN_SIGNALING_PROXY_MAP(RtpTransceiver)
|
||||||
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
BYPASS_PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
|
||||||
PROXY_CONSTMETHOD0(absl::optional<std::string>, mid)
|
PROXY_CONSTMETHOD0(absl::optional<std::string>, mid)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpSenderInterface>, sender)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpSenderInterface>, sender)
|
||||||
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpReceiverInterface>, receiver)
|
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpReceiverInterface>, receiver)
|
||||||
|
|
Loading…
Reference in a new issue