Skip to content

Commit dd16bf4

Browse files
1. Upgrade to CloudXR SDK v3.1.1, WaveSDK 4.3.0.
2. Remove "RecreateFramebuffer" function call to avoid potential crash. 3. Use 64bits ABI since CloudXR SDK 3.1.1 provides only 64 bits lib.
1 parent 8159a1c commit dd16bf4

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
# Wave CloudXR Sample Client
33

4-
Demonstrate how to program with NVIDIA CloudXR SDK 3.0 for VIVE Focus 3 headset. You can start to develop your own CloudXR application for VIVE Focus 3 based on this sample client.
4+
Demonstrate how to program with NVIDIA CloudXR SDK 3.1.1 for VIVE Focus 3 headset. You can start to develop your own CloudXR application for VIVE Focus 3 based on this sample client.
55

66
Below are the instructions to build from source. Alternatively you can find a pre-built APK in the [Releases](https://github.com/ViveSoftware/Wave-CloudXR-Sample/releases) section.
77

88
## Requirements
99
- HTC VIVE Focus 3
10-
- [Wave Native SDK 4.1.1](https://developer.vive.com/resources/vive-wave/download/latest/) or later
11-
- [CloudXR SDK 3.0](https://developer.nvidia.com/nvidia-cloudxr-sdk)
10+
- [Wave Native SDK 4.3.0](https://developer.vive.com/resources/vive-wave/download/latest/) or later
11+
- [CloudXR SDK 3.1.1](https://developer.nvidia.com/nvidia-cloudxr-sdk)
1212
- [Google OBOE SDK 1.5.0](https://github.com/google/oboe/releases/tag/1.5.0)
1313
- Android development environment
1414
- Android Studio 4.0 or later
@@ -18,13 +18,13 @@ Below are the instructions to build from source. Alternatively you can find a pr
1818
- OpenJDK 1.8n
1919

2020
## Build Instructions
21-
1. Download [CloudXR SDK 3.0](https://developer.nvidia.com/nvidia-cloudxr-sdk) and [Google OBOE SDK 1.5.0](https://github.com/google/oboe/releases/tag/1.5.0).
21+
1. Download [CloudXR SDK 3.1.1](https://developer.nvidia.com/nvidia-cloudxr-sdk) and [Google OBOE SDK 1.5.0](https://github.com/google/oboe/releases/tag/1.5.0).
2222
2. Put ***CloudXR.aar*** and ***oboe-1.5.0.aar*** in ***[ProjectRoot]/app/libs***
2323
3. Download Wave SDK and put in ***[ProjectRoot]/repo*** (paths can be modified in ***build_sdk.gradle***)
2424
4. You are ready to build.
2525

2626
## Installation & Usage
27-
1. Install CloudXR server 3.0 on your PC.
27+
1. Install CloudXR server 3.1.1 on your PC.
2828
2. Build Wave CloudXR Sample Client and install the apk to your VIVE Focus 3
2929
3. Modify the IP address in ***CloudXRLaunchOptions.txt*** and push it into ***/sdcard*** of your VIVE Focus 3.
3030
- Please read [CloudXR Command-Line Options](https://docs.nvidia.com/cloudxr-sdk/usr_guide/cmd_line_options.html#command-line-options) for the format of ***CloudXRLaunchOptions.txt***)

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
ndkVersion '21.4.7075529'
88
defaultConfig {
99
applicationId "com.htc.vr.samples.wavecloudxr"
10-
versionCode 1
11-
versionName "1.0"
10+
versionCode 2
11+
versionName "1.1"
1212
}
1313

1414
signingConfigs {

app/build_sdk.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ android {
3434
arguments "CLOUDXR_SDK_ROOT=$CLOUDXR_SDK_ROOT"
3535
}}
3636
ndk {
37-
abiFilters 'armeabi-v7a'
37+
abiFilters 'arm64-v8a'
3838
}
3939
}
4040

app/src/main/jni/WaveCloudXRApp.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool WaveCloudXRApp::initVR() {
102102

103103
// Init Wave Render
104104
WVR_RenderInitParams_t param;
105-
param = { WVR_GraphicsApiType_OpenGL, WVR_RenderConfig_Default };
105+
param = { WVR_GraphicsApiType_OpenGL, WVR_RenderConfig_sRGB };
106106

107107
WVR_RenderError pError = WVR_RenderInit(&param);
108108
if (pError != WVR_RenderError_None) {
@@ -129,13 +129,13 @@ bool WaveCloudXRApp::initGL() {
129129

130130
mLeftEyeQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, mRenderWidth, mRenderHeight, 0);
131131
for (int i = 0; i < WVR_GetTextureQueueLength(mLeftEyeQ); i++) {
132-
GLuint fbo = CreateGLFramebuffer((GLuint)WVR_GetTexture(mLeftEyeQ, i).id);
132+
GLuint fbo = CreateGLFramebuffer((GLuint)(size_t)WVR_GetTexture(mLeftEyeQ, i).id);
133133
mLeftEyeFBO.push_back(fbo);
134134
}
135135

136136
mRightEyeQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, mRenderWidth, mRenderHeight, 0);
137137
for (int i = 0; i < WVR_GetTextureQueueLength(mRightEyeQ); i++) {
138-
GLuint fbo = CreateGLFramebuffer((GLuint)WVR_GetTexture(mRightEyeQ, i).id);
138+
GLuint fbo = CreateGLFramebuffer((GLuint)(size_t)WVR_GetTexture(mRightEyeQ, i).id);
139139
mRightEyeFBO.push_back(fbo);
140140
}
141141

@@ -251,13 +251,13 @@ void WaveCloudXRApp::RecreateFramebuffer(const uint32_t width, const uint32_t he
251251

252252
mLeftEyeQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, width, height, 0);
253253
for (int i = 0; i < WVR_GetTextureQueueLength(mLeftEyeQ); i++) {
254-
GLuint fbo = CreateGLFramebuffer((GLuint)WVR_GetTexture(mLeftEyeQ, i).id);
254+
GLuint fbo = CreateGLFramebuffer((GLuint)(size_t)WVR_GetTexture(mLeftEyeQ, i).id);
255255
mLeftEyeFBO.push_back(fbo);
256256
}
257257

258258
mRightEyeQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, width, height, 0);
259259
for (int i = 0; i < WVR_GetTextureQueueLength(mRightEyeQ); i++) {
260-
GLuint fbo = CreateGLFramebuffer((GLuint)WVR_GetTexture(mRightEyeQ, i).id);
260+
GLuint fbo = CreateGLFramebuffer((GLuint)(size_t)WVR_GetTexture(mRightEyeQ, i).id);
261261
mRightEyeFBO.push_back(fbo);
262262
}
263263

@@ -790,12 +790,20 @@ bool WaveCloudXRApp::UpdateFrame() {
790790
LOGE("Error in LatchFrame [%0d] = %s", frameErr, cxrErrorString(frameErr));
791791
} else {
792792

793+
// If network condition is bad, e.g. bitrate usage down below ~5Mbps
794+
// Frames received will vary frequently in size (~5 times in 1 second)
795+
// and crash here due to no read/write protection
796+
797+
// You can add mutex to protect buffer recreation process and potentially increase latency
798+
// or comment this function call to avoid crash caused by frequent size change
799+
// Not recreating buffer to match incoming frame size might result in blurry display.
800+
793801
if ( mFramesLatched.frames[0].widthFinal != mRenderWidth ||
794802
mFramesLatched.frames[0].heightFinal != mRenderHeight ) {
795803
LOGE("Receive frame %dx%d, buffer size %dx%d",
796804
mFramesLatched.frames[0].widthFinal, mFramesLatched.frames[0].heightFinal,
797805
mRenderWidth, mRenderHeight);
798-
RecreateFramebuffer(mFramesLatched.frames[0].widthFinal, mFramesLatched.frames[0].heightFinal);
806+
//RecreateFramebuffer(mFramesLatched.frames[0].widthFinal, mFramesLatched.frames[0].heightFinal);
799807
}
800808
}
801809
}
@@ -1184,16 +1192,16 @@ void WaveCloudXRApp::HandleClientState(cxrClientState state, cxrStateReason reas
11841192
mConnected = true;
11851193
break;
11861194
case cxrClientState_ConnectionAttemptFailed:
1187-
LOGE("Connection attempt failed. [%s]", cxrStateReasonString(reason));
1195+
LOGE("Connection attempt failed. Reason: [%d]", reason);
11881196
state = cxrClientState_Disconnected;
11891197
mConnected = false;
11901198
break;
11911199
case cxrClientState_Disconnected:
1192-
LOGE("Server disconnected with reason: [%s]", cxrStateReasonString(reason));
1200+
LOGE("Server disconnected with reason: [%d]", reason);
11931201
mConnected = false;
11941202
break;
11951203
default:
1196-
LOGW("Client state updated: %s, reason: %s", cxrClientStateString(state), cxrStateReasonString(reason));
1204+
LOGW("Client state updated: %d to %d, reason: %d", mClientState, state, reason);
11971205
break;
11981206
}
11991207

0 commit comments

Comments
 (0)