Data transmission method, system, device and medium

By logically dividing the continuous physical memory in the demultiplexing driver into discrete block memory and establishing a virtual address mapping, the problems of low data transmission efficiency and stability between user space and kernel driver are solved, and efficient and low-power data transmission is achieved.

CN114610651BActive Publication Date: 2025-09-12SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210254739.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-15
Publication Date
2025-09-12
Estimated Expiration
2042-03-15

AI Technical Summary

Technical Problem

In recording and time-shifting scenarios, the existing technology has low efficiency in transmitting data streams between user space and kernel drivers, and frequent copying leads to system performance degradation and data loss and overwriting problems.

Method used

The continuous physical memory reserved in the demultiplexing driver is logically divided to form discrete block memory, and a page is dynamically allocated by the kernel driver to form a read-write point memory. A user space virtual address mapping is established between the data memory and the read-write point memory to achieve direct reading and writing of the target transmission stream.

Benefits of technology

It reduces power consumption during data transmission, improves transmission efficiency, avoids data copying and frequent interactions, and ensures the stability and integrity of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114610651B_ABST
    Figure CN114610651B_ABST
Patent Text Reader

Abstract

The present invention provides a data transmission method, system, device, and medium. The method includes logically dividing a continuous physical memory reserved in a demultiplexing driver to form a data memory, wherein the data memory includes a plurality of discrete block memories; dynamically allocating a page in a kernel driver to form a read / write point memory; establishing an address mapping between the user space virtual addresses of the data memory and the read / write point memory; writing a target transmission stream into the data memory; and an upper layer reading the target transmission stream in the data memory according to the user space virtual address. The present invention establishes an address mapping between the user space virtual addresses of the data memory and the read / write point memory, so that the upper layer can read the target transmission stream in the data memory according to the user space virtual address, thereby realizing cyclic reading and writing of the transmission stream between the upper user space and the demultiplexing hardware, reducing power consumption and improving data transmission efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic communication technology, and in particular to a data transmission method, system, device and medium. Background Art

[0002] The tuner and demodulator output multiplexed transport stream (TS) data containing audio, video, subtitles, and a service information table. In recording scenarios, the integrated demultiplexer (Demux) hardware within the digital TV can filter out specific transport stream data based on the packet identifier (PID) passed by the upper layer and store it in memory as TS packets. In recording and time-shifting scenarios, the upper-layer user space typically creates files in a specified directory based on demand and performs operations such as opening, reading, writing, and destroying the files. Demux hardware typically requires access to a ring buffer, so consideration must be given to how the TS stream data output by the hardware can be retrieved by the upper layer and saved to a file for subsequent playback.

[0003] If the driver dynamically allocates multiple small consecutive memory blocks and forms a circular linked list for hardware data filling, the driver can handle each Demux hardware interrupt in the following two ways:

[0004] (1) The data is copied and temporarily stored, and then copied back to the user space when the upper layer sends a data retrieval request. However, this method will result in multiple copies of the TS stream data. When the resolution of the TV program is high, the compressed bitstream data volume is large, the transmission time will increase, and frequent copies will reduce the performance of the entire device.

[0005] (2) Mapping a large number of discrete small blocks of memory to the upper layer for direct access by the upper layer. However, this requires creating a queue to maintain and identify available buffers. Maintaining discrete buffer queues is complex and error-prone, and is prone to data loss and overwriting.

[0006] If a large amount of memory is dynamically allocated in the driver and then mapped and accessed, the memory allocation may fail, causing the recording and time shift functions to not work properly. Summary of the Invention

[0007] The object of the present invention is to provide a data transmission method, system, device and medium to reduce the reading and writing power consumption caused by data migration between user space and kernel driver of transmission stream data, and improve the efficiency of data transmission.

[0008] To achieve the above-mentioned objectives, in a first aspect, the present invention provides a data transmission method, comprising: logically dividing the continuous physical memory reserved in the demultiplexing driver to form a data memory, wherein the data memory includes a plurality of discrete block memories; forming a read-write point memory by dynamically allocating a page in the kernel driver; establishing an address mapping between the data memory and the user space virtual address of the read-write point memory; writing a target transmission stream to the data memory; and the upper layer reading the target transmission stream in the data memory according to the user space virtual address.

[0009] The data transmission method provided by the present invention has the beneficial effect of logically partitioning reserved continuous physical memory to form data memory. Therefore, from a hardware perspective, each partitioned memory block is discrete, but from the upper layer's perspective, it appears as a physical memory block that can be directly read and written via virtual addresses. By establishing an address mapping between the data memory and the user space virtual addresses of the read / write point memory, the upper layer can read the target transmission stream in the data memory based on the user space virtual addresses, thereby reducing power consumption and improving data transmission efficiency.

[0010] Optionally, before writing the target transport stream into the data memory, the method further includes: determining the target transport stream corresponding to the packet identifier according to the packet identifier transmitted by the upper layer. This has the beneficial effect of filtering out the target transport stream by the packet identifier and writing it into the data memory for reading by the upper layer.

[0011] Optionally, after writing the target transport stream to the data memory, the method further includes: the demultiplexing driver recording, in the read / write memory, the write position offset value of the target transport stream written to the data memory; and after the upper layer reads the transport stream from the data memory according to the user space virtual address, the method further includes: when the demultiplexing driver receives an interrupt signal from hardware, the demultiplexing driver updates the write position offset value in the read / write point memory. The beneficial effect is that by recording and updating the write position offset value in the read / write point memory, the upper layer is facilitated to read and write transport stream data.

[0012] Optionally, the upper layer reads the target transmission stream in the data memory according to the user space virtual address, including: the user space of the upper layer reads the write position offset value; the current data valid length is calculated according to the user space virtual address and the write position offset value; according to the current data valid length, the target transmission stream is read from the data memory; and the read position offset value is recorded in the read-write point memory.

[0013] Optionally, the method further includes: the demultiplexing driver uses the block memory that has been read from the user space to continue writing the transport stream according to the read position offset value. The beneficial effect is that repeated writing in the data memory is achieved.

[0014] In a second aspect, an embodiment of the present invention provides a data transmission system, including:

[0015] A memory formation module is used to logically divide the continuous physical memory reserved in the demultiplexing driver to form a data memory, wherein the data memory includes a plurality of discrete block memories; and to form a read / write point memory by dynamically allocating a page in the kernel driver;

[0016] A mapping module, configured to establish an address mapping between the user space virtual addresses of the data memory and the read / write point memory;

[0017] A processing module, configured to write a target transport stream into the data memory;

[0018] An upper layer module is used to read the target transport stream in the data memory according to the user space virtual address.

[0019] The data transmission system provided by the present invention has the beneficial effect of logically partitioning the reserved continuous physical memory into data memory. Therefore, from a hardware perspective, each partitioned block memory is discrete, but to the upper layer, it appears as a physical memory that can be directly read and written via a virtual address. The mapping module establishes an address mapping between the user space virtual address of the data memory and the read / write point memory, so that the upper layer module can read the target transmission stream in the data memory according to the user space virtual address, thereby achieving cyclic reading and writing of the transmission stream between the upper layer user space and the processing module, reducing power consumption and improving data transmission efficiency.

[0020] Optionally, before writing the target transport stream into the data memory, the processing module is further configured to: determine the target transport stream corresponding to the packet identifier based on the packet identifier transmitted by the upper layer. This has the beneficial effect of filtering out the target transport stream based on the packet identifier and writing it into the data memory for reading by the upper layer.

[0021] Optionally, after the processing module writes the target transport stream to the data memory, the processing module further includes: the demultiplexing driver recording the write position offset value of the target transport stream written to the data memory in the read / write memory; and after the upper-layer module reads the transport stream in the data memory according to the user space virtual address, the processing module further includes: when the demultiplexing driver receives an interrupt signal from the hardware, the demultiplexing driver updates the write position offset value in the read / write point memory. The beneficial effect is that by recording and updating the write position offset value in the read / write point memory, the upper layer can read and write transport stream data more easily, thereby achieving cyclic reading and writing of transport stream data between the upper-layer user space and the demultiplexing hardware.

[0022] Optionally, the upper-layer module reads the target transmission stream in the data memory according to the user space virtual address, specifically for: the upper-layer user space reads the write position offset value; calculates the current data valid length based on the user space virtual address and the write position offset value; reads the target transmission stream from the data memory according to the current data valid length; and records the read position offset value in the read-write point memory.

[0023] Optionally, the demultiplexing driver is further configured to use the block memory that has already been read by the user space for continuing to write the transport stream based on the read position offset value. This advantageously enables repeated writing to the data memory without requiring additional, time-consuming operations such as data copying between the upper-layer user space and the kernel driver, thereby reducing power consumption.

[0024] In a fourth aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method steps when executing the computer program.

[0025] The beneficial effect of the electronic device of the present invention is that the above method is implemented by executing the computer program through the processor.

[0026] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned method steps when executed by a processor.

[0027] The beneficial effect of the computer-readable storage medium of the present invention is that the above method is implemented by executing the computer program. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A flowchart of a data transmission method according to an embodiment of the present invention;

[0029] Figure 2 A flow chart of cyclic reading and writing of transport stream data provided by the embodiment of the present invention;

[0030] Figure 3 This is a schematic diagram of the data transmission system structure of an embodiment provided by the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be the common meanings understood by people with ordinary skills in the field to which the present invention belongs. The words "including" and similar words used in this article mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects.

[0032] Currently, when kernel drivers and user-space data interact, low-resolution video sources don't cause many issues. However, high-resolution video sources can cause transmission delays and high power consumption. Frequent data transfers between kernel drivers and user-space can also degrade system performance, making data loss and overwriting more likely, impacting data transmission efficiency.

[0033] In view of the problems existing in the prior art, an embodiment of the present invention provides a data transmission method. Figure 1 As shown, the method includes:

[0034] S101 , logically dividing the continuous physical memory reserved in the demultiplexing driver to form a data memory, wherein the data memory includes a plurality of discrete block memories.

[0035] In this step, the reserved continuous physical memory is logically divided into several discrete block memories. These block memories are combined in a ring-shaped buffer. Therefore, from the hardware perspective, each divided block memory is discrete, but from the upper layer's perspective, it appears as a continuous block of physical memory that can be directly read and written through virtual addresses. This satisfies the demultiplexing hardware's needs for writing to the block memory and the upper layer's needs for reading from the continuous physical memory.

[0036] S102, forming a read-write point memory by dynamically allocating a page in the kernel driver.

[0037] In this step, by forming the read-write point memory, it is convenient to record the writing and reading positions in the data memory.

[0038] S103, establishing an address mapping between the user space virtual addresses of the data memory and the read / write point memory.

[0039] In this step, an address mapping is established between the user space virtual addresses of the data memory and the read-write point memory, so that the data memory and the read-write point memory correspond to the user space virtual addresses respectively, which facilitates the upper layer to directly select and read.

[0040] S104, writing the target transport stream into the data memory.

[0041] In this step, the target transport stream is written into the data memory through demultiplexing hardware, thereby realizing writing of the transport stream data in the data memory.

[0042] It should be noted that the output composite multi-channel transport stream data includes a target transport stream. Before the demultiplexing hardware writes the target transport stream into the data memory, the upper layer sends a packet identifier to the demultiplexing hardware, so that the demultiplexing hardware filters out the target transport stream corresponding to the packet identifier from the composite multi-channel transport stream data.

[0043] Furthermore, after writing the target transport stream to the data memory, the demultiplexing driver records the write position offset value of the target transport stream written to the data memory in the read-write memory, so that the upper layer can understand the current position of the target transport stream written to the data memory.

[0044] S105: The upper layer reads the target transport stream in the data memory according to the user space virtual address.

[0045] In this embodiment, an address mapping is established between the user space virtual addresses of the data memory and the read / write point memory, so that the upper layer can directly read the target transmission stream in the data memory according to the user space virtual address, thereby avoiding the data return processing and frequent interactive work between the upper user space and the kernel driver, thereby reducing power consumption and improving data transmission efficiency.

[0046] Optionally, to further illustrate how the transport stream data between the upper user space and the demultiplexing hardware is read and written cyclically, refer to Figure 2 As shown, Figure 2 This is another flow chart of a data transmission method according to an embodiment of the present invention, the method comprising:

[0047] S201, the demultiplexing hardware writes the target transport stream into the data memory.

[0048] S202: The demultiplexing driver receives an interrupt signal from hardware.

[0049] In this step, when the demultiplexing driver receives an interrupt signal from hardware, the demultiplexing hardware stops writing the target transport stream into the data memory.

[0050] S203: The demultiplexing driver updates the write position offset value in the read / write point memory.

[0051] In this step, when an interrupt signal is received from the hardware, the demultiplexing hardware updates the write position offset value in the read / write point memory at this time, so as to understand the stage of writing the target transport stream data.

[0052] S204: The demultiplexing driver obtains the read position offset value in the read / write point memory.

[0053] S205: Reset the data memory read from the upper layer to the demultiplexing hardware for writing.

[0054] In this step, the read position offset value is obtained from the read / write point memory, and the read block memory is reset to the demultiplexing hardware to continue writing the transport stream. In this step, cyclic writing of transport stream data is achieved.

[0055] S206: The upper user space reads the write position offset value.

[0056] S207: Calculate the current data valid length based on the user space virtual address and the write position offset value.

[0057] S208: Read the target transport stream from the data memory according to the current valid data length.

[0058] S209: Update the read position offset value in the read / write point memory.

[0059] In this step, by continuously updating the read position offset value, cyclic reading and updating of the transport stream data is achieved.

[0060] In this embodiment, the demultiplexing driver updates the write position offset value at a specified location in the read / write point memory. Furthermore, the demultiplexing driver can determine which portion of the block memory is available based on the read position offset value in the read / write point memory, thereby assigning this portion to the demultiplexing hardware to continue writing the transport stream, thereby achieving continuous writing in the data memory. Furthermore, the upper-layer user space can calculate the current valid length of data using the write position offset, thereby continuously reading continuous target transport stream data from the data memory and updating the read position offset in the read / write point memory.

[0061] In another embodiment disclosed in the present invention, a system for data transmission is provided, referring to Figure 3 As shown, the system includes: a memory forming module 301, which is used to logically divide the continuous physical memory reserved in the demultiplexing driver to form a data memory, and the data memory includes a plurality of discrete block memories. In addition, the memory forming module 301 forms a read-write point memory by dynamically allocating a page in the kernel driver. A mapping module 302 is connected to the memory forming module 301, and the mapping module 302 is used to establish an address mapping between the user space virtual address of the data memory and the read-write point memory. A processing module 303 is used to write the target transmission stream to the data memory. It should be noted that, in this embodiment, the processing module is the demultiplexing hardware. The upper layer module 304 is used to read the target transmission stream in the data memory according to the user space virtual address.

[0062] In this embodiment, the memory formation module 301 logically divides the reserved continuous physical memory to form the data memory. Therefore, from the hardware perspective, each divided block memory is discrete, but from the upper layer's perspective, it is a physical memory that can be directly read and written through a virtual address. The mapping module 302 establishes an address mapping between the user space virtual address of the data memory and the read / write point memory, so that the upper layer module 304 can read the target transmission stream in the data memory according to the user space virtual address, thereby realizing cyclic reading and writing of the transmission stream between the user space of the upper layer module 304 and the processing module 303, reducing power consumption and improving data transmission efficiency.

[0063] Optionally, before writing the target transport stream into the data memory, the processing module 303 is further configured to: determine, according to the packet identifier transmitted by the upper layer module 304 , the target transport stream corresponding to the packet identifier.

[0064] In this embodiment, the target transport stream is filtered out by the packet identifier and written into the data memory for reading by the upper layer module 304 .

[0065] Optionally, after the processing module 303 writes the target transport stream to the data memory, it is further used to: record in the read-write memory the write position offset value of the target transport stream written to the data memory. After the upper-layer module 304 reads the transport stream in the data memory according to the user space virtual address, it is further used to: when the demultiplexing driver receives an interrupt signal from the hardware, the demultiplexing driver updates the write position offset value in the read-write point memory. By recording and updating the write position offset value in the read-write point memory, the reading of the upper-layer module 304 and the writing of the target transport stream data are facilitated, thereby realizing the cyclic reading and writing of the transport stream data between the upper-layer module 304 and the processing module 303.

[0066] Optionally, the upper-layer module 304 reads the target transmission stream in the data memory according to the user space virtual address, specifically for: the user space of the upper-layer module 304 reads the write position offset value, and calculates the current data valid length according to the user space virtual address and the write position offset value; reads the target transmission stream from the data memory according to the current data valid length; and records the read position offset value in the read-write point memory. The demultiplexing driver provides the information of the block memory that has been read by the user space to the processing module 303 according to the read position offset value, so that the processing module 303 continues to write the transmission stream. Repeated writing in the data memory is achieved, and no additional time-consuming operations such as data copying occur between the user space of the upper-layer module 304 and the kernel driver, thereby reducing power consumption.

[0067] In another embodiment disclosed in the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method steps when executing the computer program.

[0068] In another embodiment disclosed in the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above method steps are implemented.

[0069] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A data transmission method, characterized in that: include: Logically dividing the continuous physical memory reserved in the demultiplexing driver to form a data memory, wherein the data memory includes a plurality of discrete block memories; By dynamically allocating a page in the kernel driver, a read-write point memory is formed for recording the write and read-write positions in the data memory; Establishing an address mapping between the user space virtual address of the data memory and the read / write point memory; writing the target transport stream into the data memory through demultiplexing hardware; The upper layer reads the target transport stream in the data memory according to the user space virtual address.

2. The method according to claim 1, characterized in that Before writing the target transport stream into the data memory, the method further comprises: According to the packet identifier delivered by the upper layer, the target transport stream corresponding to the packet identifier is determined.

3. The method according to claim 1, characterized in that After writing the target transport stream into the data memory, the method further includes: The demultiplexing driver records, in the read / write point memory, a write position offset value of the target transport stream written into the data memory; After the upper layer reads the target transport stream in the data memory according to the user space virtual address, the method further includes: When the demultiplexing driver receives an interrupt signal from hardware, the demultiplexing driver updates the write position offset value in the read / write point memory.

4. The method according to claim 3, characterized in that The upper layer reads the target transport stream in the data memory according to the user space virtual address, including: The upper user space reads the write position offset value; The current data valid length calculated according to the user space virtual address and the write position offset value; Reading the target transport stream from the data memory according to the current data valid length; The read position offset value is recorded in the read / write point memory.

5. The method according to claim 4, characterized in that Also includes: The demultiplexing driver uses the block memory that has been read from the user space to continue writing into the transport stream according to the read position offset value.

6. A data transmission system, characterized in that: include: A memory formation module, configured to logically divide the continuous physical memory reserved in the demultiplexing driver into a data memory, wherein the data memory includes a plurality of discrete block memories; By dynamically allocating a page in the kernel driver, a read-write point memory is formed for recording the write and read-write positions in the data memory; A mapping module, configured to establish an address mapping between the user space virtual addresses of the data memory and the read / write point memory; a processing module, the processing module being demultiplexing hardware, configured to write a target transport stream into the data memory; An upper layer module is used to read the target transport stream in the data memory according to the user space virtual address.

7. The system according to claim 6, characterized in that Before writing the target transport stream into the data memory, the processing module is further configured to: According to the packet identifier delivered by the upper layer, the target transport stream corresponding to the packet identifier is determined.

8. The system according to claim 7, characterized in that After the processing module writes the target transport stream into the data memory, the processing module further includes: The demultiplexing driver records, in the read / write point memory, a write position offset value of the target transport stream written into the data memory; After the upper layer module reads the transport stream in the data memory according to the user space virtual address, the upper layer module further includes: When the demultiplexing driver receives an interrupt signal from hardware, it updates the write position offset value in the read / write point memory.

9. The system according to claim 8, characterized in that The upper layer module reads the target transport stream in the data memory according to the user space virtual address, specifically for: The user space of the upper module reads the write position offset value; The current data valid length calculated according to the user space virtual address and the write position offset value; Reading the target transport stream from the data memory according to the current data valid length; The read position offset value is recorded in the read / write point memory.

10. The system according to claim 9, characterized in that The demultiplexing driver is also used to: According to the read position offset value, the block memory that has been read from the user space is used to continue writing the transport stream.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.