Video decoding rendering method, apparatus and electronic device

By using a single decoder instance in the vehicle system to distribute the video data after decoding the RTSP stream to multiple Surfaces for rendering, the problems of resource waste and synchronization difficulties when multiple applications access the system are solved. This achieves efficient and low-resource-consumption video data sharing, improving system stability and scalability.

CN123185403APending Publication Date: 2026-11-27CHINA FAW CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611216984.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing vehicle systems, when multiple application modules access camera data simultaneously, problems arise such as wasted network bandwidth, excessive resource consumption, synchronization difficulties, excessive server load, poor scalability, increased power consumption, and reduced reliability.

Method used

A single decoder instance is used to distribute the video data after decoding one RTSP stream to multiple Surfaces for rendering. Efficient sharing of video data is achieved through Surface creation module, AIDL communication module, data receiving module, decoder module, Surface manager module and data distribution module.

Benefits of technology

It significantly saves hardware decoder resources, reduces CPU load and memory usage, reduces power consumption, improves system stability and scalability, ensures video data synchronization, alleviates network congestion, reduces server load, and simplifies system architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123185403A_ABST
    Figure CN123185403A_ABST
Patent Text Reader

Abstract

The application discloses a video decoding rendering system and method, and relates to the field of intelligent cockpits.The system comprises a client and a server.The server comprises a pull streaming module, a decoder module, a Surface manager module, a data distribution module and a concurrent rendering module.The decoder module is used for creating and maintaining a unique decoder instance, and decoding one RTSP video stream data by using the unique decoder instance.The Surface manager module is used for maintaining a Surface list by using a thread-safe container.The data distribution module is used for selecting an optimal data distribution strategy according to a Surface type.The video decoding rendering system and method provided by the application realize efficient and low-resource-consumption multi-application video data sharing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent cockpit technology, and in particular to video decoding and rendering methods, apparatus, and electronic devices. Background Technology

[0002] In modern automotive electronic systems, cameras have become an indispensable component, widely used in functions such as dashcams, parking assistance, and surround-view monitoring. Besides the traditional LVDS transmission method, an increasing number of camera data transmissions utilize Ethernet networks. With the development of intelligent connected vehicles, more and more applications require simultaneous access to network camera data, such as dashcams, 360-degree surround-view systems, entertainment photography, big data recognition and processing, and in-vehicle interactive games.

[0003] Traditional automotive video data Ethernet transmission architectures typically employ a point-to-point mapping model of "one application - one video data transmission connection - one decoder". In this architecture, each application requiring camera data needs to independently establish an RTSP connection and launch an independent decoder instance to acquire the video data.

[0004] The common approach in existing vehicle systems is for each application module to establish an independent RTSP connection to acquire camera data. These existing technical solutions have the following obvious technical defects and pain points: Significant waste of network bandwidth: When multiple applications access the same camera simultaneously, multiple RTSP connections need to be established, consuming significantly more network bandwidth. In the limited network environment of an in-vehicle system, this can lead to network congestion and affect video transmission quality.

[0005] Excessive consumption of system resources: Each application needs to launch an independent decoder instance, leading to redundant consumption of CPU and memory resources. Given the limited computing resources of the vehicle ECU, parallel operation of multiple decoders can severely impact system performance.

[0006] Data synchronization difficulties: It is difficult to maintain precise timing synchronization between multiple decoder instances, resulting in time deviations in video data between different applications, which affects the accuracy of multi-application collaborative work.

[0007] Excessive server load: Multiple RTSP connections can put a heavy load on the camera or video server, potentially affecting the stability of the video server or even causing the service to become unavailable.

[0008] Poor scalability: When adding new applications, a complete video acquisition chain needs to be re-established, including network connection, decoder initialization, etc., which increases the system complexity and deployment difficulty.

[0009] Increased power consumption: The parallel operation of multiple decoders will significantly increase the power consumption of the vehicle equipment, affecting battery life and system heat dissipation.

[0010] Increased costs: The need for more network bandwidth and computing resources increases the hardware and operating costs of the in-vehicle system.

[0011] Reduced reliability: Multiple independent connection and decoder instances increase the number of points of failure in the system, and a problem in any of these links may affect the normal operation of the corresponding application.

[0012] These technical deficiencies are particularly prominent in the resource-constrained and highly reliability-critical environment of in-vehicle systems, making it imperative to find a technical solution that can effectively address these issues. Summary of the Invention

[0013] The purpose of this invention is to provide a video decoding and rendering system and method that simultaneously distributes the video data decoded from one RTSP stream to multiple Surfaces for rendering through a single decoder instance, thereby achieving efficient and low-resource-consumption multi-application video data sharing.

[0014] This invention provides the following solution: According to one aspect of the present invention, a video decoding and rendering system is provided, the video decoding and rendering system comprising: Client and server; The client includes: a Surface creation module, an AIDL communication module, and a data receiving module; The server-side components include: a streaming module, a decoder module, a Surface manager module, a data distribution module, and a concurrent rendering module. The Surface creation module is used to create Surface objects; The AIDL communication module is used to establish cross-process communication connections with the server to register and remove Surfaces. The data receiving module is used to receive video data distributed by the server; The streaming module is used to receive one RTSP video stream and to parse and buffer the received RTSP video stream. The decoder module is used to create and maintain a unique decoder instance, and to decode the RTSP video stream data using the unique decoder instance; The Surface Manager module is used to maintain a list of Surfaces using a thread-safe container. The list of Surfaces stores various Surface objects that the client registers with the server through the AIDL communication module. The data distribution module is used to select the optimal data distribution strategy for distributing the RTSP video stream data to the client based on the Surface type; The concurrent rendering module is used to protect concurrent access to the Surface list using a read-write lock mechanism, and supports parallel rendering of the RTSP video stream data to multiple Surface objects created by clients.

[0015] Optionally, one RTSP video stream can come from a DVR app, a Lepai app, or a large model application.

[0016] Optionally, DVR apps, Lepai apps, or large model applications can complete the type declaration of the Surface object at the same time as completing Surface registration.

[0017] Optionally, Surface objects include: SurfaceView objects, TextureView objects, and ImageReader objects.

[0018] Optionally, establish a cross-process communication connection with the server to register the Surface, including: The Surface object created by the client application is converted into the IBinder interface through the asBinder() method and then passed to the server via the AIDL communication module. After receiving the IBinder, the server converts it into an ANativeWindow object and adds it to the Surface Manager for unified management.

[0019] Optionally, the optimal data distribution strategy can be selected based on the Surface type, including: For rendering-type Surfaces, the server uses EGL / OpenGL ES for GPU-accelerated rendering, converting YUV video frames into RGB format and drawing them onto the Surface, leveraging the parallel computing capabilities of the GPU to achieve efficient rendering. For data-driven Surfaces, the server uses a direct memory copy method to directly transmit the raw YUV data to the client process for video analysis and feature extraction.

[0020] Optionally, a read-write lock mechanism can be used to protect concurrent access to the Surface list, supporting parallel rendering to multiple client-created Surface objects, including: Use std::shared_lock to protect the traversal operation of the Surface list; In the addition and removal of Surfaces, use std::unique_lock to write locks that protect the modification of the list.

[0021] Optionally, the client can also request the server to dynamically register and remove Surface objects.

[0022] Optionally, dynamic registration and removal management of Surface objects can be implemented, including: The client can dynamically register a new Surface using the AddSurface method of the AIDL interface without restarting the video service; The RemoveSurface method removes Surfaces that are no longer needed, and the server automatically cleans up the corresponding resources. The server implements a client disconnection detection mechanism, which automatically cleans up the registered Surface resources when the client process exits abnormally.

[0023] According to a second aspect of the present invention, a video decoding and rendering apparatus is provided, implemented using the video decoding and rendering system described above, comprising: The client creates a Surface object; The client and server establish a cross-process communication connection to register and remove Surfaces; The server receives one RTSP video stream and parses and caches the received RTSP video stream. The server creates and maintains a unique decoder instance, and uses the unique decoder instance to decode the RTSP video stream data. The server uses a thread-safe container to maintain a list of Surfaces, which stores various Surface objects registered by the client with the server through the AIDL communication module. The server selects the optimal data distribution strategy based on the Surface type to distribute the RTSP video stream data to the client. The client receives video data distributed by the server. The server uses a read-write lock mechanism to protect concurrent access to the Surface list, and supports parallel rendering of the RTSP video stream data to multiple Surface objects created by clients.

[0024] The above solution achieves the following beneficial technical effects: (1) Significantly saves hardware decoder resources: By providing video data for multiple applications through a single decoder, the problem of hardware decoder resource competition is completely solved. Compared with traditional solutions, it can save 100% of decoder resource consumption, so that systems that originally only supported single-channel decoding can also meet the needs of multiple applications.

[0025] (2) Significantly reduce CPU load and memory usage: avoids multiple software decoders running at the same time, reduces CPU and memory usage by a factor of two, and frees up resources for other important functions, thus improving the overall performance of the system.

[0026] (3) Significantly reduce power consumption: Reducing the number of decoder instances can significantly reduce system power consumption, extend device battery life, and reduce heat generation issues.

[0027] (4) Enhanced system stability: Reduced system complexity and potential failure points, significantly improved system stability and greatly reduced probability of crash.

[0028] (5) Enhanced scalability: Not limited by the number of hardware decoders, the number of applications can be flexibly increased as needed, significantly improving scalability.

[0029] (6) Ensure accurate synchronization: All applications are based on the same decoding timing to ensure accurate synchronization of video data between multiple applications, and the synchronization error can be controlled within 10 milliseconds.

[0030] (7) Save network bandwidth: By connecting multiple applications through a single RTSP, the network bandwidth usage is greatly reduced, alleviating the problem of in-vehicle network congestion.

[0031] (8) Reduce server pressure: A single RTSP connection provides data for multiple applications, significantly reducing the load pressure on the video server and improving server stability.

[0032] (9) Simplified system architecture: The unified video data distribution architecture simplifies system design and reduces development and maintenance complexity.

[0033] (10) Support dynamic management: Supports dynamic addition or removal of applications at runtime without restarting the entire system, improving the flexibility of use. Attached Figure Description

[0034] Figure 1 This is an architecture diagram of a video decoding and rendering system provided in one or more embodiments of the present invention; Figure 2 This is a flowchart of the Surface registration process in a video decoding and rendering system provided by one or more embodiments of the present invention; Figure 3 This is a flowchart illustrating the data distribution strategy selection in a video decoding and rendering system provided by one or more embodiments of the present invention; Figure 4 This is a flowchart of concurrent access in a video decoding and rendering system provided by one or more embodiments of the present invention; Figure 5 This is a flowchart of dynamic registration and removal management in a video decoding and rendering system provided by one or more embodiments of the present invention; Figure 6 This is a flowchart of a video decoding and rendering method provided in one or more embodiments of the present invention; Figure 7 This is a flowchart of a video decoding and rendering method provided in one or more embodiments of the present invention. Detailed Implementation

[0035] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0036] Figure 1 This is a system architecture diagram of a video decoding and rendering system provided in one or more embodiments of the present invention. See also Figure 1 The video decoding and rendering system includes: client 11 and server 12.

[0037] The client 11 includes the following modules: Surface creation module 111, AIDL communication module 112, and data receiving module 113.

[0038] The server-side module 12 includes the following modules: streaming module 121, decoder module 122, Surface manager module 123, data distribution module 124, and concurrent rendering module 125.

[0039] The function of the Surface creation module 111 is to create the corresponding Surface object on the client side. The Surface object is the target object for video data rendering. The rendering of the video data stream can only be completed after the corresponding Surface object is created on the client side and registered on the server side.

[0040] The function of AIDL communication module 112 is to enable communication between the client and the server through the creation of AIDL interfaces. It's important to note that the communication between the client and server implemented by the AIDL communication module is a cross-process communication.

[0041] The function of the data receiving module 113 is to receive video stream data. It should be noted that in this embodiment, only one input video data stream is received. Furthermore, the data source for the data received by the client's data receiving module 113 is the input RTSP video stream data from the server.

[0042] The function of the streaming module 121 is to pull the input video stream data.

[0043] The function of decoder module 122 is to create and maintain a unique decoder instance and use the unique decoder instance to decode the RTSP video stream data.

[0044] The function of Surface Manager module 123 is to maintain a list of Surfaces using a thread-safe container. The list of Surfaces stores various Surface objects registered by the client with the server through the AIDL communication module.

[0045] The function of the data distribution module 124 is to select the optimal data distribution strategy for distributing the RTSP video stream data to the client based on the Surface type.

[0046] The function of the concurrent rendering module 125 is to use a read-write lock mechanism to protect concurrent access to the Surface list and support the parallel rendering of the RTSP video stream data to multiple Surface objects created by clients.

[0047] As described earlier in this invention, in existing video decoding architectures, there is typically one video display interface, and a corresponding decoder needs to be equipped on the server side. This architecture configuration is not a major problem when the number of video display interfaces is small. However, once the number of video display interfaces in the cockpit increases, the computational load on the server side will increase sharply. Simply providing decoding services for each video display screen in the cockpit consumes a large amount of the server's computing power, causing other applications to waste a significant amount of computing resources, resulting in low service efficiency.

[0048] The solution provided in this embodiment involves configuring only one decoder on the server side. By decoding video data on this single decoder, the decoded video data is distributed to multiple different display interfaces, thereby freeing up server-side computing resources and enabling more server-side computing power to serve other applications. In other words, this embodiment provides a one-to-many decoding architecture.

[0049] In the decoding architecture provided in this embodiment, each client receiving video decoding data needs to launch a Surface object. Based on the Surface object launched on the client and registered on the server, the server can distribute the decoded video data, and the client can render the video display interface. Therefore, the Surface object plays a crucial role in the solution provided in this embodiment.

[0050] It should also be noted that in the solution provided in this embodiment, the Surface parent class can have different subclasses. That is, the class used to derive Surface objects does not have to be the Surface parent class itself, but can be other subclasses that inherit from the Surface parent class.

[0051] This allows different display needs on the client side to be customized by inheriting from the Surface parent class and extending its functionality. In other words, in a one-to-many decoding architecture, although different clients use the same video data decoding service, they can each adopt a customized rendering process suitable for their own needs when it comes to rendering the video data display interface, thus facilitating the integration of different rendering requirements.

[0052] The execution process of the solution provided in this embodiment will be described in detail below. First, it is necessary to complete the registration of the Surface objects corresponding to different clients on the server.

[0053] The registration of Surface objects on the server side is initiated based on the Surface object registration request sent by the client. In other words, the server will only start the Surface object registration process after receiving a Surface object registration request from the client.

[0054] Furthermore, the registered Surface object is not necessarily generated directly by the Surface parent class, but may be generated by other subclasses that inherit from the Surface parent class.

[0055] Furthermore, all Surface objects that send requests are Surface objects that need to receive video decoding data distribution from the server. Only after a registration request is sent and the corresponding server registration action is completed will the server distribute video decoding data to the corresponding Surface object.

[0056] In addition, all Surface objects that have completed Surface object registration need to be stored in the Surface list.

[0057] After registering the Surface object, the server begins receiving the RTSP video streams that need to be decoded. In this embodiment, it's important to note that the server only receives one RTSP video stream. That is, the server's decoding operation targets only one specific RTSP video stream it has received.

[0058] After receiving the RTSP video stream, the decoding operation for the video stream is performed.

[0059] After the decoding operation is completed, the resulting video data can be distributed to various clients and directly rendered in the interface.

[0060] Next, the corresponding decoded video data will be distributed.

[0061] It should be understood that in order to complete the distribution of data, the first thing to do is to identify the target of the data distribution, that is, what are the target Surface objects?

[0062] In this embodiment, all distribution targets should be Surface objects that already exist in the Surface object list. That is, only Surface objects that have completed Surface object registration can be selected as distribution targets for further decoding of video data.

[0063] It should be noted that under the general principles of Surface object selection mentioned above, various different Surface object selection strategies can be applied. For example, when it is necessary to distribute the decoded video stream to a specific type of Surface object, the selection of Surface objects can be completed according to the type of the Surface subclass. Furthermore, when there are clear requirements for the timeliness of video transmission, the selection of Surface objects can be completed according to pre-calculated video response speed.

[0064] After selecting the target Surface object, the final step is to render the display interface based on the decoded video data.

[0065] Typically, there are more than one Surface object in the Surface object list. Therefore, the rendering of the display interface during the interface rendering process is the simultaneous rendering of multiple display interfaces. In other words, in this embodiment, the rendering performed is usually a parallel rendering operation.

[0066] In this embodiment, all Surface objects that need to receive the decoded video stream are pre-registered on the server. After the server completes the decoding of the original video data, it distributes the decoded video data according to the multiple registered Surface objects. This allows the video data to be displayed on the screens of multiple clients after the server performs one decoding operation, thus achieving one decoding of video data and video data display on multiple different clients.

[0067] Another point to note is that a read-write lock mechanism is used during the concurrent rendering of multiple Surface objects. This mechanism controls the read and write operations of different Surface objects, maintaining a smooth and orderly concurrent rendering process.

[0068] Figure 2 This is a flowchart illustrating the Surface registration process in a video decoding and rendering system provided by one or more embodiments of the present invention. See also... Figure 2 Establish a cross-process communication connection with the server to register the Surface, including: S21, the Surface object created by the client application is converted into the IBinder interface through the asBinder() method and passed to the server via the AIDL module.

[0069] S22. After receiving the IBinder, the server converts it into an ANativeWindow object and adds it to the Surface Manager for unified management.

[0070] The registration of Surface objects on the server involves communication between Surface objects in different processes.

[0071] After creating a Surface object, the client application converts the Surface object it created into an IBinder interface using the asBinder method provided by the client application itself.

[0072] After converting the Surface object on the client application into an IBinder interface, the resulting IBinder interface is transmitted to the server through the AIDL module.

[0073] After receiving the IBinder interface transmitted by the client through the AIDL module, the server wraps it into an ANativeWindow object and adds the wrapped ANativeWindow to the Surface Manager for unified management.

[0074] The Surface object corresponding to the ANativeWindow that has been added to the Surface Manager is equivalent to having completed the registration process on the server side.

[0075] Figure 3 This is a flowchart illustrating the data distribution strategy selection process in a video decoding and rendering system provided by one or more embodiments of the present invention. See also... Figure 3 Select the optimal data distribution strategy based on the Surface type, including: For S31, for rendering-type Surfaces, the server uses EGL / OpenGL ES for GPU-accelerated rendering, converting YUV video frames into RGB format and drawing them onto the Surface, leveraging the parallel computing capabilities of the GPU to achieve efficient rendering.

[0076] For S32, for data-type Surfaces, the server uses a direct memory copy method to directly transmit the raw YUV data to the client process for video analysis and feature extraction.

[0077] In this embodiment, the server will select the optimal data distribution strategy based on different Surface object types.

[0078] In this embodiment, Surface objects are divided into: rendering Surface objects and data Surface objects.

[0079] For rendering-type Surfaces, the server uses EGL / OpenGL ES for GPU-accelerated rendering, converting YUV video frames into RGB format and drawing them onto the Surface, leveraging the parallel computing capabilities of the GPU to achieve efficient rendering.

[0080] For data-driven Surfaces, the server uses a direct memory copy method to directly transmit the raw YUV data to the client process for video analysis and feature extraction.

[0081] Figure 4 This is a flowchart illustrating concurrent access in a video decoding and rendering system provided by one or more embodiments of the present invention. See also... Figure 4 It uses a read-write lock mechanism to protect concurrent access to the Surface list and supports parallel rendering to multiple client-created Surface objects, including: S41, use std::shared_lock to protect the traversal operation of the Surface list.

[0082] S42, in the Surface addition and removal operations, use std::unique_lock to write lock protection list modification operations.

[0083] On the server side, Surface objects that have completed the registration process are stored in the server's Surface list. Furthermore, Surface objects that have been added to the Surface list can be removed from the Surface list upon client request.

[0084] Therefore, the data stored in the Surface list plays a crucial role in the entire video data rendering process of the Surface object. Thus, ensuring the security of reading and writing the Surface list is of paramount importance for effective video data rendering.

[0085] In this embodiment, a read-write lock mechanism is used to ensure the data security of the Surface list.

[0086] Specifically, read-write locks include read operation locks and write operation locks.

[0087] The read lock is named std::shared_lock. Using std::shared_lock, traversal operations on the Surface list can be protected.

[0088] The write operation lock is named std::unique_lock. Using std::unique_lock ensures data safety during list modification operations.

[0089] Figure 5 This is a flowchart illustrating the dynamic registration and removal management in a video decoding and rendering system provided by one or more embodiments of the present invention. See also... Figure 5 Dynamic registration and removal management of Surface objects, including: S51 allows clients to dynamically register new Surfaces using the AddSurface method of the AIDL interface without restarting the video service.

[0090] S52 removes unwanted Surfaces using the RemoveSurface method, and the server automatically cleans up the corresponding resources.

[0091] S53 implements a client disconnection detection mechanism on the server side, automatically cleaning up its registered Surface resources when the client process exits abnormally.

[0092] The dynamic registration and removal management of Surface objects is divided into registration management and removal management. Registration management refers to adding Surface objects to the server's registration list. Removal management refers to deleting Surface objects from the server's registration list.

[0093] The client application adds Surface objects to the Surface list using the AddSurface method. The call to the AddSurface method relies on the functionality of the AIDL interface.

[0094] Client applications handle the clearing of Surface objects through a two-tiered mechanism. The first tier is proactive cleanup by the client application. Client applications can proactively clean up Surface objects by calling the RemoveSurface method.

[0095] The second layer is proactive cleanup on the server side. The server is equipped with a client disconnection detection mechanism. With the help of this mechanism, the server can promptly detect whether a client has abnormally exited.

[0096] Once the server detects that a client has exited abnormally, it will automatically start cleaning up the Surface resources registered by that client.

[0097] Figure 6 This is a flowchart of a video decoding and rendering method provided in one or more embodiments of the present invention. See also... Figure 6 The video decoding and rendering method includes the following steps: S61, the client creates a Surface object.

[0098] S62 establishes a cross-process communication connection between the client and the server to register and remove Surfaces.

[0099] S63: The server receives one RTSP video stream and parses and caches the received RTSP video stream.

[0100] S64, the server creates and maintains a unique decoder instance, and uses the unique decoder instance to decode the RTSP video stream data.

[0101] S65, the server uses a thread-safe container to maintain a list of Surfaces, which stores various Surface objects registered by the client with the server through the AIDL communication module.

[0102] S66, the server selects the optimal data distribution strategy based on the Surface type to distribute the RTSP video stream data to the client.

[0103] S67, the client receives video data distributed by the server.

[0104] S68, the server uses a read-write lock mechanism to protect concurrent access to the Surface list, and supports parallel rendering of the RTSP video stream data to multiple Surface objects created by clients.

[0105] This embodiment provides a brief execution process of the video decoding and rendering method.

[0106] First, the client application needs to create its own Surface object for rendering video data. It's important to note that a Surface object refers to all objects belonging to the Surface parent class. Objects of other subclasses that inherit from the Surface parent class are also called Surface objects.

[0107] The client establishes a cross-process communication connection with the server. This connection enables the registration and removal of Surface objects created by the client.

[0108] Next, the server receives one RTSP video stream from the RTSP data source. In this embodiment, all video data rendering operations originate from this single RTSP video stream. That is, in this embodiment, all video data rendering operations originate from the same data source.

[0109] After receiving the aforementioned RTSP video stream, the server continues to parse and cache the video stream data.

[0110] Next, the server needs to perform an important task: decoding the received video stream data. It's crucial to note that all decoding of the video stream data on the server side is implemented by a single, dedicated decoder instance. In other words, the rendering data for all Surface objects created by the client originates from this single decoder instance.

[0111] Using a single decoder instance to perform decoding of all rendering data avoids repeated decoding of the same video data and saves server-side computing resources.

[0112] After encrypting the video data, the next step is to distribute the decoded video data. It should be understood that the distribution of decoded video data is performed based on the Surface objects already registered in the server's Surface object list.

[0113] Because Surface objects that have completed the registration process are stored in a list of Surface objects, the distribution of decoded video data is performed based on this list.

[0114] The server uses a thread-safe container to maintain the list of Surfaces.

[0115] Figure 7 This is a flowchart of a video decoding and rendering method provided in one or more embodiments of the present invention. See also... Figure 7The video decoding and rendering method includes the following steps: S701, the video server registers the AIDL interface with the system service manager.

[0116] S702, the client is used to bind services to the video server.

[0117] S703, Creation of Surface objects for client applications.

[0118] S704, the client application converts the created Surface object into an IGraphicBufferProducer.

[0119] S705, the client application adds Surface objects to the Surface list on the video server.

[0120] In S706, the video server wraps the Surface object added by the client application as an ANativeWindow.

[0121] S707 adds the packaged ANativeWindow to the Surface list and returns the registration result to the client application.

[0122] S708, the video server receives RTSP video streams.

[0123] The S709 uses a single decoder instance to perform hardware decoding on received RTSP video streams.

[0124] The S710 distributes YUV data to client applications, which then perform rendering operations based on their own types.

[0125] S711: The client application sends a request to the video server to remove the Surface object, and the video server removes the Surface object according to the request.

[0126] S712, if the client application dies or exits, the video server detects that the client is disconnected.

[0127] S713, the video server automatically cleans up Surface resources.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A video decoding and rendering system, characterized in that, include: Client and server; The client includes: a Surface creation module, an AIDL communication module, and a data receiving module; The server-side components include: a streaming module, a decoder module, a Surface manager module, a data distribution module, and a concurrent rendering module. The Surface creation module is used to create Surface objects; The AIDL communication module is used to establish cross-process communication connections with the server to register and remove Surfaces. The data receiving module is used to receive video data distributed by the server; The streaming module is used to receive one RTSP video stream and to parse and buffer the received RTSP video stream. The decoder module is used to create and maintain a unique decoder instance, and to decode the RTSP video stream data using the unique decoder instance; The Surface Manager module is used to maintain a list of Surfaces using a thread-safe container. The list of Surfaces stores various Surface objects that the client registers with the server through the AIDL communication module. The data distribution module is used to select the optimal data distribution strategy for distributing the RTSP video stream data to the client based on the Surface type; The concurrent rendering module is used to protect concurrent access to the Surface list using a read-write lock mechanism, and supports parallel rendering of the RTSP video stream data to multiple Surface objects created by clients.

2. The system according to claim 1, characterized in that, One RTSP video stream comes from a DVR app, a Lepai app, or a large model application.

3. The system according to claim 1, characterized in that, DVR apps, Lepai apps, or large model applications should complete the type declaration of the Surface object at the same time as completing Surface registration.

4. The system according to claim 1, characterized in that, Surface objects include: SurfaceView objects, TextureView objects, and ImageReader objects.

5. The system according to claim 1, characterized in that, Establish a cross-process communication connection with the server to register the Surface, including: The Surface object created by the client application is converted into the IBinder interface through the asBinder() method and then passed to the server via the AIDL communication module. After receiving the IBinder, the server converts it into an ANativeWindow object and adds it to the Surface Manager for unified management.

6. The system according to claim 1, characterized in that, Select the optimal data distribution strategy based on Surface type, including: For rendering-type Surfaces, the server uses EGL / OpenGL ES for GPU-accelerated rendering, converting YUV video frames into RGB format and drawing them onto the Surface, leveraging the parallel computing capabilities of the GPU to achieve efficient rendering. For data-driven Surfaces, the server uses a direct memory copy method to directly transmit the raw YUV data to the client process for video analysis and feature extraction.

7. The system according to claim 1, characterized in that, A read-write lock mechanism is used to protect concurrent access to the Surface list, supporting parallel rendering to multiple client-created Surface objects, including: Use std::shared_lock to protect the traversal of the Surface list; In the addition and removal of Surfaces, use std::unique_lock to write locks that protect the modification of the list.

8. The system according to claim 1, characterized in that, The client is also used to request from the server to dynamically register and remove Surface objects.

9. The system according to claim 8, characterized in that, Dynamic registration and removal management of Surface objects, including: The client can dynamically register a new Surface using the AddSurface method of the AIDL interface without restarting the video service; The RemoveSurface method removes Surfaces that are no longer needed, and the server automatically cleans up the corresponding resources. The server implements a client disconnection detection mechanism, which automatically cleans up the registered Surface resources when the client process exits abnormally.

10. A video decoding and rendering method, characterized in that, The video decoding and rendering system according to any one of claims 1-9 is implemented by the following steps: The client creates a Surface object; The client and server establish a cross-process communication connection to register and remove Surfaces; The server receives one RTSP video stream and parses and caches the received RTSP video stream. The server creates and maintains a unique decoder instance, and uses the unique decoder instance to decode the RTSP video stream data. The server uses a thread-safe container to maintain a list of Surfaces, which stores various Surface objects registered by the client with the server through the AIDL communication module. The server selects the optimal data distribution strategy based on the Surface type to distribute the RTSP video stream data to the client. The client receives video data distributed by the server. The server uses a read-write lock mechanism to protect concurrent access to the Surface list, and supports parallel rendering of the RTSP video stream data to multiple Surface objects created by clients.