microsoft / WebRTC-universal-samples

WebRTC samples for the Universal Windows Platform.
178 stars 70 forks source link

About the video resolution. #48

Open happyao opened 5 years ago

happyao commented 5 years ago

I found that the lowest resolution on HoloLens is 895*504.

Could anyone give me some advice on how to downscale this resolution?

Many thanks!

jamescadd commented 5 years ago

Look for ControlScript.cs - it should be at a location similar to this: ortclib-sdk\common\windows\samples\PeerCC\ClientUnity\Assets\Scripts\ControlScript.cs

happyao commented 5 years ago

@jamescadd Thank you ! But now I am working on the PeerConnectionClient.WebRtc.UnityXaml.sln. Is there anyway to downscale the resolution?

happyao commented 5 years ago

@jamescadd Sorry maybe I need to explain it clearly, I want to downscale the video stream sending from holoLens to PC. Thanks a lot.

jamescadd commented 5 years ago

No problem, here's a link to the resolution setting. This is already defaulted to 895x504, do you have reason to believe that's not happening? If you run the code in VS with the debugger attached (debug build) you should be able to go through the logs to find the chosen resolution. Let me know if that helps.

https://github.com/Microsoft/WebRTC-universal-samples/blob/master/Samples/PeerCC-Sample/ClientUnity/Unity/PeerCCUnity/Assets/Scripts/ControlScript.cs#L548

happyao commented 5 years ago

@jamescadd Thanks for your reply. But I want to make this default resolution smaller, this default (also known as the lowest native resolution) resolution is also high for me. I found one example in the link below and want to achieve similar function as scaleResolutionDownBy does.

https://blog.mozilla.org/webrtc/fiddle-week-downscale-video-peerconnection/.

jamescadd commented 5 years ago

Ok that makes sense. We added scaleResolutionDownBy in M66 though it hasn't be tested (if there is a bug, we'll fix it). The problem is M66 was a large move to C++/WinRT and new Unity tooling, and while it's tested and working on Desktop I haven't been able to test on HoloLens yet. You need Unity 2018.2.13f1 and the C++/WinRT VS plugin. Also the XAML solution is no longer present so the build steps require using Unity editor too.

https://github.com/ortclib/ortclib-sdk/tree/Mosa/20180911-peercc-unity-upgrade

Steps:

1) Open WebRtcUnity solution, build PeerConnectionClientUnityCore project; 2) Open Unity project in Unity Editor ortclib-sdk\common\windows\samples\PeerCC\ClientUnity; 3) Change server URL in ortclib-sdk\common\windows\samples\PeerCC\ClientUnity\Assets\Scripts\ControlScript.cs; 4) Export UWP project from Unity Editor; 5) Modify 'Package.appxmanifest' in exported project and add WebRtcSchema there.
6) Build project for x86 and deploy to device.

happyao commented 5 years ago

@jamescadd Thank you so much! I will try it.

happyao commented 5 years ago

@jamescadd Hi, When I open the the ortlib-sdk I got these errors. Could you give me more details about how to build up the application? Many thanks!!

嚴重性 程式碼 說明 專案 檔案 行 隱藏項目狀態 錯誤 CMake Error: File C:/ortclib-sdk/webrtc/xplatform/libjpeg_turbo/win/jconfigint.h.in does not exist.
錯誤 CMake Error: File C:/ortclib-sdk/webrtc/xplatform/libjpeg_turbo/win/jconfig.h.in does not exist.
錯誤 CMake Error: File C:/ortclib-sdk/webrtc/xplatform/libjpeg_turbo/release/libjpeg-turbo.nsi.in does not exist.
錯誤 CMake Error at tests.cmake:2 (message): Cannot find gmock directory. C:\ortclib-sdk\webrtc\xplatform\chromium-pruned\third_party\protobuf\cmake\tests.cmake 2
錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt:870 (configure_file): configure_file Problem configuring file libjpeg C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt 870 錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt:331 (add_subdirectory): add_subdirectory given source "md5" which is not an existing directory. libjpeg C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt 331 錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt:238 (add_subdirectory): add_subdirectory given source "sharedlib" which is not an existing directory. libjpeg C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt 238 錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt:172 (configure_file): configure_file Problem configuring file libjpeg C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt 172 錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt:171 (configure_file): configure_file Problem configuring file libjpeg C:\ortclib-sdk\webrtc\xplatform\libjpeg_turbo\CMakeLists.txt 171 錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\googlemock\CMakeLists.txt:56 (config_compiler_and_linker): Unknown CMake command "config_compiler_and_linker". gmock C:\ortclib-sdk\webrtc\xplatform\googlemock\CMakeLists.txt 56
錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\googlemock\CMakeLists.txt:51 (add_subdirectory): add_subdirectory given source "../gtest" which is not an existing directory. gmock C:\ortclib-sdk\webrtc\xplatform\googlemock\CMakeLists.txt 51
錯誤 CMake Error at C:\ortclib-sdk\webrtc\xplatform\boringssl\CMakeLists.txt:30 (message): Could not find Go

C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\astri\CMakeBuilds\55e55ed3-ce29-0438-b45b-8e9cb6993a71\install\x64-Debug (__)" -DCMAKE_CXX_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/HostX64/x64/cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\ortclib-sdk\webrtc\xplatform\boringssl" 傳回結束代碼: 1 CMake Error at CMakeLists.txt:30 (message): Could not find Go BoringSSL C:\ortclib-sdk\webrtc\xplatform\boringssl\CMakeLists.txt 30

jamescadd commented 5 years ago

My mistake - the above link is actually on M62, the M66 Unity version is still in progress. I'll update you when it's ready or feel free to ping me over email at jacadd on the Microsoft domain. I would expect this to be ready within a week.

If you still want to test that branch it could be that the error is due to not cloning recursively. Could you double check that? Also did the prepare script run without issue? If you could run "bin\prepare.bat -logLevel 4" and send the output we may be able to diagnose the error.

happyao commented 5 years ago

@jamescadd Thank you. I clone recursively, and then change to the Mosa/20180911-peercc-unity-upgrade branch. Run "bin\prepare.bat -logLevel 4" but everything is fine.

jamescadd commented 5 years ago

After some research it does not appear that scaleResolutionDownBy is implemented yet in the WebRTC codebase (we means we do not yet have the feature either): https://chromium.googlesource.com/external/webrtc/+/master/pc/rtpsender.cc#39

I can still help you get the full build working however. Good to hear that prepare is working properly, but if you have the log it would still be nice to post so we can double check. If you could additionally post the full VS output for a build we can look as well. Apologies that this has taken so much time to get working.

happyao commented 5 years ago

@jamescadd Hi, understand and thanks for your help. This is the debug log when I open the ortclib in VS 2017. debuglog.txt

jamescadd commented 5 years ago

Looking at the log it seems like the errors are related to Go and Gmock. Could you post the results of "bin\prepare.bat -logLevel 4" so I can take a look? Perhaps some tooling is not being downloaded correctly.