Explorar el Código

RTMP云服务测试接入,更新最新WingDll

felix hace 1 año
padre
commit
5291ea8a84

+ 72 - 12
Vinno.vCloud.Common.FIS/Test/LiveUsServiceTestV2.cs

@@ -12,6 +12,7 @@ using Vinno.vCloud.FIS.CrossPlatform.Common.Hardware;
 using Vinno.vCloud.FIS.CrossPlatform.Common.LiveVideo;
 using Vinno.vCloud.FIS.CrossPlatform.Common.LiveVideo.Interface;
 using Vinno.vCloud.Protocol.Infrastructures;
+using WingInterfaceLibrary.Enum;
 using WingInterfaceLibrary.Interface;
 using WingInterfaceLibrary.Request.Device;
 
@@ -59,7 +60,7 @@ namespace Vinno.vCloud.Common.FIS.Test
 
             _extendedData = null;
 
-            var result = TimeoutExecute(CheckRtcAvailable);
+            var result = TimeoutExecute(CheckAvailable);
             if (result == VCloudSubItemTestStatus.Timeout)
             {
                 return new VCloudServiceTestResult(Id, VCloudTestItemStatus.TestFailed, TimeoutError, "(309)");
@@ -137,6 +138,29 @@ namespace Vinno.vCloud.Common.FIS.Test
                         rtcExtendedData.UserInfos.FirstOrDefault().Height = finalCapability.Height;
                         pusher = CrossPlatformHelper.Instance.LiveVideoPusherCreatorV2.CreateRTCSinglePusherV2();
                     }
+                    else if (_extendedData is RtmpExtendedData rtmpExtendedData)
+                    {
+                        var testCapbility = testCamera.Capabilities.FirstOrDefault(x => x.Width == rtmpExtendedData.UserInfos.FirstOrDefault().Width && x.Height == rtmpExtendedData.UserInfos.FirstOrDefault().Height);
+                        if (testCapbility == null)
+                        {
+                            var capblility = testCamera.Capabilities.FirstOrDefault(x => x.Width == 640 && x.Height == 480);
+                            if (capblility == null)
+                            {
+                                finalCapability = testCamera.Capabilities.FirstOrDefault();
+                            }
+                            else
+                            {
+                                finalCapability = capblility;
+                            }
+                        }
+                        else
+                        {
+                            finalCapability = testCapbility;
+                        }
+                        rtmpExtendedData.UserInfos.FirstOrDefault().Width = finalCapability.Width;
+                        rtmpExtendedData.UserInfos.FirstOrDefault().Height = finalCapability.Height;
+                        pusher = CrossPlatformHelper.Instance.LiveVideoPusherCreatorV2.CreateRTMPSinglePusherV2();
+                    }
                     if (pusher != null)
                     {
                         pusher.ChannelStateChanged += OnChannelStateChanged;
@@ -167,7 +191,14 @@ namespace Vinno.vCloud.Common.FIS.Test
                     deviceInfo.OutputHeight = _screenHeight;
                     deviceInfo.OutputWidth = _screenWidth;
                     deviceInfo.IdForServer = "Test";
-                    pusher = CrossPlatformHelper.Instance.LiveVideoPusherCreatorV2.CreateRTCSinglePusherV2();
+                    if (_extendedData is RtcExtendedData)
+                    {
+                        pusher = CrossPlatformHelper.Instance.LiveVideoPusherCreatorV2.CreateRTCSinglePusherV2();
+                    }
+                    else if (_extendedData is RtmpExtendedData)
+                    {
+                        pusher = CrossPlatformHelper.Instance.LiveVideoPusherCreatorV2.CreateRTMPSinglePusherV2();
+                    }
                     if (pusher != null)
                     {
                         pusher.ChannelStateChanged += OnChannelStateChanged;
@@ -221,11 +252,24 @@ namespace Vinno.vCloud.Common.FIS.Test
             }
         }
 
-        private VCloudSubItemTestStatus CheckRtcAvailable()
+        private VCloudSubItemTestStatus CheckAvailable()
         {
             try
             {
-                var data = new RtcExtendedData(null, null, true);
+                IExtendedData data;
+                switch (vCloudServerConfig.Instance.LiveProtocolType)
+                {
+                    case TransactionStatusEnum.TRTC:
+                        data = new RtcExtendedData(null, null, true);
+                        break;
+
+                    case TransactionStatusEnum.VRTC:
+                        throw new InvalidDataException($"CheckAvailable Fail,VRTC is not support now ");
+
+                    default:
+                        data = new RtmpExtendedData(null, null, true);
+                        break;
+                }
                 var client = VCloudServiceTest.GetJsonRpcClient();
                 var deviceService = client.CreateProxy<IDeviceService>();
                 var createLiveRoomInfoRequest = new CreateLiveRoomInfoRequest
@@ -242,18 +286,34 @@ namespace Vinno.vCloud.Common.FIS.Test
                 }
                 else
                 {
-                    data.RoomId = result.RoomNo;
-                    data.AppId = result.AppId;
-                    RtcUserInfo userInfo;
-                    if (CommonParameter.Instance.IsSonopost)
+                    if (data is RtcExtendedData rtcExtendedData)
                     {
-                        userInfo = new RtcUserInfo(EnumLiveChannelCategory.Main, result.UserCode, result.UserSign, 1280, 720);
+                        rtcExtendedData.RoomId = result.RoomNo;
+                        rtcExtendedData.AppId = result.AppId;
+                        RtcUserInfo userInfo;
+                        if (CommonParameter.Instance.IsSonopost)
+                        {
+                            userInfo = new RtcUserInfo(EnumLiveChannelCategory.Main, result.UserCode, result.UserSign, 1280, 720);
+                        }
+                        else
+                        {
+                            userInfo = new RtcUserInfo(EnumLiveChannelCategory.Main, result.UserCode, result.UserSign, _screenWidth, _screenHeight);
+                        }
+                        rtcExtendedData.UserInfos.Add(userInfo);
                     }
-                    else
+                    else if (data is RtmpExtendedData rtmpExtendedData)
                     {
-                        userInfo = new RtcUserInfo(EnumLiveChannelCategory.Main, result.UserCode, result.UserSign, _screenWidth, _screenHeight);
+                        RtmpUserInfo userInfo;
+                        if (CommonParameter.Instance.IsSonopost)
+                        {
+                            userInfo = new RtmpUserInfo(EnumLiveChannelCategory.Main, result.LiveData?.RtmpPushUrl, 1280, 720);
+                        }
+                        else
+                        {
+                            userInfo = new RtmpUserInfo(EnumLiveChannelCategory.Main, result.LiveData?.RtmpPushUrl, _screenWidth, _screenHeight);
+                        }
+                        rtmpExtendedData.UserInfos.Add(userInfo);
                     }
-                    data.UserInfos.Add(userInfo);
                     _extendedData = data;
                 }
                 return VCloudSubItemTestStatus.Successful;

BIN
packages/WingInterfaceLibrary.dll