Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/sdk 7 audio streaming #255

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3727ff0
initial setup (works with tweaked local sdk scene "Party-time")
popuz Dec 20, 2023
d6402f9
brought Audio and Video Stream SDK Scene
popuz Jan 8, 2024
3da19ab
Merge branch 'main' into feat/sdk-7-audio-streaming
popuz Jan 8, 2024
44ea616
save before merge
popuz Jan 9, 2024
d1fb5e1
add AVPro to gitignore
popuz Jan 9, 2024
12abf9b
Merge branch 'main' into feat/sdk-7-audio-streaming
popuz Jan 9, 2024
85a1fb3
add pooling for MediaPlayer and run stream with it; (first working Au…
popuz Jan 10, 2024
46359cd
properly returning MediaPlayer to the pool
popuz Jan 10, 2024
f57aa3f
code cleanup
popuz Jan 10, 2024
f23b1a1
add Update of component
popuz Jan 10, 2024
391642e
add updating of audio stream
popuz Jan 10, 2024
7fc9dec
add AVPro to gitignore
popuz Jan 11, 2024
aa1939f
hide behind "define"
popuz Jan 11, 2024
e95f263
Merge branch 'main' into feat/sdk-7-audio-streaming
popuz Jan 11, 2024
1dba451
-presented asmdefs; -add manual CI test to check audio stream;
popuz Jan 11, 2024
c4ec982
Merge branch 'main' into feat/sdk-7-audio-streaming
popuz Jan 11, 2024
8bf9e06
add import requiredPackages
popuz Jan 11, 2024
1bb22b3
fixing package file variable
popuz Jan 11, 2024
38797b4
removed packageFile variable
popuz Jan 11, 2024
7591cd5
Merge branch 'main' into feat/sdk-7-audio-streaming
popuz Jan 11, 2024
3dc5588
add RequiredPackages folder (as in unity-renderer)
popuz Jan 11, 2024
613b874
add isCurrentScene handling with some refactoring
popuz Jan 15, 2024
6a5bc32
fix current scene change reaction
popuz Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build-Windows-il2cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
GPG_PRIVATE_KEY_BASE64: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -77,6 +78,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Download Required Packages
run: |
echo "${{ secrets.GPG_PRIVATE_KEY_BASE64 }}" | base64 -d > private.gpg
gpg --batch --import private.gpg
curl -L "https://renderer-artifacts.decentraland.org/artifacts/requiredPackages-desktop.unitypackage.gpg" -o requiredPackages.unitypackage.gpg
gpg --output requiredPackages.unitypackage --decrypt requiredPackages.unitypackage.gpg

- name: Import Packages into Unity
run: |
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' $UNITY_PATH/Editor/Unity \
-quit \
-batchmode \
-importPackage $(pwd)/requiredPackages.unitypackage \
-projectPath "$PROJECT_PATH"

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
[Aa]ssets/AVProVideo/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
Expand Down
1 change: 1 addition & 0 deletions Explorer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
[Aa]ssets/AVProVideo/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
Expand Down
10 changes: 0 additions & 10 deletions Explorer/Assets/AddressableAssetsData/AssetGroups/UI.asset
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: e0f5a4ab5d8f74640ae94adb6824bd45
m_Address: ScenesUIRootCanvas
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 295cf8ad8d171d849863eccaf581c9e7
m_Address: ScenesUIStyleSheet
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: fc8a9d2b539788c47a5b305639fa8b34, type: 2}
m_SchemaSet:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Explorer/Assets/DCL/AssetsProvision/UI.meta

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions Explorer/Assets/DCL/AssetsProvision/UI/UIDocumentRef.cs

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DCL.Diagnostics;
using DCL.ECSComponents;
using DCL.ECSComponents;
using System;
using System.Collections.Generic;

Expand Down Expand Up @@ -32,9 +31,7 @@ public static implicit operator BodyShape(PBAvatarShape pbAvatarShape)
if (pbAvatarShape.BodyShape == FEMALE.Value)
return FEMALE;

ReportHub.LogError(ReportCategory.AVATAR, $"'{pbAvatarShape.BodyShape}' body shape not supported, using MALE instead.");

return MALE;
throw new NotSupportedException($"Body shape {pbAvatarShape.BodyShape} not supported");
}

public static BodyShape FromStringSafe(string bodyShape)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class DebugLogReportHandler : ReportHandlerBase
// Scene Loading blueish
{ ReportCategory.SCENE_LOADING, ColorUtility.ToHtmlStringRGB(new Color(0.30f, 0.50f, 0.90f)) },
{ ReportCategory.SCENE_FACTORY, ColorUtility.ToHtmlStringRGB(new Color(0.15f, 0.35f, 0.75f)) },
{ ReportCategory.SCENE_UI, ColorUtility.ToHtmlStringRGB(new Color(0.10f, 0.30f, 0.45f)) },

// JavaScript
{ ReportCategory.JAVASCRIPT, ColorUtility.ToHtmlStringRGB(new Color(0.90f, 0.30f, 0.35f)) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ public static class ReportCategory
/// </summary>
public const string SCENE_LOADING = nameof(SCENE_LOADING);

/// <summary>
/// Messages related to the scene UI
/// </summary>
public const string SCENE_UI = nameof(SCENE_UI);

/// <summary>
/// Errors reported from JavaScript
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public void Clear() =>
public void ClearThrottled(int maxChunkSize) =>
gameObjectPool.ClearThrottled(maxChunkSize);

private T HandleCreation()
public static T HandleCreation()
{
var go = new GameObject(DEFAULT_COMPONENT_NAME);
go.gameObject.SetActive(false);
return go.TryAddComponent<T>();
}

private void HandleGet(T component)
private static void HandleGet(T component)
{
component.gameObject.SetActive(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public interface IComponentPoolsRegistry : IDisposable

public static class ComponentPoolsRegistryExtensions
{
public static void AddComponentPool<T>(this IComponentPoolsRegistry componentPoolsRegistry, Action<T> onGet = null, Action<T> onRelease = null, int maxSize = 10000) where T: class, new()
public static void AddComponentPool<T>(this IComponentPoolsRegistry componentPoolsRegistry, Action<T> onGet = null, Action<T> onRelease = null) where T: class, new()
{
componentPoolsRegistry.AddComponentPool(new ComponentPool<T>(onGet, onRelease, maxSize: maxSize));
componentPoolsRegistry.AddComponentPool(new ComponentPool<T>(onGet, onRelease));
}
}
}
8 changes: 4 additions & 4 deletions Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
"GUID:6830e2f56251b492e9934f1fafbc8c7d",
"GUID:5ab29fa8ae5769b49ab29e390caca7a4",
"GUID:e56a0d6a94c144c784012e63b6043100",
"GUID:4505fcf99e744d9bba6c6de3568145fd",
"GUID:166b65e6dfc848bb9fb075f53c293a38",
"GUID:7f6c11dd1400cef4f838168f18ce244a",
"GUID:91cf8206af184dac8e30eb46747e9939",
"GUID:28964ef7dc9441b6b8671b61a8106690",
"GUID:571dc9f8bded0034f98595106462e3d0",
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:54660b0fae444b4cbfdafa9d68108f04"
"GUID:54660b0fae444b4cbfdafa9d68108f04",
"GUID:3ca842002c51d0a43b73e45298809a13",
"GUID:70fa04884cacd724eb1d5df018bc6977",
"GUID:166b65e6dfc848bb9fb075f53c293a38"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
48 changes: 48 additions & 0 deletions Explorer/Assets/DCL/PluginSystem/World/AudioStreamPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Arch.SystemGroups;
using DCL.Optimization.Pools;
using DCL.PluginSystem.World.Dependencies;
using ECS.ComponentsPooling.Systems;
using ECS.LifeCycle;
using ECS.Unity.AudioStreams.Components;
using ECS.Unity.AudioStreams.Systems;
using RenderHeads.Media.AVProVideo;
using System.Collections.Generic;

namespace DCL.PluginSystem.World
{
public class AudioStreamPlugin : IDCLWorldPluginWithoutSettings
{
private readonly IComponentPoolsRegistry componentPoolsRegistry;

public AudioStreamPlugin(ECSWorldSingletonSharedDependencies sharedDependencies)
{
componentPoolsRegistry = sharedDependencies.ComponentPoolsRegistry;
componentPoolsRegistry.AddGameObjectPool<MediaPlayer>(onRelease: OnReleaseToPool);

// cacheCleaner.Register(componentPoolsRegistry.GetReferenceTypePool<AudioSource>());

void OnReleaseToPool(MediaPlayer mediaPlayer)
{
mediaPlayer.Stop();
mediaPlayer.CloseMedia();
mediaPlayer.Events.RemoveAllListeners();
}
}

// private static MediaPlayer HandleCreation()
// {
// var poolObject = GameObjectPool<MediaPlayer>.HandleCreation();
// poolObject.gameObject.TryAddComponent<AudioSource>();
// poolObject.gameObject.TryAddComponent<AudioOutput>();
// return poolObject;
// }

public void InjectToWorld(ref ArchSystemsWorldBuilder<Arch.Core.World> builder, in ECSWorldInstanceSharedDependencies sharedDependencies, in PersistentEntities persistentEntities, List<IFinalizeWorldSystem> finalizeWorldSystems)
{
AudioStreamSystem.InjectToWorld(ref builder, componentPoolsRegistry);
finalizeWorldSystems.Add(ReleasePoolableComponentSystem<MediaPlayer, AudioStreamComponent>.InjectToWorld(ref builder, componentPoolsRegistry));
}

public void InjectToEmptySceneWorld(ref ArchSystemsWorldBuilder<Arch.Core.World> builder, in EmptyScenesWorldSharedDependencies dependencies) { }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions Explorer/Assets/DCL/PluginSystem/World/AvatarShapePlugin.cs

This file was deleted.

This file was deleted.

80 changes: 0 additions & 80 deletions Explorer/Assets/DCL/PluginSystem/World/SceneUIPlugin.cs

This file was deleted.

This file was deleted.

Loading
Loading