webrtc_m130/pc/media_stream_track_proxy.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
2.4 KiB
C
Raw Normal View History

/*
* Copyright 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// This file includes proxy classes for tracks. The purpose is
// to make sure tracks are only accessed from the signaling thread.
#ifndef PC_MEDIA_STREAM_TRACK_PROXY_H_
#define PC_MEDIA_STREAM_TRACK_PROXY_H_
#include <string>
#include "api/media_stream_interface.h"
#include "pc/proxy.h"
namespace webrtc {
// TODO(deadbeef): Move this to .cc file. What threads methods are called on is
// an implementation detail.
BEGIN_PRIMARY_PROXY_MAP(AudioTrack)
PROXY_PRIMARY_THREAD_DESTRUCTOR()
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
PROXY_CONSTMETHOD0(TrackState, state)
PROXY_CONSTMETHOD0(bool, enabled)
Reland "Fix race between enabled() and set_enabled() in VideoTrack." This reverts commit 096ad02c02b4bc6c046282b8793ef84d041dd0d8. Reason for revert: Including a fix for the test issue. Original change's description: > Revert "Fix race between enabled() and set_enabled() in VideoTrack." > > This reverts commit 5ffefe9d2d743c66f8a8bcbc5ad9662a3138840a. > > Reason for revert: Breaks Chromium Android browser tests on fyi bots. > > Original change's description: > > Fix race between enabled() and set_enabled() in VideoTrack. > > > > Along the way I introduced VideoSourceBaseGuarded, which is equivalent > > to VideoSourceBase except that it applies thread checks. I found that > > it's easy to use VideoSourceBase incorrectly and in fact there appear > > to be tests that do this. > > > > I made the source object const in VideoTrack, as it already was in > > AudioTrack, and that allowed for making the GetSource() accessors > > bypass the proxy thread hop and give the caller direct access. > > > > Bug: webrtc:12773, b/188139639, webrtc:12780 > > Change-Id: I022175c4239a1306ef54059c131d81411d5124fe > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219160 > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > Reviewed-by: Andrey Logvin <landrey@webrtc.org> > > Commit-Queue: Tommi <tommi@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34096} > > TBR=mbonadei@webrtc.org,tommi@webrtc.org,landrey@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I16323d459c76eb6a87cc602a0048f6ee01c81626 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12773 > Bug: b/188139639 > Bug: webrtc:12780 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219637 > Reviewed-by: Evan Shrubsole <eshr@google.com> > Commit-Queue: Evan Shrubsole <eshr@google.com> > Cr-Commit-Position: refs/heads/master@{#34101} # Not skipping CQ checks because this is a reland. Bug: webrtc:12773 Bug: b/188139639 Bug: webrtc:12780 Change-Id: Ib35fe15a6c43de8f286d60aff02b19df1ab76925 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219639 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Andrey Logvin <landrey@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@google.com> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34104}
2021-05-24 16:54:41 +02:00
BYPASS_PROXY_CONSTMETHOD0(AudioSourceInterface*, GetSource)
PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*)
PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*)
PROXY_METHOD1(bool, GetSignalLevel, int*)
PROXY_METHOD0(rtc::scoped_refptr<AudioProcessorInterface>, GetAudioProcessor)
Revert "Reland "Use non-proxied source object in VideoTrack."" This reverts commit 1158bff15f33c467543928dd6a49cb6ad04da1ba. Reason for revert: Downstream issues unresolved (2nd of two reverts) Original change's description: > Reland "Use non-proxied source object in VideoTrack." > > This is a reland of 3eb29c12358930a60134f185cd849e0d12aa9166 > > This reland doesn't contain the AudioTrack changes (see original > description) that got triggered in some cases and needs to be > addressed separately. > > Another change in this re-land is that instead of the `state` property > of the VideoTrack be marshalled to the signaling thread, it's readable > from the calling thread. Previously this was marshalled to the worker > and the original changed that to the signaling thread (same as for > AudioTrack) - but in case that's causing downstream problems this reland > uses BYPASS_PROXY_CONSTMETHOD0 for the `state()` accessor of the > VideoTrack proxy. > > Original change's description: > > Use non-proxied source object in VideoTrack. > > > > Use the internal representation of the video source object from the > > track. Before there were implicit thread hops due to use of the proxy. > > > > Also, override AudioTrack's enabled methods to enforce thread > > expectations. > > > > Bug: webrtc:13540 > > Change-Id: I4bc7aca96d6fc24f31ade45e47f52599f1cc2f97 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250180 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#35911} > > Bug: webrtc:13540 > Change-Id: Icb3e165f07240ae10730a316d3a8a3b2b9167d82 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251387 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35979} # Not skipping CQ checks because original CL landed > 1 day ago. Using "No-Try" to not have to wait for the win chromium bot to unblock (currently takes hours). No-Try: true Bug: webrtc:13540 Change-Id: I8f34536bf472a6d069344e84d889864f195c93f6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251686 Reviewed-by: Christoffer Jansson <jansson@google.com> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35993}
2022-02-14 11:03:29 +00:00
PROXY_METHOD1(bool, set_enabled, bool)
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
END_PROXY_MAP(AudioTrack)
BEGIN_PROXY_MAP(VideoTrack)
PROXY_PRIMARY_THREAD_DESTRUCTOR()
BYPASS_PROXY_CONSTMETHOD0(std::string, kind)
BYPASS_PROXY_CONSTMETHOD0(std::string, id)
Revert "Reland "Use non-proxied source object in VideoTrack."" This reverts commit 1158bff15f33c467543928dd6a49cb6ad04da1ba. Reason for revert: Downstream issues unresolved (2nd of two reverts) Original change's description: > Reland "Use non-proxied source object in VideoTrack." > > This is a reland of 3eb29c12358930a60134f185cd849e0d12aa9166 > > This reland doesn't contain the AudioTrack changes (see original > description) that got triggered in some cases and needs to be > addressed separately. > > Another change in this re-land is that instead of the `state` property > of the VideoTrack be marshalled to the signaling thread, it's readable > from the calling thread. Previously this was marshalled to the worker > and the original changed that to the signaling thread (same as for > AudioTrack) - but in case that's causing downstream problems this reland > uses BYPASS_PROXY_CONSTMETHOD0 for the `state()` accessor of the > VideoTrack proxy. > > Original change's description: > > Use non-proxied source object in VideoTrack. > > > > Use the internal representation of the video source object from the > > track. Before there were implicit thread hops due to use of the proxy. > > > > Also, override AudioTrack's enabled methods to enforce thread > > expectations. > > > > Bug: webrtc:13540 > > Change-Id: I4bc7aca96d6fc24f31ade45e47f52599f1cc2f97 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250180 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> > > Cr-Commit-Position: refs/heads/main@{#35911} > > Bug: webrtc:13540 > Change-Id: Icb3e165f07240ae10730a316d3a8a3b2b9167d82 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251387 > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35979} # Not skipping CQ checks because original CL landed > 1 day ago. Using "No-Try" to not have to wait for the win chromium bot to unblock (currently takes hours). No-Try: true Bug: webrtc:13540 Change-Id: I8f34536bf472a6d069344e84d889864f195c93f6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251686 Reviewed-by: Christoffer Jansson <jansson@google.com> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35993}
2022-02-14 11:03:29 +00:00
PROXY_SECONDARY_CONSTMETHOD0(TrackState, state)
PROXY_CONSTMETHOD0(bool, enabled)
PROXY_METHOD1(bool, set_enabled, bool)
PROXY_CONSTMETHOD0(ContentHint, content_hint)
PROXY_METHOD1(void, set_content_hint, ContentHint)
PROXY_SECONDARY_METHOD2(void,
AddOrUpdateSink,
rtc::VideoSinkInterface<VideoFrame>*,
const rtc::VideoSinkWants&)
PROXY_SECONDARY_METHOD1(void, RemoveSink, rtc::VideoSinkInterface<VideoFrame>*)
PROXY_SECONDARY_METHOD0(void, RequestRefreshFrame)
Reland "Fix race between enabled() and set_enabled() in VideoTrack." This reverts commit 096ad02c02b4bc6c046282b8793ef84d041dd0d8. Reason for revert: Including a fix for the test issue. Original change's description: > Revert "Fix race between enabled() and set_enabled() in VideoTrack." > > This reverts commit 5ffefe9d2d743c66f8a8bcbc5ad9662a3138840a. > > Reason for revert: Breaks Chromium Android browser tests on fyi bots. > > Original change's description: > > Fix race between enabled() and set_enabled() in VideoTrack. > > > > Along the way I introduced VideoSourceBaseGuarded, which is equivalent > > to VideoSourceBase except that it applies thread checks. I found that > > it's easy to use VideoSourceBase incorrectly and in fact there appear > > to be tests that do this. > > > > I made the source object const in VideoTrack, as it already was in > > AudioTrack, and that allowed for making the GetSource() accessors > > bypass the proxy thread hop and give the caller direct access. > > > > Bug: webrtc:12773, b/188139639, webrtc:12780 > > Change-Id: I022175c4239a1306ef54059c131d81411d5124fe > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219160 > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > > Reviewed-by: Andrey Logvin <landrey@webrtc.org> > > Commit-Queue: Tommi <tommi@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34096} > > TBR=mbonadei@webrtc.org,tommi@webrtc.org,landrey@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I16323d459c76eb6a87cc602a0048f6ee01c81626 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12773 > Bug: b/188139639 > Bug: webrtc:12780 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219637 > Reviewed-by: Evan Shrubsole <eshr@google.com> > Commit-Queue: Evan Shrubsole <eshr@google.com> > Cr-Commit-Position: refs/heads/master@{#34101} # Not skipping CQ checks because this is a reland. Bug: webrtc:12773 Bug: b/188139639 Bug: webrtc:12780 Change-Id: Ib35fe15a6c43de8f286d60aff02b19df1ab76925 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219639 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Andrey Logvin <landrey@webrtc.org> Reviewed-by: Evan Shrubsole <eshr@google.com> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34104}
2021-05-24 16:54:41 +02:00
BYPASS_PROXY_CONSTMETHOD0(VideoTrackSourceInterface*, GetSource)
PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
END_PROXY_MAP(VideoTrack)
} // namespace webrtc
#endif // PC_MEDIA_STREAM_TRACK_PROXY_H_