ACPM's efficient C++ component management makes the audio and video terminal SDK perform better and have higher stability

This column will share a series of technical articles on Alibaba Cloud Video Cloud MediaBox, provide an in-depth analysis of the technical architecture, technical performance, development energy efficiency and best practices of the audio and video development tool, and start the audio and video development journey together. This article is about the technical architecture of MediaBox, focusing on  ACPM introduction, technical architecture and efficient management Introduction to how to improve the stability and performance of the audio and video terminal SDK through the efficient component management of MediaBox ACPM .

Afu|Author

01 Introduction to ACPM

background

In view of the digitization of audio and video in the industry, Alibaba Cloud Video Cloud proposedMediaBox terminal integration suite, which integrates playback, live broadcast, and ultra-low latency Live broadcast, real-time audio and video communication, short video creation and other audio and video capabilities, but this is not simply stacking SDKs, but through reasonable architectural design, abstraction and reuse of various basic components, etc., to finally build a An integrated SDK with high performance, high availability, high flexibility, pluggability and easy scalability.

Thanks to the high degree of reuse of components, terminal integration can always provide the same combination of capabilities in a smaller package. However, with the deepening of componentization, issues such as component version management, dependencies between components, team collaboration issues caused by different component development progress, and the stability and performance of the components themselves all need to be better solved. Therefore, we designed ACPM will uniformly solve the problems that arise during the componentization process.

concept

The full name of ACPM is Aliyun C++ Package Manager. It mainly solves the problem of C++ package management. It is also responsible for component resources, aar, source code debugging, etc. The core goal of ACPM is to simplify dependency library management in projects, reduce tedious configuration work, improve developer productivity, and ensure project stability.

manual

The package management tool itself mainly solves package version management and dependency management, but its essence is to solve teamcollaboration problems. The purpose of using the tool It is also for the teamto improve efficiency, and at the same time toimprove the performance and stability of the audio and video terminal SDK >. Therefore, the tool process is described below from different perspectives of the two roles of component users and providers:

• Dependent components (user): Responsible for analyzing dependencies based on descriptions, downloading corresponding components, and generating compiled files required for the cmake project;

• Publishing components (provider): Responsible for hosting component static libraries (on MTL) and recording specific information at the time of publishing for dependency analysis.

02 Technical ideas

ACPM started with the issue of package management, but now we are talking about ACPM and it is not limited to package management, but a series of tools in the entire componentization process. The core idea of ​​componentization is divide and conquer. We disassemble a huge and complex project into small components and then combine them. Each small component is actually Is an independent individual. Like SDK development and application development, component development also has a strict research and development process. Only by managing each small component can a huge and complex project be managed.

To make the componentization process efficient, we not only need to solve the problem of package management, but also need to pay attention to the entire R&D process of componentization. While optimizing the whole, we also provide corresponding tools for each node to improve efficiency.

03 Efficient management

The following is an introduction to how we do it for each node of the component development process.

Component development

To complete componentization efficiently, the most direct idea is to do it in parallel and develop each component in parallel. Of course, this requires that the components themselves be independent and physically isolated. However, independent components require independent projects. To achieve multi-platform reuse of components, this requires each component to establish a platform project for development and debugging. The workload is undoubtedly very repetitive and cumbersome.

Although the functional responsibilities of each component are different, the engineering structure of each component is actually similar, so we provide tool scripts in this link to achieve one-click Build a standardized component project, so that component developers only need to focus on the logic development itself.

* Interestingly, our component development project itself is also organized through ACPM package management, which fully illustrates that everything is a component.

Component testing

Although components can be physically isolated, they still have to be combined together. To achieve efficient integration, this requires the components to be stable before fusion. If the problems of the components themselves are not discovered until after the fusion, It is inefficient both for problem debugging and collaboration efficiency, so components need to be tested before release. Since our components are reused across multiple platforms, it would be very labor-intensive to require each version of the component to be tested on all platforms one by one. Therefore, we needautomationto complete this task.

Based on this, we provide a complete test platform for implementation. The components only need to be configured once on the platform, and all subsequent versions can be reused< a i=2>. We also provide the equipment required for each platform. Component developers only need to write test cases, and everything else can be automated. This not only improves the efficiency of component development, but also ensures the stability of the component.

Component build & release

Writing code, compiling, and debugging are the daily routine of technical students. In terms of improving development efficiency, reducing compilation time is a very profitable thing. For this reason, most of our components will provide precompiled libraries for each platform. But for components that are reused on multiple platforms, the process is very cumbersome. Moreover, unlike the source code, the precompiled library may also produce ABI compatibility issues that are difficult to find. Moreover, tracing problems in the precompiled library is more difficult than with the source code. , so we need to record the source code, build process, etc. of each precompiled release to better troubleshoot problems.

Although there are many problems to be solved, the efficiency gains are worthy of our efforts to overcome them one by one. In order to solve the above problems, we wrote plug-ins based on the group's MTL, provided unified compilation chain tools for each platform, automated security detection before release, and provided robots to improve release efficiency< a i=2>, etc., to achieve efficient management of component construction and release.

Component usage

ACPM provides a simple and powerful way to integrate dependent libraries. You only need to write a json file to describe the name and version of the required dependent libraries. There is no need to download and compile manually. The tool will automatically handle these steps, allowing developers to focus on the project. core development.

In order to make development more efficient, the tool will also download corresponding resources on demand and cache them accordingly based on the platform currently built by the developer.

At the same time, in order to facilitate the use of R&D personnel, the tool can be usedout of the box, and does not even need to be installed in advance. Just put the tool in the warehouse As a sub-module, other members of the R&D team can use it directly, which greatly improves the efficiency of component usage.

{
  ...
  "dependencies": {
    "包名": "版本号",
    "包名": {
      "version": "版本号",
      "forcedSpecifyVersion": "强制指定的版本号",
      "fromRepository": "正式 或者 开发版本",
      "sourceCodeFirst": "是否优先选用源码依赖",
      "customSourcePath": "自定义源码路径"
    }
  }
  ...
}

* We support simple description of dependencies by name and version, and also support custom descriptions to meet more customization needs.

Simple projects (as shown above) usually do not have problems, but complex projects will inevitably encounter dependency library conflicts. ACPM canautomatically detect and resolve conflicts between dependent libraries, thereby reducing problems caused by different library versions and ensuring the stability and reliability of the project. .

Usually, conflict resolution means finding a version that makes all dependent libraries compatible, and the basis for judging compatibility is often API compatibility. Since many of the libraries we provide are precompiled libraries, we not only consider API compatibility but also consider ABI compatibility is achieved, making the project more stable and reliable.

In addition, under the premise of ABI compatibility, we can automatically resolve conflicts without recompiling sub-components by forcibly specifying conflicting component versions, thereby meeting the needs for efficient management on the basis of high component stability.

Component Stability Analysis

Although we have a series of means to ensure stability, the reality is that we will always encounter unexpected crashes, so we need to monitor the stability of the SDK. In order to provide customers with the smallest package and the best SDK, we will eventually combine the components into the same dynamic library and remove the corresponding debugging symbols, but this will make it difficult for us to know where the crash occurred. This will take up more time and energy for R&D personnel, and it will be difficult to have a quantitative understanding of the stability of the component itself.

As for the manual processing process, we found that this process can be improved throughtool automation to improve the overall efficiency, so we designed the following process:

Since our components have independent use cases for testing, the above unexpected problems will only be discovered on the specific SDK. In order to improve the efficiency of solving component problems, we support the easy switching of the component's precompiled library access to source code on the SDK Access, which only requires modifying a configuration switch in the dependency description, thereby improving the efficiency of component stability analysis.

04 Conclusion

ACPM is a powerful and flexible C++ dependency library management tool, which aims to provide developers with a way to simplify dependency library management. Based on the efficient management of ACPM, we have released official versions of dozens of components, standardized the development and release process of components, developed various efficiency improvement tools around componentization, and established a number of standardized processes. In the future, we will continue to Refine processes and tools to ensure our continuous, stable and efficient output.

To learn more about audio and video terminal SDK technology, welcome to join the MediaBox experience group by scanning the QR code on DingTalk to communicate and share with us.

DingTalk group link

Guess you like

Origin blog.csdn.net/VideoCloudTech/article/details/134873849