Baseband IP video data transmission method and system
By adopting a method based on shared memory and message queue in the baseband IP video data transmission system, a global memory pool is established and asynchronous access is realized, the problems of large inter-process communication delay and inflexible data transmission in the prior art are solved, and the transmission and processing efficiency of video signals are improved.
Patent Information
- Application Number
- CN202510066824.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2045-01-16
AI Technical Summary
When the prior art realizes efficient transmission and multiplexing of baseband IP video data, it faces problems such as large inter-process communication delays and inflexible data transmission. Especially in real-time ultra-high-definition video signal processing, it is difficult to ensure real-time and efficientness.
Using a method based on shared memory and message queue, a global memory pool is established, and the control communication between processes is realized through message queues, and a shared memory is used for efficient baseband data transmission. This method manages the shared memory pool in blocks, uses frame handles for data management and transmission, realizing asynchronous access on both sides of read and write, avoiding address competition and synchronization loss.
It greatly improves the transmission and processing efficiency of baseband data, realizes efficient data multiplexing and flexible distribution, and ensures the real-time and efficient real-time ultra-high-definition video signals.
Smart Images

Figure CN119520843A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of broadcasting and television technology, and in particular to a baseband IP video data transmission method and system. Background Art
[0002] With the continuous improvement of video signal resolution in the broadcasting and television industry, the video signal format has changed from the initial 576i50 to 1080i50, and then to the ultra-high-definition 2160p50 and even 4320p50 that have been gradually applied in recent years. The amount of baseband data processed has increased dramatically. At the same time, in order to improve the flexibility of baseband data scheduling in the system, the baseband IP upgrade based on the ST2110 protocol has also begun to be gradually applied in the broadcasting and television industry. In the field of source coding compression, how to flexibly and efficiently transmit and reuse massive video baseband data between various processing programs at the software level after the ST2110 acquisition card acquires the video signal has become a huge challenge.
[0003] The data stream processing framework of a real-time software encoder usually follows an approximate processing flow: (1) Acquisition: The video signal acquisition card receives the media baseband signal and stores it in the device side DDR, which is completed by peripheral hardware, such as ST2110, SDI acquisition card, etc.
[0004] (2) Transmission: Audio and video media baseband data is transmitted to the server main memory through direct memory access technology (DMA).
[0005] (3) Software processing: audio and video preprocessing, audio and video compression encoding, bitstream output, etc.
[0006] The first two steps are completed using proprietary hardware. When the baseband data enters the main memory of the operating system for software processing, it can usually be divided into two modes: single process and multi-process collaboration according to the software processing framework. Since the process is the basic unit for resource allocation and scheduling of the operating system, in order to achieve the isolation of computing and storage resources in the design of video encoding software, and to prevent abnormalities such as crashes or thread freezes from affecting other functional modules within the process, a multi-process program architecture is usually adopted. Each or several encoding channels are run as a separate process. For the transmission of signals from the device side to the host side, an independent software process is usually required to execute DMA and transmit the baseband signal to each encoding process, that is, the transmission and distribution of input baseband data between different processing processes in the operating system.
[0007] Existing inter-process communication technologies mainly include four categories: network socket-based, pipe-based, message queue-based, and shared memory-based, each with its own applicable usage scenarios.
[0008] Based on network sockets and using network transmission channels, it can be transmitted across processes and operating systems. The bandwidth is limited by the sending and receiving capabilities of the transmission network and the operating system kernel protocol stack.
[0009] Based on pipes and file descriptors, half-duplex one-way transmission has a small transmission bandwidth and is not suitable for frequent exchange of large-bandwidth data.
[0010] Based on message queues and kernel message queues, it has high performance and low latency. Data copying is required on both the reading and writing sides, and it is not suitable for frequent sending and receiving of large data blocks.
[0011] Based on shared memory, the process virtual address space is mapped to the same physical memory, with short read and write delays. It is necessary to handle read and write mutual exclusion to achieve memory access consistency.
[0012] The first important problem to be solved in inter-process communication is the consistency of read and write data. Once the reading and writing ends operate on the same memory address, competition will arise. The common means of reading and writing synchronization to solve this problem is to use semaphores and mutexes, and use another global resource to serialize the memory operations on both sides of the reading and writing in terms of timing. However, both will introduce a certain amount of synchronization loss. For a real-time ultra-high-definition baseband signal at 50 frames per second, the delay caused by the high-frequency synchronization of the reading and writing sides will directly affect the overall real-time performance of the encoding. In addition, common data transmission based on shared memory is a single-production-end and single-consumer-end structure, which cannot achieve multi-consumer-end distribution and reuse after data production. Summary of the invention
[0013] In order to solve one of the above technical defects, a baseband IP video data transmission method and system are provided in an embodiment of the present application.
[0014] A first aspect of an embodiment of the present application provides a baseband IP video data transmission method, the method being applied to an agent side, the method comprising: The proxy thread is initialized and the message queue is established; Obtaining a registration request from the encoding side, establishing a shared memory pool according to the registration request, and establishing a transmission connection with the encoding side; The shared memory pool is divided into blocks to form a plurality of frame storage units, and an ID is assigned to each frame storage unit, and an offset of each frame storage unit in the shared memory pool is calculated, wherein the ID and the offset constitute a frame handle; Two frame index queues are established for indexing frame handles in different states, frame baseband data on the device side is obtained, the frame baseband data is processed and stored in an idle frame storage unit, and the frame handle of the idle frame storage unit is placed in a frame index queue indicating that it has been written, wherein the idle frame storage unit is any frame storage unit among multiple frame storage units into which the frame baseband data has not been written; Sending the frame handle of the idle frame storage unit in the frame index queue that has been written to the encoding side, so that the encoding side reads the frame baseband data stored in the idle frame storage unit in the shared memory pool according to the frame handle of the idle frame storage unit; The receiving encoding side feeds back reception success information, and exchanges the frame handle of the idle frame storage unit between two frame index queues after the idle frame storage unit has been read and used.
[0015] A second aspect of an embodiment of the present application provides a baseband IP video data transmission method, which is applied to an encoding side, and the method includes: Initialize the encoding process and establish a message queue; Sending a registration request to the proxy side, so that the proxy side establishes a shared memory pool according to the registration request and establishes a transmission connection with the proxy side; Obtaining a frame handle of an idle frame storage unit sent by the proxy side, and reading and processing frame baseband data stored in the idle frame storage unit in a shared memory pool according to the frame handle of the idle frame storage unit, wherein the shared memory pool includes multiple frame storage units, the idle frame storage unit is any one of the multiple frame storage units, and the frame handle includes an ID of the frame storage unit and an offset of the frame storage unit in the shared memory pool; Feedback information to the proxy side so that the proxy side reclaims the frame handle of the idle frame storage unit.
[0016] A third aspect of the embodiments of the present application provides a baseband IP video data transmission system, the system comprising a proxy side and an encoding side; The proxy side includes a processor and a memory, wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 9; The encoding side includes a processor and a memory, wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the processor executes the method as described in any one of claims 10 to 12.
[0017] The baseband IP video data transmission method provided in the embodiment of the present application is based on shared memory and combined with a message queue to realize a global memory pool. The low latency of the message queue is used as the control communication channel between processes, and the high read and write bandwidth and low latency of the shared memory are used as the baseband data transmission carrier. The present application uses memory data queue classification management and time-sharing reading and writing to realize asynchronous access to data on both sides of the reading and writing. Both sides of the reading and writing do not need to wait due to address competition. As long as the memory address is obtained, they can process the relevant data separately, which greatly improves the transmission and processing efficiency of baseband data. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 This is a flowchart of a baseband IP video data transmission method described in Example 1 of the present application; Figure 2 This is a flowchart of a baseband IP video data transmission method described in Example 2 of the present application; Figure 3 This is a schematic diagram of the principles of a baseband IP video data transmission system described in Example 3 of the present application. DETAILED DESCRIPTION
[0019] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. Example 1
[0020] like Figure 1 As shown, this embodiment proposes a baseband IP video data transmission method, which is applied to the proxy side, and the proxy side can be specifically a carrier of the network card data DMA receiving program. The method specifically includes: S101, the proxy thread is initialized and a message queue is established.
[0021] Specifically, after starting the proxy program on the proxy side with the network card as the unit, the initialization of the peripheral hardware on the device side is first performed, including but not limited to driver loading and other operations. The device side can be a specific model of acquisition card, etc. Then, the message queue on the proxy side is established with the network card name as the global descriptor, that is, the named message queue mq_Eth, and the main thread starts to monitor the named message queue mq_Eth as the message consumer.
[0022] S102: Obtain a registration request from the encoding side, establish a shared memory pool according to the registration request, and establish a transmission connection with the encoding side.
[0023] Specifically, on the encoding side, the network card is also used as the global descriptor, but the message queue on the encoding side is created as a producer, that is, the encoding side message queue mq_Eth, and a registration request is sent to the proxy side through the encoding side message queue. The registration request contains the multicast URL address information on the network card.
[0024] After the proxy side receives the above registration request, it queries the shared resource mapping table of the local storage management to confirm whether the registration request of the multicast exists, that is, to identify whether the registration request of the multicast has been requested by other encoding tasks. If it does not exist, the receiving thread of the multicast is synchronously established with the device side, the request message queue mq1 of the multicast is established with the encoding side, and the shared memory pool pool1 for storing the data of the multicast is established. At the same time, the descriptor of the request message queue of the multicast and the descriptor of the shared memory pool are stored, so that the encoding side that requests the same multicast data in the future can reuse the data. Then the descriptor of the request message queue of the multicast and the descriptor of the shared memory pool are sent to the encoding side. If the registration request of the multicast already exists in the shared resource mapping table of the local storage management, then the descriptor of the request message queue of the multicast and the descriptor of the shared memory pool that have been stored can be directly sent to the encoding side, and the establishment process of the shared memory pool can be skipped.
[0025] Through the above process, the encoding side can obtain the access rights of the shared memory pool and establish the multicast receiving message queue. After the shared memory pool pool1 is established, the proxy side can start the multicast receiving thread and listen to the data request from the encoding side in the multicast request message queue mq1. After receiving the data request from the encoding side, the connection is established as a producer according to the descriptor of the multicast receiving message queue mqA_recv of the encoding side contained in the data request, so as to realize the transmission connection between the proxy side and the encoding side.
[0026] Through the above process, the proprietary data communication with the proxy side as the sender and the encoding side as the receiver is completely established. The channel uses the multicast receiving message queue mqA_recv to send data and the multicast request message queue mq1 to send responses. Subsequent baseband data transmission in the shared memory pool is carried out on this basis.
[0027] S103, dividing the shared memory pool into multiple frame storage units, assigning an ID to each frame storage unit, and calculating an offset of each frame storage unit in the shared memory pool, wherein the ID and the offset constitute a frame handle.
[0028] Specifically, when the proxy initially creates a shared memory pool for multicast data, it allocates the entire shared memory pool according to the preset total size of the shared memory pool. Then the shared memory pool is divided into blocks according to the single frame capacity as the basic unit. Each block is a basic storage unit for a data frame, that is, a frame storage unit. Each frame storage unit is divided into three areas: a synchronization frame header area, a metadata area, and a data payload area.
[0029] The synchronization frame header area does not change after initialization. It is used to verify the data frame synchronization offset on both the sending and receiving sides to avoid abnormal spread caused by damaged memory data due to out-of-bounds reading and writing.
[0030] The metadata area is used to store the attribute information of the frame data, mainly including the timestamp of the acquisition time, resolution and other frame attribute information.
[0031] The data payload area is used to store the actual acquisition frame data.
[0032] After the proxy side completes the block processing of the shared memory pool, it initializes the synchronization frame header area, writes the synchronization word, and completes the initialization of the frame storage unit in the actual shared memory pool. After the initialization is completed, the proxy side assigns an ID to each frame storage unit and uses its offset in the entire shared memory pool, that is, the frame index address, to establish a mapping table. The ID and offset constitute the frame handle of the frame storage unit, forming a frame handle management. According to the ID, the frame storage unit of the frame data can be directly looked up in the table.
[0033] S104, establishing two frame index queues for indexing frame handles in different states, obtaining frame baseband data on the device side, storing the frame baseband data in an idle frame storage unit after processing, and placing the frame handle of the idle frame storage unit into a frame index queue indicating that it has been written.
[0034] Specifically, in this embodiment, the idle frame storage unit is any frame storage unit in the plurality of frame storage units that has not been written with frame baseband data. After the frame handle is established, two frame index queues are then established to manage the use of the shared memory pool. The two frame index queues are respectively the in-use frame memory queue and the idle frame memory queue. Figure 3 As shown. Initially, the frame handles of all frame storage units are stored in the idle frame memory queue. In the subsequent transmission process, the actual data in the channel only needs the ID and offset in the frame handle. The encoding side can locate the frame storage unit of the current transmission according to the offset received by the message queue and access the specific address through pointer shifting to read the specific data, forming a transmission.
[0035] At the beginning of baseband data acquisition, after the device side transfers a frame of baseband data to the agent side by DMA, the shared memory pool management thread on the agent side grabs a frame handle from the free frame memory queue and restores the address of the free frame storage unit corresponding to the frame handle based on the frame handle. After processing the frame baseband data, the attribute information of the frame baseband data is written into the metadata area of the free frame storage unit, the actual information of the frame baseband data is written into the data load area of the free frame storage unit, and the frame handle of the free frame storage unit is stored in the frame memory queue in use.
[0036] S105: Send the frame handle of the idle frame storage unit in the frame index queue that has been written to the encoding side, so that the encoding side reads the frame baseband data stored in the idle frame storage unit in the shared memory pool according to the frame handle of the idle frame storage unit.
[0037] S106: The receiving encoding side feeds back reception success information, and exchanges the frame handle of the idle frame storage unit between two frame index queues after the idle frame storage unit is read and used.
[0038] Specifically, the proxy side is driven by an independent thread to send the shared memory pool. The frame handle of the frame memory queue in use is sent to the encoding side through the multicast receiving message queue of the encoding side according to the first-in-first-out principle. The encoding side receives the offset of the frame handle to obtain the actual frame baseband data. After the encoding program on the encoding side completes the encoding process of the frame baseband data, it notifies the proxy side through the multicast request message queue. The recycling thread on the proxy side puts the frame handle of the idle frame storage unit back into the idle frame memory queue for writing and use of the newly collected frame baseband data.
[0039] Through the above process, a closed loop is formed in which the baseband data of the shared memory pool frame is cyclically reused between processes. Among them, the proxy side is the producer and has write permission to the data, and the encoding side is the consumer and has read permission to the data. The baseband IP video data transmission method provided in this embodiment is based on shared memory and combined with message queues to realize a global memory pool. The low latency of the message queue is used as the control communication channel between processes, and the high read and write bandwidth and low latency of the shared memory are used as the baseband data transmission carrier. This embodiment uses memory data queue classification management and time-sharing reading and writing to realize asynchronous access to data on both the reading and writing sides. Both the reading and writing sides do not need to wait due to address competition. As long as the memory address is obtained, they can process the relevant data separately, which greatly improves the transmission and processing efficiency of baseband data.
[0040] The above process can realize one-to-one zero-copy baseband data reading and writing by establishing a transmission connection between the proxy side and the encoding side and multiplexing the baseband data. However, in practical applications, there is still a demand for a single producer and multiple consumers. The same frame baseband data needs to be transferred to multiple encoding sides, that is, the frame baseband data collected in the same shared memory pool is read by multiple encoding sides. For this situation, the usual solution is to use end-to-end transmission of multiple independent shared memories. In this process, it is inevitable to introduce a copy of the data to multiple shared memory blocks. In view of this, this embodiment introduces a read count mechanism on the proxy side.
[0041] Specifically, when the encoding side notifies the proxy side after using a frame of baseband data, the frame storage unit of the frame baseband data will be recycled for subsequent writing, that is, one round of its life cycle ends. When there are multiple encoding sides sharing the frame storage unit of the same frame baseband data, the life cycle of the frame storage unit depends on the encoding side that has completed the use the latest. To this end, this embodiment establishes a record table of frame storage units corresponding to each frame handle stored in the frame memory queue in use on the proxy side. The number of times each frame storage unit is read is recorded in the frame storage unit record table. When the frame memory queue in use successfully sends a frame handle of an idle frame storage unit to the encoding side once, the number of times the idle frame storage unit is read is increased by one in the frame storage unit record table, and the process ID number is recorded. Correspondingly, each time the frame baseband data information of the idle frame storage unit is fed back by the encoding side, the number of times the idle frame storage unit is read is reduced by one in the frame storage unit record table, and the encoding side records in the frame storage unit record table are cleared according to the process ID number. When the number of times the free frame storage unit in the frame storage unit record table is read is zero, it means that all encoding sides have completed the use of the free frame storage unit. At this time, the frame handle of the free frame storage unit is put back into the free frame memory queue. The increase and decrease operations of this read count are all performed on the proxy side, driven by the sending or recycling of the message queue to avoid synchronization between processes.
[0042] Furthermore, in actual applications, the encoding side may be unable to feed back information to the proxy side due to abnormal situations such as a crash of the encoding program. In this regard, this embodiment may add a forced recovery mechanism and a heartbeat mechanism.
[0043] Specifically, the forced recycling mechanism will periodically check whether the frame handle transmission process of the frame baseband data in the frame memory queue in use has been cleared. If the transmission process has been cleared, the number of times the frame storage unit corresponding to the transmission process has been read in the frame storage unit record table will be reduced by one and the process record will be cleared.
[0044] The heartbeat mechanism needs to add a heartbeat type protocol to the communication of the message queue. When no feedback information is received from the encoding side within the predetermined time, a heartbeat protocol is sent to the encoding side through the message queue. If feedback information is received from the encoding side in response to the heartbeat protocol, no other redundant processing is performed. If no feedback information is received from the encoding side in response to the heartbeat protocol, it can be considered that the encoding side is in a state of suspended animation or other abnormal conditions exist, and the frame handle of the frame storage unit is put back into the frame index queue for forced recycling. Example 2
[0045] like Figure 2 As shown, this embodiment proposes a baseband IP video data transmission method, which is applied to the encoding side. The encoding side can be a carrier of image processing and encoding programs. The method specifically includes: S201, the encoding process is initialized and a message queue is established.
[0046] Specifically, when the encoding program on the encoding side is started, the network card configuration of this encoding is input, and a message queue on the encoding side is established with the network card name as a global descriptor, that is, the encoding side message queue mq_Eth.
[0047] S202: Send a registration request to the proxy side, so that the proxy side establishes a shared memory pool according to the registration request and establishes a transmission connection with the proxy side.
[0048] Specifically, the encoding side sends a registration request to the proxy side through the encoding side message queue mq_Eth. The registration request contains the url address information of the multicast on the network card. After the proxy side receives the above registration request, it queries the shared resource mapping table of the local storage management to confirm whether the registration request for the multicast exists, that is, to identify whether the registration request for the multicast has been requested by other encoding tasks. If it does not exist, a multicast receiving thread is synchronously established with the device side, a multicast request message queue mq1 is established with the encoding side, and a shared memory pool pool1 is established for storing the multicast data. At the same time, the descriptor of the multicast request message queue and the descriptor of the shared memory pool are stored, so that the encoding side that requests the same multicast data in the future can reuse the data. Then the descriptor of the multicast request message queue and the descriptor of the shared memory pool are sent to the encoding side. If the multicast registration request already exists in the shared resource mapping table of the local storage management, then the descriptor of the stored multicast request message queue and the descriptor of the shared memory pool can be directly sent to the encoding side, and the process of establishing the shared memory pool can be skipped.
[0049] Through the above process, the encoding side can obtain the access rights of the shared memory pool and establish the multicast receiving message queue. After the shared memory pool pool1 is established, the proxy side can start the multicast receiving thread and listen to the data request from the encoding side in the multicast request message queue mq1. After receiving the data request from the encoding side, the connection is established as a producer according to the descriptor of the multicast receiving message queue mqA_recv of the encoding side contained in the data request, so as to realize the transmission connection between the proxy side and the encoding side.
[0050] Through the above process, the proprietary data communication with the proxy side as the sender and the encoding side as the receiver is completely established. The channel uses the multicast receiving message queue mqA_recv to send data and the multicast request message queue mq1 to send responses. Subsequent baseband data transmission in the shared memory pool is carried out on this basis.
[0051] S203: Acquire the frame handle of the idle frame storage unit sent by the proxy side, and read and process the frame baseband data stored in the idle frame storage unit in the shared memory pool according to the frame handle of the idle frame storage unit.
[0052] Specifically, in this embodiment, the shared memory pool on the proxy side includes multiple frame storage units. The idle frame storage unit is any one of the multiple frame storage units. The frame handle includes the ID of the frame storage unit and the offset of the frame storage unit in the shared memory pool.
[0053] More specifically, when the proxy initially creates a shared memory pool for multicast data, it allocates the entire shared memory pool according to the preset total size of the shared memory pool. The shared memory pool is then divided into blocks based on the capacity of a single frame. Each block is a basic storage unit for a data frame, namely a frame storage unit. Each frame storage unit is divided into three areas: a synchronization frame header area, a metadata area, and a data payload area.
[0054] The synchronization frame header area does not change after initialization. It is used to verify the data frame synchronization offset on both the sending and receiving sides to avoid abnormal spread caused by damaged memory data due to out-of-bounds reading and writing.
[0055] The metadata area is used to store the attribute information of the frame data, mainly including the timestamp of the acquisition time, resolution and other frame attribute information.
[0056] The data payload area is used to store the actual acquisition frame data.
[0057] After the proxy side completes the block processing of the shared memory pool, it initializes the synchronization frame header area, writes the synchronization word, and completes the initialization of the frame storage unit in the actual shared memory pool. After the initialization is completed, the proxy side assigns an ID to each frame storage unit and uses its offset in the entire shared memory pool, that is, the frame index address, to establish a mapping table. The ID and offset constitute the frame handle of the frame storage unit, forming a frame handle management. According to the ID, the frame storage unit of the frame data can be directly looked up in the table.
[0058] After the frame handle is established, two frame index queues are established to manage the use of the shared memory pool. The two frame index queues are the in-use frame memory queue and the free frame memory queue. Figure 2 As shown. Initially, the frame handles of all frame storage units are stored in the idle frame memory queue. In the subsequent transmission process, the actual data in the channel only needs the ID and offset in the frame handle. The encoding side can locate the frame storage unit of the current transmission according to the offset received by the message queue and access the specific address through pointer shifting to read the specific data, forming a transmission.
[0059] At the beginning of baseband data acquisition, after the device side transfers a frame of baseband data to the agent side by DMA, the shared memory pool management thread on the agent side grabs a frame handle from the free frame memory queue and restores the address of the free frame storage unit corresponding to the frame handle based on the frame handle. After processing the frame baseband data, the attribute information of the frame baseband data is written into the metadata area of the free frame storage unit, the actual information of the frame baseband data is written into the data load area of the free frame storage unit, and the frame handle of the free frame storage unit is stored in the frame memory queue in use.
[0060] S204: Feedback information to the proxy side, so that the proxy side reclaims the frame handle of the idle frame storage unit.
[0061] The proxy side is driven by an independent thread to send the shared memory pool. The frame handle of the frame memory queue in use is sent to the encoding side through the multicast receiving message queue of the encoding side according to the first-in-first-out principle. The encoding side receives the offset of the frame handle to obtain the actual frame baseband data. After the encoding program on the encoding side completes the encoding process of the frame baseband data, it notifies the proxy side through the multicast request message queue. The recycling thread on the proxy side puts the frame handle of the idle frame storage unit back into the idle frame memory queue for the newly collected frame baseband data to be written and used.
[0062] Through the above process, a closed loop is formed in which the baseband data of the shared memory pool frame is cyclically reused between processes. Among them, the proxy side is the producer and has write permission to the data, and the encoding side is the consumer and has read permission to the data. The baseband IP video data transmission method provided in this embodiment is based on shared memory and combined with message queues to realize a global memory pool. The low latency of the message queue is used as the control communication channel between processes, and the high read and write bandwidth and low latency of the shared memory are used as the baseband data transmission carrier. This embodiment uses memory data queue classification management and time-sharing reading and writing to realize asynchronous access to data on both the reading and writing sides. Both the reading and writing sides do not need to wait due to address competition. As long as the memory address is obtained, they can process the relevant data separately, which greatly improves the transmission and processing efficiency of baseband data. Example 3
[0063] like Figure 3 As shown, this embodiment provides a baseband IP video data transmission system, which includes a proxy side and an encoding side.
[0064] Specifically, the proxy side includes a processor and a memory, wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the processor executes the following method: The proxy thread is initialized and the message queue is established; Obtaining a registration request from the encoding side, establishing a shared memory pool according to the registration request, and establishing a transmission connection with the encoding side; The shared memory pool is divided into blocks to form a plurality of frame storage units, and an ID is assigned to each frame storage unit, and an offset of each frame storage unit in the shared memory pool is calculated, wherein the ID and the offset constitute a frame handle; Two frame index queues are established for indexing frame handles in different states, frame baseband data on the device side is obtained, the frame baseband data is processed and stored in an idle frame storage unit, and the frame handle of the idle frame storage unit is placed in a frame index queue indicating that it has been written, wherein the idle frame storage unit is any frame storage unit among multiple frame storage units into which the frame baseband data has not been written; Sending the frame handle of the idle frame storage unit in the frame index queue that has been written to the encoding side, so that the encoding side reads the frame baseband data stored in the idle frame storage unit in the shared memory pool according to the frame handle of the idle frame storage unit; The receiving encoding side feeds back reception success information, and exchanges the frame handle of the idle frame storage unit between two frame index queues after the idle frame storage unit has been read and used.
[0065] The encoding side includes a processor and a memory, wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the processor performs the following method: Initialize the encoding process and establish a message queue; Sending a registration request to the proxy side, so that the proxy side establishes a shared memory pool according to the registration request and establishes a transmission connection with the proxy side; Obtaining a frame handle of an idle frame storage unit sent by the proxy side, and reading and processing frame baseband data stored in the idle frame storage unit in a shared memory pool according to the frame handle of the idle frame storage unit, wherein the shared memory pool includes multiple frame storage units, the idle frame storage unit is any one of the multiple frame storage units, and the frame handle includes an ID of the frame storage unit and an offset of the frame storage unit in the shared memory pool; Feedback information to the proxy side so that the proxy side reclaims the frame handle of the idle frame storage unit.
[0066] The baseband IP video data transmission system provided in this embodiment is based on shared memory and combined with message queues to realize a global memory pool. The low latency of the message queue is used as the control communication channel between processes, and the high read and write bandwidth and low latency of the shared memory are used as the baseband data transmission carrier. Based on these two points, the data proxy for peripherals such as acquisition cards is completed. This method is not limited to data proxy for specific peripheral devices, and is suitable for cross-process large data volume transmission of all single-production and multi-consumer terminals. This embodiment uses memory data queue classification management and time-sharing reading and writing to realize asynchronous access to data on both the reading and writing sides. Both the reading and writing sides do not need to wait due to address competition. As long as the memory address is obtained, they can process the relevant data separately, which greatly improves the transmission and processing efficiency of baseband data.
[0067] In this application, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or can communicate with each other; it can be a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0068] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0069] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A baseband IP video data transmission method, characterized in that: The method is applied to the agent side, and the method includes: The proxy thread is initialized and the message queue is established; Obtaining a registration request from the encoding side, establishing a shared memory pool according to the registration request, and establishing a transmission connection with the encoding side; The shared memory pool is divided into blocks to form a plurality of frame storage units, and an ID is assigned to each frame storage unit, and an offset of each frame storage unit in the shared memory pool is calculated, wherein the ID and the offset constitute a frame handle; Two frame index queues are established for indexing frame handles in different states, frame baseband data on the device side is obtained, the frame baseband data is processed and stored in an idle frame storage unit, and the frame handle of the idle frame storage unit is placed in a frame index queue indicating that it has been written, wherein the idle frame storage unit is any frame storage unit among multiple frame storage units into which the frame baseband data has not been written; Sending the frame handle of the idle frame storage unit in the frame index queue that has been written to the encoding side, so that the encoding side reads the frame baseband data stored in the idle frame storage unit in the shared memory pool according to the frame handle of the idle frame storage unit; The receiving encoding side feeds back reception success information, and exchanges the frame handle of the idle frame storage unit between two frame index queues after the idle frame storage unit has been read and used.
2. The method according to claim 1, characterized in that: The process of initializing the proxy thread and establishing the message queue includes: Start the agent program in units of network cards to initialize the peripheral hardware on the device side; A named message queue is established with the network card name as a global descriptor, and the named message queue is monitored.
3. The method according to claim 2, characterized in that The process of obtaining a registration request from the encoding side, establishing a shared memory pool according to the registration request, and establishing a transmission connection with the encoding side includes: Obtaining a registration request sent by the encoding side to the naming message queue through the encoding side message queue, wherein the registration request includes the URL address information of the multicast on the network card; When the multicast registration request is not recorded in the shared resource mapping table of the local storage management, a multicast receiving thread is established between the device side, a multicast request message queue is established between the encoding side, and a shared memory pool is established for storing the multicast data; storing the descriptor of the multicast request message queue and the descriptor of the shared memory pool, and sending the descriptor of the multicast request message queue and the descriptor of the shared memory pool to the encoding side, so that the encoding side obtains the memory data access right of the shared memory pool by mapping the descriptor of the shared memory pool, and establishes a multicast receiving message queue; The data request sent by the encoding side through the multicast request message queue is monitored, wherein the data request includes the descriptor of the multicast receiving message queue of the encoding side, and a transmission connection is established with the encoding side according to the descriptor of the multicast receiving message queue.
4. The method according to claim 1, characterized in that: The frame storage unit includes a synchronization frame header area, a metadata area and a data load area; The synchronization frame header area is used for the proxy side and the encoding side to verify the data frame synchronization offset; The metadata area is used to store attribute information of the frame data; The data payload area is used to store actual information of the frame data.
5. The method according to claim 4, characterized in that The process of establishing two frame index queues for indexing frame handles in different states, acquiring frame baseband data on the device side, storing the frame baseband data in an idle frame storage unit after processing, and placing the frame handle of the idle frame storage unit into a frame index queue indicating that it has been written includes: Establishing two frame index queues, wherein the frame index queues include an in-use frame memory queue and an idle frame memory queue, wherein the in-use frame memory queue is used to store frame handles of written frame storage units, and the idle frame memory queue is used to store frame handles of unwritten frame storage units, and the idle frame memory queue initially stores frame handles of all frame storage units; Acquire frame baseband data on the device side, capture the frame handle of the idle frame storage unit in the idle frame memory queue, and restore the address of the idle frame storage unit according to the frame handle; Processing the frame baseband data, writing attribute information of the frame baseband data into a metadata area of the idle frame storage unit, and writing actual information of the frame baseband data into a data load area of the idle frame storage unit; The frame handle of the idle frame storage unit with the frame baseband data attribute information and actual information written therein is stored in the in-use frame memory queue.
6. The method according to claim 5, characterized in that The process of the receiving encoding side feeding back the reception success information and exchanging the frame handle of the idle frame storage unit between two frame index queues after the idle frame storage unit is read and used includes: The receiving encoding side feeds back information about the frame baseband data that has been read and used; The frame handle of the idle frame storage unit that has been used up is taken out from the in-use frame memory queue and put back into the idle frame memory queue.
7. The method according to claim 6, characterized in that The method further comprises: Establishing a frame storage unit record table, wherein the frame storage unit record table records the number of times each frame storage unit is read; When a frame handle of an idle frame storage unit is sent to the encoding side once, the number of times the idle frame storage unit is read is increased by one in the frame storage unit record table. When the completion of using the frame baseband data information fed back by the encoding side is received, the number of times the idle frame storage unit is read is reduced by one in the frame storage unit record table until the number of times the idle frame storage unit is read is zero, and the frame handle of the idle frame storage unit is put back into the idle frame memory queue.
8. The method according to claim 7, characterized in that The method further comprises: Periodically check whether the frame handle transmission process of the frame baseband data in the frame memory queue in use has been cleared; If the transmission process has been cleared, the number of times the frame storage unit corresponding to the transmission process has been read is reduced by one in the frame storage unit record table, and the process record is cleared.
9. The method according to claim 1, characterized in that: The method further comprises: When no feedback information is received from the encoding side within the predetermined time, a heartbeat protocol is sent to the encoding side through the message queue; If no feedback information sent by the encoding side in response to the heartbeat protocol is received, the frame handle of the frame storage unit is put back into the idle frame index queue.
10. A baseband IP video data transmission method, characterized in that: The method is applied to the encoding side, and the method includes: Initialize the encoding process and establish a message queue; Sending a registration request to the proxy side, so that the proxy side establishes a shared memory pool according to the registration request and establishes a transmission connection with the proxy side; Obtaining a frame handle of an idle frame storage unit sent by the proxy side, and reading and processing frame baseband data stored in the idle frame storage unit in a shared memory pool according to the frame handle of the idle frame storage unit, wherein the shared memory pool includes multiple frame storage units, the idle frame storage unit is any one of the multiple frame storage units, and the frame handle includes an ID identifier of the frame storage unit and an offset of the frame storage unit in the shared memory pool; Feedback information to the proxy side so that the proxy side reclaims the frame handle of the idle frame storage unit.
11. The method according to claim 10, characterized in that The encoding process is initialized and the process of establishing a message queue includes: Enter the network card configuration; Create a message queue on the encoding side using the network card name as the global descriptor.
12. The method according to claim 11, characterized in that The process of sending a registration request to the proxy side so that the proxy side establishes a shared memory pool according to the registration request and establishes a transmission connection with the proxy side includes: Sending a registration request to the named message queue through the encoding side message queue, wherein the registration request includes the URL address information of the multicast on the network card, so that the proxy side establishes a shared memory pool for storing the multicast data and establishes a multicast request message queue between the encoding side and the proxy side according to the registration request; Acquire the descriptor of the multicast request message queue and the descriptor of the shared memory pool, and obtain access rights to the shared memory pool according to the descriptor of the multicast request message queue and the descriptor of the shared memory pool; Establishing a multicast receiving message queue and monitoring the multicast receiving message queue; A data request is sent to the multicast request message queue of the proxy side, wherein the data request includes a descriptor of the multicast receiving message queue, so that the proxy side establishes a transmission connection with the encoding side according to the descriptor of the multicast receiving message queue.
13. A baseband IP video data transmission system, characterized in that: The system includes an agent side and an encoding side; The proxy side includes a processor and a memory, wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 9; The encoding side includes a processor and a memory, wherein one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the processor executes the method as described in any one of claims 10 to 12.
Citation Information
Patent Citations
Method for realizing interprocess synchronization communication and agent unit
CN101674326A
System and method for copying data among heterogeneous databases
CN102004743A
Central control information scheduling algorithm
CN106338931A
Inter-process communication method, device and system, medium and terminal
CN110399229A
Message transmission method and device, storage medium and electronic device
CN118301113A