Skip to content

Commit

Permalink
refactor: Rename RenderStreamingHandler class (Unity-Technologies#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
karasusan authored Jan 30, 2023
1 parent d0c74e3 commit ee88e26
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)

ISignalingSettingEditor CreateEditor(SerializedProperty property)
{
var handler = property.serializedObject.targetObject as RenderStreamingHandler;
var handler = property.serializedObject.targetObject as SignalingManager;
var settings = handler.GetSignalingSettings();
var type = CustomSignalingSettingsEditor.FindInspectorTypeByInspectedType(settings.GetType());
return Activator.CreateInstance(type) as ISignalingSettingEditor;
}

VisualElement CreatePopUpSignalingType(SerializedProperty property, string label)
{
var handler = property.serializedObject.targetObject as RenderStreamingHandler;
var handler = property.serializedObject.targetObject as SignalingManager;
var settings = handler.GetSignalingSettings();
var defaultValue = CustomSignalingSettingsEditor.FindLabelByInspectedType(settings.GetType());
var choices = CustomSignalingSettingsEditor.Labels().ToList();
Expand All @@ -46,7 +46,7 @@ VisualElement CreatePopUpSignalingType(SerializedProperty property, string label

void OnChangedValue(ChangeEvent<string> e, SerializedProperty property)
{
var handler = property.serializedObject.targetObject as RenderStreamingHandler;
var handler = property.serializedObject.targetObject as SignalingManager;
if (handler == null)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Unity.RenderStreaming.Editor
/// <summary>
/// Render Streaming inspector.
/// </summary>
[CustomEditor(typeof(RenderStreamingHandler))]
internal class RenderStreamingHandlerEditor : UnityEditor.Editor
[CustomEditor(typeof(SignalingManager))]
internal class SignalingManagerEditor : UnityEditor.Editor
{
public override VisualElement CreateInspectorGUI()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Unity.RenderStreaming
{
internal class AutomaticStreaming : MonoBehaviour
{
private RenderStreamingHandler renderstreaming;
private SignalingManager renderstreaming;
private Broadcast broadcast;
private VideoStreamSender videoStreamSender;
private AudioStreamSender audioStreamSender;
Expand All @@ -36,7 +36,7 @@ private void Awake()
inputReceiver = gameObject.AddComponent<AutoInputReceiver>();
broadcast.AddComponent(inputReceiver);

renderstreaming = gameObject.AddComponent<RenderStreamingHandler>();
renderstreaming = gameObject.AddComponent<SignalingManager>();
renderstreaming.AddSignalingHandler(broadcast);
var signalingSettings = RenderStreaming.GetSignalingSettings<WebSocketSignalingSettings>();
renderstreaming.SetSignalingSettings(signalingSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

namespace Unity.RenderStreaming
{
[AddComponentMenu("Render Streaming/Render Streaming Handler")]
public sealed class RenderStreamingHandler : MonoBehaviour
[AddComponentMenu("Render Streaming/Signaling Manager")]
public sealed class SignalingManager : MonoBehaviour
{
#pragma warning disable 0649
// ToDo: Create component UI on URS-553
Expand All @@ -37,7 +37,7 @@ public sealed class RenderStreamingHandler : MonoBehaviour
public bool runOnAwake = true;
#pragma warning restore 0649

private RenderStreamingInternal m_instance;
private SignalingManagerInternal m_instance;
private SignalingEventProvider m_provider;
private bool m_running;

Expand Down Expand Up @@ -167,7 +167,7 @@ private void _Run(
if (_handlers.Count() == 0)
throw new InvalidOperationException("Handler list is empty.");

m_instance = new RenderStreamingInternal(ref dependencies);
m_instance = new SignalingManagerInternal(ref dependencies);
m_provider = new SignalingEventProvider(m_instance);

foreach (var handler in _handlers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal struct RenderStreamingDependencies
/// <summary>
///
/// </summary>
internal class RenderStreamingInternal : IDisposable,
internal class SignalingManagerInternal : IDisposable,
IRenderStreamingHandler, IRenderStreamingDelegate
{
/// <summary>
Expand Down Expand Up @@ -105,7 +105,7 @@ internal class RenderStreamingInternal : IDisposable,
///
/// </summary>
/// <param name="dependencies"></param>
public RenderStreamingInternal(ref RenderStreamingDependencies dependencies)
public SignalingManagerInternal(ref RenderStreamingDependencies dependencies)
{
if (dependencies.signaling == null)
throw new ArgumentException("Signaling instance is null.");
Expand All @@ -130,7 +130,7 @@ public RenderStreamingInternal(ref RenderStreamingDependencies dependencies)
/// <summary>
///
/// </summary>
~RenderStreamingInternal()
~SignalingManagerInternal()
{
Dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Unity.RenderStreaming.Samples
internal class ARFoundationSample : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField] private RenderStreamingHandler renderStreaming;
[SerializeField] private SignalingManager renderStreaming;
[SerializeField] private Button startButton;
[SerializeField] private Button stopButton;
[SerializeField] private RawImage remoteVideoImage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Unity.RenderStreaming.Samples
class BidirectionalSample : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField] private RenderStreamingHandler renderStreaming;
[SerializeField] private SignalingManager renderStreaming;
[SerializeField] private Dropdown webcamSelectDropdown;
[SerializeField] private Dropdown microphoneSelectDropdown;
[SerializeField] private Button startButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void AddListener(this InputAction action, Action<InputAction.Callb

class BroadcastSample : MonoBehaviour
{
[SerializeField] private RenderStreamingHandler renderStreaming;
[SerializeField] private SignalingManager renderStreaming;
[SerializeField] private InputReceiver inputReceiver;
[SerializeField] private SimpleCameraControllerV2 cameraController;
[SerializeField] private UIControllerV2 uiController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Unity.RenderStreaming.Samples
class GyroSample : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField] private RenderStreamingHandler renderStreaming;
[SerializeField] private SignalingManager renderStreaming;
[SerializeField] private Button sendOfferButton;
[SerializeField] private RawImage remoteVideoImage;
[SerializeField] private VideoStreamReceiver receiveVideoViewer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MultiplaySample : MonoBehaviour
[SerializeField] ToggleGroup toggleGroupRole;
[SerializeField] InputField inputFieldUsername;
[SerializeField] Button buttonStart;
[SerializeField] RenderStreamingHandler renderStreaming;
[SerializeField] SignalingManager renderStreaming;
[SerializeField] GameObject prefabHost;
[SerializeField] GameObject prefabGuest;
[SerializeField] GameObject prefabPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static (Rect, Vector2Int) GetRegionAndSize(this RawImage image)
class ReceiverSample : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField] private RenderStreamingHandler renderStreaming;
[SerializeField] private SignalingManager renderStreaming;
[SerializeField] private Button startButton;
[SerializeField] private Button stopButton;
[SerializeField] private InputField connectionIdInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Unity.RenderStreaming.Samples
{
class WebBrowserInputSample : MonoBehaviour
{
[SerializeField] RenderStreamingHandler renderStreaming;
[SerializeField] SignalingManager renderStreaming;
[SerializeField] Dropdown dropdownCamera;
[SerializeField] Transform[] cameras;
[SerializeField] CopyTransform copyTransform;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public bool IsTestFinished
}

private MonoBehaviourTest<MyMonoBehaviourTest> _test;
private RenderStreamingInternal _target1, _target2;
private SignalingManagerInternal _target1, _target2;
private RTCDataChannel _channel1, _channel2;
private string connectionId = "12345";
const float ResendOfferInterval = 3f;
Expand Down Expand Up @@ -76,8 +76,8 @@ public IEnumerator UnitySetUp()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
_target1 = new RenderStreamingInternal(ref dependencies1);
_target2 = new RenderStreamingInternal(ref dependencies2);
_target1 = new SignalingManagerInternal(ref dependencies1);
_target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TestContainer<T> : IDisposable where T : SignalingHandlerBase, IMonoBehavi
const float ResendOfferInterval = 3.0f;

public MonoBehaviourTest<T> test;
public RenderStreamingInternal instance;
public SignalingManagerInternal instance;
public SignalingEventProvider provider;

private static RenderStreamingDependencies CreateDependencies(MonoBehaviour behaviour)
Expand All @@ -114,7 +114,7 @@ public static TestContainer<T> Create(string name)
{
var test = new MonoBehaviourTest<T>();
var dependencies = CreateDependencies(test.component);
var instance = new RenderStreamingInternal(ref dependencies);
var instance = new SignalingManagerInternal(ref dependencies);
var provider = new SignalingEventProvider(instance);
var container = new TestContainer<T> { test = test, instance = instance, provider = provider };
test.component.SetHandler(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ enum TestMode
PublicMode
}

static class RenderStreamingInternalExtension
static class SignalingManagerInternalExtension
{
public static RTCRtpTransceiver AddSenderTrack(this RenderStreamingInternal target, string connectionId, MediaStreamTrack track)
public static RTCRtpTransceiver AddSenderTrack(this SignalingManagerInternal target, string connectionId, MediaStreamTrack track)
{
RTCRtpTransceiverInit init = new RTCRtpTransceiverInit() { direction = RTCRtpTransceiverDirection.SendOnly };
return target.AddTransceiver(connectionId, track, init);
}
}

class RenderStreamingInternalTest
class SignalingManagerInternalTest
{
class MyMonoBehaviourTest : MonoBehaviour, IMonoBehaviourTest
{
Expand Down Expand Up @@ -75,7 +75,7 @@ public IEnumerator Construct(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);

bool isStarted = false;
target.onStart += () => { isStarted = true; };
Expand All @@ -94,8 +94,8 @@ public IEnumerator ConstructMultiple(TestMode mode)

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand All @@ -118,7 +118,7 @@ public IEnumerator OpenConnection(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);

bool isStarted = false;
target.onStart += () => { isStarted = true; };
Expand Down Expand Up @@ -153,7 +153,7 @@ public IEnumerator OpenConnectionThrowException(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);

bool isStarted = false;
target.onStart += () => { isStarted = true; };
Expand All @@ -175,7 +175,7 @@ public IEnumerator AddTrack(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);

bool isStarted = false;
target.onStart += () => { isStarted = true; };
Expand Down Expand Up @@ -218,7 +218,7 @@ public IEnumerator AddTrackThrowException(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);

bool isStarted = false;
target.onStart += () => { isStarted = true; };
Expand Down Expand Up @@ -255,7 +255,7 @@ public IEnumerator AddTrackMultiple(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);

bool isStarted = false;
target.onStart += () => { isStarted = true; };
Expand Down Expand Up @@ -302,7 +302,7 @@ public IEnumerator CreateChannel(TestMode mode)
MockSignaling.Reset(mode == TestMode.PrivateMode);

var dependencies = CreateDependencies();
var target = new RenderStreamingInternal(ref dependencies);
var target = new SignalingManagerInternal(ref dependencies);
bool isStarted = false;
target.onStart += () => { isStarted = true; };
yield return new WaitUntil(() => isStarted);
Expand Down Expand Up @@ -337,8 +337,8 @@ public IEnumerator OnAddReceiverPrivateMode()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -410,8 +410,8 @@ public IEnumerator OnAddReceiverPublicMode()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -481,8 +481,8 @@ public IEnumerator OnAddChannelPrivateMode()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -546,8 +546,8 @@ public IEnumerator SendOfferThrowExceptionPrivateMode()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -612,8 +612,8 @@ public IEnumerator SwapTransceiverPrivateMode()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -695,8 +695,8 @@ public IEnumerator ResendOfferUntilGotAnswer(TestMode mode)

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -760,8 +760,8 @@ public IEnumerator DeleteFailedPeers(TestMode mode)

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down Expand Up @@ -823,8 +823,8 @@ public IEnumerator ReNegotiationAfterReceivingFirstOffer()

var dependencies1 = CreateDependencies();
var dependencies2 = CreateDependencies();
var target1 = new RenderStreamingInternal(ref dependencies1);
var target2 = new RenderStreamingInternal(ref dependencies2);
var target1 = new SignalingManagerInternal(ref dependencies1);
var target2 = new SignalingManagerInternal(ref dependencies2);

bool isStarted1 = false;
bool isStarted2 = false;
Expand Down
Loading

0 comments on commit ee88e26

Please sign in to comment.