我要评分
获取效率
正确性
完整性
易理解

Preparing a Development Environment

Server

The installation package of the video stream engine server is VideoEngine.tar.gz.

  1. Save the VideoEngine.tar.gz package to the /home/VideoEngine/Cloud directory.

    You can customize a directory for storing the package.

  2. Decompress the development package of the video stream engine server.
    tar xzvf VideoEngine.tar.gz
  3. Copy the extracted binary files to the cloud phone (for example, cloudphone_1).
    docker cp system/bin cloudphone_1:/system/
    docker cp system/etc cloudphone_1:/system/
    docker cp system/lib cloudphone_1:/system/
    docker cp system/lib64 cloudphone_1:/system/
    docker cp vendor/lib cloudphone_1:/vendor/
    docker cp vendor/lib64 cloudphone_1:/vendor/
  4. To perform secondary development on the video stream engine server, configure the AOSP environment for compilation and add the decompressed include directory to the header file directory.
    1. Configure the AOSP environment.

      Download the AOSP source code from the Android official website and run the following commands to configure the environment:

      cd android-11.0.0_r48
      repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r48
      repo sync -j8
      repo start android-11.0.0_r48 --all
      source build/envsetup.sh
      lunch aosp_arm64-eng
      make
    2. Edit the Android.mk file and add the decompressed include directory to the header file directory.
      vim Android.mk
      LOCAL_C_INCLUDES += /home/VideoEngine/Cloud/include

Client

The installation package of the video stream engine client is VideoEngineClient.tar.gz.

  1. Save the VideoEngineClient.tar.gz package to the /home/VideoEngine/Client directory.

    You can customize a directory for storing the package.

  2. Before using the video stream engine client, decompress the video stream engine client.
    tar xzvf VideoEngineClient.tar.gz
  3. To perform secondary development on the video stream engine client, configure the SDK and NDK environment (for details about the versions, see Obtaining Software Packages) and add the decompressed include directory to the dependency header file directory.

    For example, if you want to perform secondary development on the decoding module to implement the cloud phone client, you need to place the library file of the decoding module to the app directory of the project. (/home/CloudPhoneAPK is an example root path of the client project.)

    mkdir –p /home/CloudPhoneAPK/app/libs/arm64-v8a/
    cp /home/VideoEngine/Client/arm64-v8a/libVideoDecoder.so /home/CloudPhoneAPK/app/libs/arm64-v8a/

    Add the following content to the build.gradle file in the /home/CloudPhoneAPK/app directory:

    android { 
    defaultConfig { 
        # Specify the location of the library files.
        sourceSets { 
            main { 
                jniLibs.srcDirs = ['libs'] 
            } 
        }
        # Note: The C++ dynamic library must be used.
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=c++_shared"
            }
         }
    } 
    # Specify the packing rule.
        packagingOptions { 
            doNotStrip "*.so" 
        } 
    }

    To reference the decoding module in the .cpp project, edit the CMakeLists.txt file in the /home/CloudPhoneAPK/app/src/main/cpp directory, link the header file, and import the dynamic library.

    # Link the header file.
    include_directories(/home/VideoEngine/Client/include) 
    # Declare the dynamic library.
    add_library(libVideoDecoder SHARED IMPORTED) 
    # Import the dynamic library.
    set_target_properties(libVideoDecoder 
            PROPERTIES IMPORTED_LOCATION 
            /home/VideoEngine/Client/arm64-v8a/libVideoDecoder.so) 
    # Include it in the compilation scope.
    target_link_libraries(${PROJECT_NAME} libVideoDecoder)