Data stream processing method and device, computer device and storage medium
Patent Information
- Application Number
- CN202210079568.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-24
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-01-24
AI Technical Summary
对于接入同一网络各个不同的终端,需要从网络中拉取相同的数据流,数据流的处理效率较低
[0034]上述数据流处理方法、装置、计算机设备、存储介质和计算机程序产品,通过复用进程将获取的待分发的目标数据流写入共享内存的数据流存储区,并将获得的目标数据流的存储信息写入共享内存的数据流信息区,将目标数据流发送至复用进程所关联的终端,通过至少一个分发进程从数据流信息区中读取存储信息,并根据读取的存储信息从数据流存储区中获得目标数据流,通过分发进程将从共享内存中获得的目标数据流,发送至分发进程所关联的终端。在数据流处理过程中,通过终端关联的复用进程将获取的目标数据流写入共享内存的数据流存储区中,并将目标数据流的存储信息写入共享内存的数据流信息区中,使得共享内存中存储的目标数据流可由分发进程快速读取并发送至关联的终端,在多个终端需要获取相同数据流时,减少了直接获取数据流的进程数量,通过分发进程直接从共享内存读取数据流进行分发,提高了数据流的处理效率。
Smart Images

Figure CN116521385B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data stream processing method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] With the development of computer technology, internet-based communication has been widely applied in various industries, such as personal social networking and online conferencing. When multiple users communicate through their respective terminals in a communication network, each user's terminal needs to retrieve data streams from the network, such as audio and video data streams, to achieve communication. For different terminals accessing the same network, retrieving the same data stream from the network results in low data stream processing efficiency. Summary of the Invention
[0003] Therefore, it is necessary to provide a data stream processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the efficiency of data stream processing in response to the above-mentioned technical problems.
[0004] Firstly, this application provides a data stream processing method. The method includes:
[0005] The target data stream to be distributed is obtained through the reuse process;
[0006] The target data stream is written to the shared memory data stream storage area through the multiplexing process, and the storage information of the target data stream is obtained.
[0007] The multiplexing process writes the stored information into the data stream information area of the shared memory and sends the target data stream to the terminal associated with the multiplexing process.
[0008] Through at least one distribution process, stored information is read from the data stream information area, and the target data stream is obtained from the data stream storage area based on the read stored information.
[0009] The target data stream obtained from shared memory is sent to the terminal associated with the distribution process through at least one distribution process.
[0010] Secondly, this application also provides a data stream processing apparatus. The apparatus includes:
[0011] The data stream acquisition module is used to acquire the target data stream to be distributed through the reuse process;
[0012] The data stream writing module is used to write the target data stream into the shared memory data stream storage area through the multiplexing process, and to obtain the storage information of the target data stream;
[0013] The storage information writing module is used to write the storage information into the data stream information area of the shared memory through the multiplexing process, and send the target data stream to the terminal associated with the multiplexing process;
[0014] The data stream reading module is used to read stored information from the data stream information area through at least one distribution process, and obtain the target data stream from the data stream storage area based on the read stored information;
[0015] The data stream distribution module is used to send the target data stream obtained from shared memory to the terminal associated with the distribution process through at least one distribution process.
[0016] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0017] The target data stream to be distributed is obtained through the reuse process;
[0018] The target data stream is written to the shared memory data stream storage area through the multiplexing process, and the storage information of the target data stream is obtained.
[0019] The multiplexing process writes the stored information into the data stream information area of the shared memory and sends the target data stream to the terminal associated with the multiplexing process.
[0020] Through at least one distribution process, stored information is read from the data stream information area, and the target data stream is obtained from the data stream storage area based on the read stored information.
[0021] The target data stream obtained from shared memory is sent to the terminal associated with the distribution process through at least one distribution process.
[0022] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0023] The target data stream to be distributed is obtained through the reuse process;
[0024] The target data stream is written to the shared memory data stream storage area through the multiplexing process, and the storage information of the target data stream is obtained.
[0025] The multiplexing process writes the stored information into the data stream information area of the shared memory and sends the target data stream to the terminal associated with the multiplexing process.
[0026] Through at least one distribution process, stored information is read from the data stream information area, and the target data stream is obtained from the data stream storage area based on the read stored information.
[0027] The target data stream obtained from shared memory is sent to the terminal associated with the distribution process through at least one distribution process.
[0028] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0029] The target data stream to be distributed is obtained through the reuse process;
[0030] The target data stream is written to the shared memory data stream storage area through the multiplexing process, and the storage information of the target data stream is obtained.
[0031] The multiplexing process writes the stored information into the data stream information area of the shared memory and sends the target data stream to the terminal associated with the multiplexing process.
[0032] Through at least one distribution process, stored information is read from the data stream information area, and the target data stream is obtained from the data stream storage area based on the read stored information.
[0033] The target data stream obtained from shared memory is sent to the terminal associated with the distribution process through at least one distribution process.
[0034] The aforementioned data stream processing method, apparatus, computer equipment, storage medium, and computer program product, through a multiplexing process, writes the acquired target data stream to be distributed into the data stream storage area of shared memory, and writes the storage information of the acquired target data stream into the data stream information area of shared memory. The target data stream is then sent to the terminal associated with the multiplexing process. At least one distribution process reads the storage information from the data stream information area and obtains the target data stream from the data stream storage area based on the read storage information. The distribution process then sends the target data stream obtained from shared memory to the terminal associated with the distribution process. During the data stream processing, the multiplexing process associated with the terminal writes the acquired target data stream into the data stream storage area of shared memory and writes the storage information of the target data stream into the data stream information area of shared memory. This allows the target data stream stored in shared memory to be quickly read and sent to the associated terminal by the distribution process. When multiple terminals need to acquire the same data stream, the number of processes directly acquiring the data stream is reduced. By directly reading the data stream from shared memory and distributing it through the distribution process, the data stream processing efficiency is improved. Attached Figure Description
[0035] Figure 1This is an application environment diagram of a data stream processing method in one embodiment;
[0036] Figure 2 This is a flowchart illustrating a data stream processing method in one embodiment;
[0037] Figure 3 This is a schematic diagram illustrating how a terminal communicates via a data stream network connected to a server in one embodiment.
[0038] Figure 4 This is a flowchart illustrating the process of reading a target data stream in one embodiment;
[0039] Figure 5 This is a schematic diagram illustrating the process of a first terminal accessing a media network in one embodiment;
[0040] Figure 6 This is a schematic diagram illustrating the process of a second terminal accessing a media network in one embodiment;
[0041] Figure 7 This is a schematic diagram illustrating the process of a third terminal accessing a media network in one embodiment;
[0042] Figure 8 This is a system architecture block diagram of a video conferencing system in one embodiment;
[0043] Figure 9 This is a schematic diagram of the process of writing to shared memory in one embodiment;
[0044] Figure 10 This is a schematic diagram of the process of reading shared memory in one embodiment;
[0045] Figure 11 This is a structural block diagram of a data stream processing device in one embodiment;
[0046] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0048] The data stream processing method provided in this application embodiment can be applied to, for example, Figure 1In the application environment shown, multiple terminals 102 communicate with server 104 via a communication network. A data storage system stores the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Server 104 writes the acquired target data stream to be distributed into the data stream storage area of shared memory through a multiplexing process. The shared memory can be pre-configured in the data storage system. Server 104 writes the storage information of the acquired target data stream into the data stream information area of shared memory and sends the target data stream to the terminal associated with the multiplexing process. Further, server 104 reads the storage information from the data stream information area through at least one distribution process, obtains the target data stream from the data stream storage area based on the read storage information, and sends the target data stream obtained from shared memory to the terminal associated with the distribution process through the distribution process.
[0049] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal 102 and the server 104 can be connected directly or indirectly via wired or wireless communication, which is not limited herein. Furthermore, cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network or local area network to achieve data computation, storage, processing, and sharing. Cloud technology is a collective term for network technology, information technology, integration technology, management platform technology, and application technology applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0050] In one embodiment, such as Figure 2 As shown, a data stream processing method is provided, which is applied to... Figure 1 Taking the server in the example, the following steps are included:
[0051] Step 202: Obtain the target data stream to be distributed through the reuse process.
[0052] In this context, the data stream refers to the data that the server needs to distribute to various connected terminals to achieve communication. Specifically, it can include various media data streams such as audio, video, image, and text streams. The specific data format and content of the data stream are determined according to the actual application scenario. For example, in a web conferencing scenario, the data stream is the audio and video data that needs to be distributed to each terminal; in a live streaming scenario, the data stream can be the live media data that needs to be distributed to the viewers' terminals in the live broadcast room. The target data stream is the data stream that needs to be distributed and processed; specifically, it can be the audio data stream that the server needs to distribute to each terminal. Depending on the actual application scenario, the target data stream can be a real-time data stream or a periodically acquired data stream.
[0053] A process is a running activity of a program with certain independent functions on a certain data set in a computer. A process is an entity of a program, an instance of a running program. For example, when running an instant messaging application, the computer starts the corresponding instant messaging application process. When a computer runs multiple programs, it runs multiple processes. For a server, a process can be associated with a connected terminal. That is, for a terminal connected to the server, at least one process associated with that terminal can be started to handle the data stream for that terminal. This includes forwarding the uplink data stream sent by the terminal and distributing the downlink data stream in the data stream network to the terminal. For example, when multiple terminals participate in a web conference, the server starts multiple processes to handle the audio and video data transmission and processing for each terminal. A multiplexing process is a designated process that performs multiplexing. That is, the multiplexing process can perform multiple functions, including data stream acquisition, distribution processing, and multiplexing of the data stream. During data stream processing, the server can connect to multiple terminals, start its associated process for each terminal, and achieve communication between the terminals through the processes associated with those terminals.
[0054] For example, a server connects to terminals 1, 2, 3, and 4. Each terminal connected to the server can communicate via different data stream networks or within the same data stream network. Specifically, terminals 1 and 2 can connect to data stream network A, while terminals 3 and 4 can connect to data stream network B. Thus, terminals 1 and 2 can communicate using data streams obtained from data stream network A, and terminals 3 and 4 can communicate using data streams obtained from data stream network B. In the communication process, for terminals 1 and 2, the server can obtain data streams from data stream network A through their respective processes and distribute the data streams to terminals 1 and 2 respectively. Similarly, the server can obtain data streams from data stream network B through their respective processes and distribute the data streams to terminals 3 and 4 respectively. Terminals 1 and 2 can obtain the same data stream, and terminals 3 and 4 can obtain the same data stream. In addition to retrieving data streams for distribution from the data stream network, the multiplexing process can also reuse the retrieved data streams. This allows processes associated with other terminals within the same data stream network to directly distribute the data streams retrieved by the multiplexing process, avoiding the need to retrieve the data streams again from the data stream network. For example, in data stream network A, with terminals 1 and 2 connected, the server starts process 1 associated with terminal 1 and process 2 associated with terminal 2. If the server designates process 1 as the multiplexing process, then process 1 retrieves the target data stream from data stream network A, distributes the target data stream to terminal 1, and reuses the target data stream based on process 1. This allows process 2 to directly distribute the target data stream retrieved by process 1 to terminal 2, thus avoiding process 2 repeatedly retrieving the target data stream from data stream network A.
[0055] The multiplexing process can be selected from the processes associated with each terminal connected to the server. For example, it can be determined based on the startup order of the processes associated with each terminal, designating the first started process as the multiplexing process to obtain the target data stream to be distributed. Alternatively, the multiplexing process can be selected from the processes associated with each terminal based on their workload; for example, the process with the lowest workload among the processes associated with each terminal can be selected as the multiplexing process. Furthermore, the multiplexing process can also be a newly created process independent of the processes associated with each terminal, allowing this multiplexing process to obtain the target data stream to be distributed.
[0056] Specifically, when the server processes the data stream, it determines the multiplexing process. This process can be selected from the processes associated with the terminals connected to the server, such as the process associated with the first terminal to connect. The server then obtains the target data stream to be distributed through this multiplexing process. Alternatively, this multiplexing process can pull the target data stream to be distributed to each terminal from the data stream network, which can be the transmission network used by the terminals for communication.
[0057] Step 204: Write the target data stream into the shared memory data stream storage area through the multiplexing process, and obtain the storage information of the target data stream.
[0058] Shared memory refers to the same segment of physical memory shared by different processes, meaning multiple processes can access the same memory space. Processes can link the same segment of physical memory into their own address spaces, and all processes can access addresses within shared memory. If a process writes data to shared memory, the change will immediately affect any other process that can access the same shared memory segment. Shared memory allows two unrelated processes to access the same logical memory, making it a very efficient way to share and transfer data between two running processes. The data stream store is the area within shared memory used to store data streams. The data stream store can be logically divided, meaning a data stream store is logically partitioned within shared memory to store the target data stream acquired by multiplexing processes. In the actual physical address space of shared memory, the data stream store can share physical addresses with other areas, but logically dividing shared memory into different storage areas allows for the storage of different data in different areas, such as storing the data stream acquired by multiplexing processes in the data stream store. Storage information refers to information related to the storage of the target data stream. Specifically, it may include, but is not limited to, the storage location of the target data stream, as well as attribute information such as the data size, write time, verification information, and data sequence number. Using storage information, the written target data stream can be quickly and accurately read from the shared memory data stream storage area. For example, the storage location of the target data stream can be determined from the shared memory data stream storage area based on the storage location information. Furthermore, the attribute information at the storage location can be used to verify the read target data stream, ensuring its accuracy.
[0059] Specifically, after obtaining the target data stream to be distributed through the multiplexing process, the server writes the target data stream into shared memory through the multiplexing process. Specifically, the multiplexing process can determine the data stream storage area in the shared memory and write the target data stream into that storage area, thus obtaining the storage information of the target data stream. For example, the server uses the multiplexing process to determine the storage location in the data stream storage area where the data needs to be written, and writes the target data stream into that storage location. During the writing process, the multiplexing process obtains the storage information of the target data stream, such as its storage location and attribute information. Attribute information may include, but is not limited to, data size, write time, verification information, data sequence number, and other information related to the storage of the data stream.
[0060] Step 206: The storage information is written into the data stream information area of the shared memory through the multiplexing process, and the target data stream is sent to the terminal associated with the multiplexing process.
[0061] The data stream information area is a region within shared memory used to store information about the data stream. This area can also be logically divided; that is, the data stream storage area and the data stream information area in shared memory can share the same physical address, but are logically separated into different regions to form a two-level logical structure of shared memory. Specifically, shared memory can be divided into two levels: the first level can be the data stream information area, used to store information about the data stream, such as storage information about the data stream; the second level can be the data stream storage area, used to store the data stream itself, i.e., the specific data stream. The first and second levels of shared memory can be associated based on the stored information. When reading from shared memory, a process can first read the storage information of the target data stream from the first level of shared memory, and then, based on this information, read the target data stream from the second level of shared memory.
[0062] Specifically, after obtaining the storage information of the target data stream, the server further determines the data stream information area of the shared memory through the reuse process and writes the storage information into the data stream information area of the shared memory. This allows the process to read the target data stream obtained by the reuse process from the data stream information area of the shared memory, enabling the reuse of the target data stream in the shared memory. In addition to writing the acquired target data stream into the shared memory for reuse, the reuse process can also send the acquired target data stream to the terminal associated with the reuse process. The terminals associated with the reuse process include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft, thereby enabling the acquisition of data streams from the associated terminals.
[0063] In practical applications, the multiplexing process is a process started by the server and associated with the terminal after the terminal connects to the server. This multiplexing process can obtain the target data stream from the data stream network and send the target data stream to the terminal. At the same time, the multiplexing process can write the obtained target data stream into the data stream storage area of shared memory and write the storage information of the target data stream into the data stream information area of shared memory, so that other processes started by the server can obtain the target data stream from shared memory for distribution. This achieves the reuse of the target data stream, avoids other processes from repeatedly obtaining and processing the data stream, and improves the processing efficiency of the data stream. In addition, the multiplexing process can also be a newly created process. Specifically, after the terminal connects to the server, the server can start an associated process associated with the terminal. The server can forward the uplink data stream uploaded by the terminal through this associated process. For example, the uplink data stream of the terminal can be sent to the data stream network through this associated process. The server creates a new multiplexing process and establishes an association between the multiplexing process and the terminal. This enables the multiplexing process to obtain the downlink target data stream from the data stream network, write the target data stream into shared memory, and send it to the terminal, thereby realizing the distribution and processing of the target data stream.
[0064] Step 208: Read storage information from the data stream information area through at least one distribution process, and obtain the target data stream from the data stream storage area based on the read storage information.
[0065] In this context, the distribution process is the designated process that handles data stream distribution. This process reads the stored data stream from shared memory and sends it to the associated terminal, enabling communication between the terminals. Compared to the reuse process, the distribution process directly reads the data stream from shared memory and sends it to the associated terminal. Instead of directly acquiring the data stream, the distribution process reuses the data stream acquired by the reuse process based on shared memory. For shared memory, the reuse process acts as the writer (producer), responsible for acquiring the target data stream and writing it to shared memory. The distribution process, on the other hand, acts as the reader (consumer), responsible for reading the target data stream from shared memory and sending it to the associated terminal, thus achieving a one-write-many-read, single-producer-many-consumer data stream processing mode.
[0066] Specifically, there is at least one distribution process. This process is associated with a terminal connected to the server. After a terminal connects to the server, the server can start the process associated with the connected terminal and designate it as the distribution process. If multiple terminals are connected to the server, there will also be multiple distribution processes. The server determines the data stream information area of the shared memory through at least one distribution process and reads storage information from it. After obtaining the storage information, the distribution process determines the data stream storage area of the shared memory based on the read storage information and reads the target data stream written by the reuse process from the data stream storage area. Through this two-stage reading process of the data stream information area and the data stream storage area, the distribution process can quickly and accurately obtain the target data stream written by the reuse process from the shared memory, thus enabling the reuse of the target data stream.
[0067] Step 210: The target data stream obtained from the shared memory is sent to the terminal associated with the distribution process through at least one distribution process.
[0068] Specifically, after the distribution process reads the target data stream written by the reuse process from the shared memory, the server determines the terminal associated with the distribution process and sends the target data stream read from the shared memory to the terminal associated with the distribution process, thereby realizing the reuse of the target data stream obtained by the reuse process and achieving efficient communication processing of the terminal associated with the distribution process.
[0069] In a specific application, such as Figure 3As shown, terminals 1 through N are connected to the server. The server starts processes associated with each terminal to enable communication. Specifically, for terminal 1, the server establishes process 1 to handle communication; for terminal N, the server starts process N to handle communication. The server can connect to a data stream network to obtain downlink data streams to be sent to each terminal. Simultaneously, the server can also send uplink data streams from each terminal to the data stream network, thus enabling communication between the terminals. For uplink data processing, each process obtains the uplink data stream from its associated terminal and sends it to the data stream network. For downlink data stream processing, the server can designate a multiplexing process from the processes associated with each terminal. For example, if the server designates process 1 associated with terminal 1 as the multiplexing process, the server obtains the target data stream to be distributed from the data stream network through process 1, sends the target data stream to terminal 1, and process 1 writes the obtained target data stream into the server's preset shared memory. When writing the target data stream, the server can determine the shared memory data stream storage area through process 1, write the target data stream into the data stream storage area, obtain the storage information of the target data stream, and then the reuse process writes the storage information into the shared memory data stream information area. This process writes the acquired target data stream into the two-level shared memory structure, ensuring efficient and accurate read and write processing of the target data stream. For the other N-1 processes besides process 1, they can act as distribution processes, each reading from the server's shared memory and sending the target data stream, which process 1 acquired and wrote from the data stream network, to its respective associated terminal. This enables downlink data stream processing for each terminal and achieves efficient communication between terminals in the data stream network. Among the processes associated with each terminal on the server, only process 1 needs to handle the acquisition of the target data stream, while other processes can directly read the target data stream written by process 1 from the shared memory. This reduces the number of processes directly acquiring the data stream, lowers the processing cost of repeated data stream acquisition by the server, and improves data stream processing efficiency.
[0070] In the aforementioned data stream processing method, a multiplexing process writes the acquired target data stream to be distributed into the data stream storage area of shared memory, and writes the storage information of the acquired target data stream into the data stream information area of shared memory. The target data stream is then sent to the terminal associated with the multiplexing process. At least one distribution process reads the storage information from the data stream information area and retrieves the target data stream from the data stream storage area based on the read storage information. The distribution process then sends the target data stream retrieved from shared memory to the terminal associated with the distribution process. During the data stream processing, the multiplexing process associated with the terminal writes the acquired target data stream into the data stream storage area of shared memory and writes the storage information of the target data stream into the data stream information area of shared memory. This allows the target data stream stored in shared memory to be quickly read and sent to the associated terminal by the distribution process. When multiple terminals need to acquire the same data stream, the number of processes directly acquiring the data stream is reduced. By directly reading the data stream from shared memory and distributing it through the distribution process, the processing efficiency of the data stream is improved.
[0071] In one embodiment, writing a target data stream into a shared memory data stream storage area through a multiplexing process and obtaining the storage information of the target data stream includes: determining a preset shared memory data stream storage area through the multiplexing process; writing the target data stream into a data stream storage location in the data stream storage area; and obtaining the storage information of the target data stream based on the data stream storage location.
[0072] In this context, shared memory refers to the same segment of physical memory shared among different processes. Multiple threads running on the server can access shared memory to obtain data. The multiplexing process acts as the producer of shared memory, writing data to it for other processes to read and consume. The data stream storage area is the region within shared memory used to store data streams. The data stream storage location is the specific location within this area where the data stream needs to be written; that is, the target data stream obtained by the multiplexing process is written at the data stream storage location. The multiplexing process can determine the data stream storage location within the data stream storage area, write the target data stream there, and obtain the storage information of the target data stream based on the storage location. Therefore, when reading data from shared memory, the target data stream can be retrieved from the shared memory's data stream storage area based on this storage information.
[0073] Specifically, when writing the target data stream to shared memory via a multiplexing process, the server determines the preset shared memory location through the multiplexing process. The shared memory can be pre-configured by the server, such as specifying a physical memory address. The shared memory includes a data stream storage area for storing the specific data stream. This data stream storage area can be a region divided based on actual physical memory addresses or a logically divided region. The server determines the data stream storage area in the shared memory through the multiplexing process and determines the data stream storage location within that area. For example, the server can determine the latest write position in the data stream storage area through the multiplexing process, thereby determining the data stream storage location. After determining the data stream storage location, the server writes the target data stream to that location through the multiplexing process. In specific applications, the data stream storage location can include different fields, such as data size, data field, data sequence number, and write time field. The multiplexing process can write the target data stream into the data field of the data stream storage location. In addition, the server obtains the storage information of the target data stream through the multiplexing process based on the data stream storage location. The storage information may include the data stream storage location, so the distribution process can read the target data stream written by the multiplexing process from the data stream storage area based on the data stream storage location in the storage information.
[0074] In this embodiment, the server uses a multiplexing process to write the acquired target data stream to the data stream storage location in the shared memory data stream storage area, and obtains the storage information of the target data stream based on the data stream storage location. Thus, the acquired target data stream is written to the shared memory data stream storage area through the multiplexing process, so that the distribution process can read the target data stream from the shared memory data stream storage area according to the data stream storage location in the storage information. When multiple terminals need to acquire the same data stream, the number of processes that directly acquire the data stream is reduced, and the data stream is directly read from the shared memory and distributed by the distribution process, which improves the data stream processing efficiency.
[0075] In one embodiment, writing a target data stream to a data stream storage location in a data stream storage area includes: determining the data stream storage location in the data stream storage area and the attribute information of the target data stream; and writing the target data stream and the attribute information to the data stream storage location.
[0076] The data stream storage location refers to the specific location within the data stream storage area where the data stream needs to be written; that is, the target data stream obtained by the multiplexing process is written to the data stream storage location in the data stream storage area. Attribute information is information related to the data attributes of the target data stream, which can be used to describe the target data stream. Specifically, it may include, but is not limited to, information such as the data size, write time, verification information, and data sequence number of the target data stream. The type of attribute information for the target data stream can be flexibly set according to actual needs to accurately describe the target data stream, facilitate confirmation of the target data stream, and ensure the accuracy of the target data stream.
[0077] Specifically, when writing a target data stream to its storage location in the data stream storage area, the server can determine the storage location through a multiplexing process. This storage location can be the latest write location in the data stream storage area, obtained by updating based on the previous write location. For example, if the previous write location was numbered 3, and the latest write location after updating could be 5, then the data stream storage location in the data stream storage area can be determined as 5. The target data stream obtained by the multiplexing process is then written to storage location numbered 5. The data stream storage location can include attribute information fields and data fields. The data fields are used to write the data stream, while the attribute information fields are used to write attribute information related to the data stream, such as the data size, write time, and verification information. The attribute information of the target data stream can be obtained by the server through analysis based on the target data stream via the multiplexing process. This analysis can include determining the data size of the target data stream, identifying the writer's identifier and write time, and calculating the verification information of the target data stream. After determining the data stream storage location in the data stream storage area and the attribute information of the target data stream, the server writes the target data stream and attribute information into the data stream storage location in the data stream storage area through the reuse process, thereby writing the target data stream into the shared memory data stream storage area.
[0078] Furthermore, based on the data stream storage location, the storage information of the target data stream is obtained, including: obtaining the storage information of the target data stream based on the data stream storage location and attribute information.
[0079] Specifically, the server obtains the storage information of the target data stream through a multiplexing process based on the data stream storage location and attribute information of the target data stream. The storage information of the target data stream includes its storage location in the data stream storage area, i.e., the data stream storage location, as well as the attribute information of the target data stream, such as the data size, write time, verification information, data stream sequence number, writer identifier, etc.
[0080] In this embodiment, the server writes the target data stream and its attribute information into the data stream storage location in the data stream storage area through a multiplexing process. Based on the data stream storage location and attribute information, the server obtains the storage information of the target data stream. This allows the distribution process to read the target data stream from the shared memory data stream storage area based on the data stream storage location in the storage information. The server also verifies the target data stream based on the attribute information in the storage information, ensuring the accuracy of the read data stream.
[0081] In one embodiment, writing a target data stream to a data stream storage location in a data stream storage area includes: determining a data stream storage location in the data stream storage area based on a data stream storage location identifier in the data stream storage area; obtaining write permissions for the data stream storage location; and writing the target data stream to the data stream storage location based on the write permissions.
[0082] The data stream storage location identifier can be the location identification information of the data stream storage location, specifically such as location number, physical address, etc. The data stream storage location identifier corresponds to the data stream storage location in the data stream storage area, and can uniquely identify the corresponding data stream storage location from the data stream storage area. In practical applications, the data stream storage location can be the most recently written location in the data stream storage area, then the data stream storage location identifier can be the location identifier of the most recently written location in the data stream storage area. Write permission refers to the permission to perform write operations on the data stream storage location in the data stream storage area. Only processes with write permissions can write to the data stream storage location, thereby avoiding conflicts between processes writing to the data stream storage location.
[0083] Specifically, the server obtains the data stream storage location identifier in the data stream storage area through a multiplexing process. This involves querying the write information in the data stream storage area to extract the latest write location's data stream storage location identifier. Based on this identifier, the server determines the data stream storage location within the data stream storage area. This location is the storage location in shared memory where the target data stream needs to be written. The server then obtains write permissions for this data stream storage location through the multiplexing process, granting it write access. In practical applications, the server can use the multiplexing process to acquire write permissions for the data stream storage location using a lock-free algorithm. For example, the multiplexing process can execute a CAS (Compare And Swap) algorithm to gain write permissions. The CAS algorithm includes three operands: the memory value V, the old expected value A, and the new value B to be modified. The memory value V is modified to B only if the expected value A and the memory value V are the same; otherwise, nothing is done. Based on the CAS algorithm, the expected value A in the operands of the multiplexing process can be made the same as the memory value V at the data stream storage location. This allows modification of the memory value V at the data stream storage location, thus writing it into the target data stream. After the multiplexing process has write permissions to the data stream storage location, the server uses the multiplexing process, based on the obtained write permissions, to write the acquired target data stream into the data stream storage location, thereby writing the target data stream into shared memory.
[0084] In this embodiment, the server determines the data stream storage location in the data stream storage area through the multiplexing process based on the data stream storage location identifier in the data stream storage area, and obtains write permission for the data stream storage location. Based on the write permission, the server writes the obtained target data stream into the data stream storage location through the multiplexing process. The data stream storage location to be written can be accurately determined through the data stream storage location identifier, and the write permission ensures that the multiplexing process and other processes will not have write conflicts to the data stream storage location, thus ensuring the processing efficiency of writing the target data stream into shared memory and thus ensuring the processing efficiency of the data stream.
[0085] In one embodiment, writing stored information into the data stream information area of shared memory through a multiplexing process includes: determining the data stream information area of shared memory through the multiplexing process; determining the information storage location in the data stream information area based on the information storage location identifier of the data stream information area; and writing the stored information into the information storage location.
[0086] The data stream information area is a region in shared memory used to store information about the data stream. The information storage location identifier is the location identifier for the information to be written within the data stream information area; this can be a location number, physical address, or other identifier. The information storage location identifier corresponds to the information storage location within the data stream information area, uniquely determining the corresponding information storage location. In practical applications, the information storage location can be the most recently written location within the information storage area, and the information storage location identifier can be the location identifier of that most recently written location. The stored information is related to the storage of the target data stream, and may include, but is not limited to, the storage location of the target data stream, as well as attribute information such as the data size, write time, verification information, and data sequence number.
[0087] Specifically, the multiplexing process writes the target data stream into the shared memory's data stream information area. After obtaining the storage information of the target data stream, the server determines the shared memory's data stream information area through the multiplexing process. The data stream information area can be a logically partitioned region within the shared memory used to store data stream information. The server determines the information storage location identifier within the data stream information area through the multiplexing process, and determines the information storage location within the data stream information area based on the information storage location identifier. The information storage location is the position within the data stream information area where the stored information needs to be written. The server writes the target data stream's storage information into the information storage location within the data stream information area through the multiplexing process, thereby writing the target data stream's storage information into the shared memory's data stream information area. This allows the distribution process to read the stored information from the shared memory's data stream information area and, based on the read storage information, retrieve the target data stream from the shared memory's data stream storage area for distribution.
[0088] In this embodiment, the server, through a multiplexing process, determines the information storage location within the data stream information area based on the information storage location identifier. The multiplexing process then writes the obtained target data stream's storage information into this location. This allows the distribution process to read the stored information from the shared memory's data stream information area and, based on this information, retrieve the target data stream from the shared memory's data stream storage area for distribution. When multiple terminals need to acquire the same data stream, this reduces the number of processes directly acquiring the data stream. By directly reading the data stream from shared memory and distributing it through the distribution process, data stream processing efficiency is improved.
[0089] In one embodiment, such as Figure 4 As shown, the process of reading the target data stream involves, through at least one distribution process, reading stored information from the data stream information area and obtaining the target data stream from the data stream storage area based on the read stored information, including:
[0090] Step 402: Determine the data flow information area of the shared memory through at least one distribution process.
[0091] The distribution process is a designated process that handles data stream distribution. This process reads the stored data stream from shared memory and sends it to the associated terminal, enabling communication between them. The number of distribution processes is related to the number of terminals that need to read data from shared memory. If the server starts a process associated with each terminal connected to it, then each terminal is associated with a corresponding process, and the number of distribution processes is the same as the number of terminals that need to read data from shared memory. Compared to the reuse process, the distribution process can directly read the data stream from shared memory and send it to the associated terminal. The distribution process does not directly acquire the data stream but reuses the data stream acquired by the reuse process based on shared memory. The data stream information area is a region in shared memory used to store information about the data stream. This area contains the data stream's storage information, and the required data stream can be read from the shared memory's data stream storage area based on this information.
[0092] Specifically, the server determines a preset shared memory and a data stream information area of the shared memory through at least one distribution process, and then reads storage information from the data stream information area of the shared memory to read the target data stream from the shared memory based on the storage information.
[0093] Step 404: Read the stored information from the data stream information area according to the information storage location identifier of the data stream information area.
[0094] The information storage location identifier is the location identifier of the most recently written information in the data stream information area. Specifically, it can be a location number, physical address, or other identifier. The information storage location identifier corresponds to the information storage location in the data stream information area, and the corresponding information storage location can be uniquely determined from the information storage area based on the information storage location identifier. The stored information is information related to the storage of the target data stream.
[0095] Specifically, the server determines the information storage location identifier in the data stream information area through the distribution process. This information storage location identifier corresponds to the information storage location within the data stream information area. The distribution process can then read stored information from the data stream information area based on this information storage location identifier. In other words, the server determines the information storage location from the data stream information area based on the information storage location identifier through the distribution process. This information storage location is both the location where the stored information is stored and the location where it needs to be read. The distribution process then retrieves the stored information from this determined information storage location.
[0096] Step 406: Obtain the target data stream from the shared memory data stream storage area based on the read storage information.
[0097] The data stream storage area is a region within shared memory used to store data streams; specifically, it stores the data streams acquired and written by the multiplexing process. The server, through its distribution process, retrieves the target data stream from the shared memory's data stream storage area based on the storage information read from the data stream information area. Specifically, the server, through its distribution process, determines the data stream's storage location within the shared memory's data stream storage area from the read storage information, and the distribution process then retrieves the target data stream from that location.
[0098] In this embodiment, the server uses at least one distribution process to read stored information from the data stream information area according to the information storage location identifier of the data stream information area, and obtains the target data stream from the data stream storage area of shared memory based on the read stored information. This reduces the number of processes that directly obtain the data stream when multiple terminals need to obtain the same data stream, and improves the data stream processing efficiency by directly reading the data stream from shared memory and distributing it through the distribution process.
[0099] In one embodiment, obtaining a target data stream from a shared memory data stream storage area based on read storage information includes: performing storage information verification on the read storage information to obtain a storage information verification result; when the storage information verification result is successful, reading a data stream from the shared memory data stream storage area based on the storage information; and when the read result obtained from the data stream read passes the data stream verification, obtaining the target data stream based on the read result.
[0100] The storage information verification result is the result obtained by verifying the read storage information. This result characterizes the legitimacy of the storage information read from the shared memory data stream information area, i.e., whether the read storage information is valid. Data stream reading is the process of reading data from the shared memory data stream storage area to obtain a data stream when the obtained storage information is valid. The read result obtained from the data stream reading passes the data stream verification, indicating that the read result from the shared memory data stream storage area is valid, thus allowing the target data stream to be obtained based on the read result.
[0101] Specifically, the server verifies the read storage information through a distribution process. This verification can be based on validation information within the stored information to confirm its validity. If the verification passes, the read storage information is considered valid. The server then reads the data stream from the shared memory's data stream storage area using the distribution process. Specifically, the server determines the data stream's storage location based on the storage information and reads the data stream from that location in the data stream storage area to obtain the read result. If the read result passes data stream validation, the server verifies its validity through the distribution process. If the validation passes, the server obtains the target data stream based on the read result, thus achieving accurate and rapid reading of the target data stream from shared memory for distribution processing.
[0102] Furthermore, if the storage information verification result is a failure, or the read result obtained from the data stream fails the data stream verification, it indicates that the storage information read through the distribution process is invalid, or the data stream read through the distribution process is invalid. In this case, the read result can be discarded and the read can be performed again. Alternatively, the distribution process can return to execute the read based on the information storage location identifier in the data stream information area to perform the next read process.
[0103] In this embodiment, when the storage information verification result of the read storage information is successful, the server reads the data stream from the data stream storage area of the shared memory through the distribution process. If the read result of the data stream passes the data stream verification, the target data stream is obtained based on the read result. This enables the target data stream to be accurately and quickly read from the shared memory through the distribution process and then distributed. When multiple terminals need to obtain the same data stream, the number of processes that directly obtain the data stream is reduced. By directly reading the data stream from the shared memory through the distribution process, the processing efficiency of the data stream is improved.
[0104] In one embodiment, performing storage information verification on the read storage information to obtain a storage information verification result includes: extracting storage information to be verified and first verification reference information from the read storage information; generating storage matching information according to the storage information verification conditions based on the storage information to be verified; and performing verification matching between the storage matching information and the first verification reference information to obtain a storage information verification result.
[0105] The storage information to be verified refers to the information within the stored information that needs to be verified. Specifically, this can include information corresponding to fields such as data size, write time, frame sequence number, and data storage location. The first verification reference information serves as a reference for verification within the stored information. Based on the first verification reference information, the storage information to be verified can be validated, thereby achieving storage information verification processing and ensuring the legality of the stored information. In specific applications, the first verification reference information can be obtained by performing calculations on the information written by the multiplexing process to the corresponding fields of the storage information to be verified. When the multiplexing process writes to the corresponding fields of the storage information to be verified, the written information is summed to obtain the first verification reference information. The storage information of the target data stream includes the first verification reference information and the written information. The storage information verification conditions include processing methods for the storage information to be verified to obtain storage matching information used for verification matching. These methods may include algorithms for processing the storage information to be verified, such as summation, product, and other processing methods. By processing the storage information to be verified by the storage information verification conditions, storage matching information corresponding to the storage information to be verified can be generated. The storage matching information can be used to perform verification matching with the first verification reference information, thereby realizing the storage information verification processing of the storage information to determine the legality and validity of the read storage information.
[0106] Specifically, the server extracts the storage information to be verified and the first verification reference information from the read storage information through a distribution process. The storage information may include data from different fields, specifically data from reference fields and data from non-reference fields. The distribution process can extract the first verification reference information corresponding to the reference fields and the storage information to be verified corresponding to the non-reference fields. The server obtains pre-set storage information verification conditions through the distribution process. These conditions include the processing method for the storage information to be verified during storage information verification, in order to generate corresponding storage matching information. The server generates storage matching information based on the storage information to be verified and the obtained storage information verification conditions through the distribution process. Specifically, the server can perform a summation operation on the storage information to be verified using the storage information verification conditions through the distribution process to obtain the storage matching information. The server then performs a verification match between the storage matching information and the first verification reference information through the distribution process to obtain the storage information verification result. If the stored matching information matches the first verification reference information, it indicates that the read stored information is legal and valid, and data stream reading can continue based on the stored information; if the stored matching information does not match the first verification reference information, it indicates that the read stored information is illegal and invalid, and the current reading can be discarded and the reading process can be repeated to ensure the accuracy of data stream reading.
[0107] In this embodiment, the server extracts the storage information to be verified and the first verification reference information from the read storage information through the distribution process. According to the preset storage information verification conditions, it generates storage matching information based on the storage information to be verified, and performs verification matching between the storage matching information and the first verification reference information to realize the storage information verification of the storage information and obtain the storage information verification result. This can ensure the legality and validity of the read storage information and improve the accuracy of data stream reading.
[0108] In one embodiment, when the read result obtained from the data stream passes the data stream verification, the target data stream is obtained based on the read result, including: determining the data stream information to be verified, the first verification reference information, and the second verification reference information based on the read result obtained from the data stream; generating storage matching information and data stream matching information according to the storage information verification conditions and the data stream verification conditions based on the data stream information to be verified; performing verification matching between the storage matching information and the first verification reference information, and performing verification matching between the data stream matching information and the second verification reference information to obtain the data stream verification result; when the data stream verification result is that the verification passes, the target data stream is obtained based on the read result.
[0109] The data stream information to be verified includes data corresponding to fields such as data size, write time, frame sequence number, data storage location, and read data stream. Compared to the storage information to be verified in the storage information, the data stream information to be verified includes not only the storage information to be verified in the storage information but also the read data stream itself. The first verification reference information is used to verify the storage information; based on the first verification reference information, the information in the data stream information to be verified that corresponds to the storage information can be verified. The second verification reference information is used to verify the data stream information to be verified. In specific applications, the first verification reference information can be obtained by processing the information written by the multiplexing process in the fields of the data stream information to be verified that are identical to those in the storage information. The second verification reference information can be obtained by processing the information written by the multiplexing process in the corresponding fields of the data stream information to be verified. By using the first and second verification reference information, both the storage information and the data stream itself covered by the data stream information to be verified can be verified, ensuring the accuracy of the data stream verification.
[0110] The storage information verification conditions and data stream verification conditions each include processing methods for the data stream information to be verified to obtain matching information used for verification matching. The storage information verification conditions and data stream verification conditions can include different processing methods and can also be tailored to different data types in the data stream information to be verified. Specifically, the storage information verification conditions can include processing methods for information in the data stream information to be verified that is identical to the stored information to be verified, to obtain storage matching information used for verification matching. This can include arithmetic rules for the information in the data stream information to be verified that is identical to the stored information, specifically various processing methods such as summation and product. By processing the information in the data stream information to be verified that is identical to the stored information through the storage information verification conditions, storage matching information corresponding to the identical information in the data stream information to be verified can be generated. This storage matching information can then be used for verification matching with the first verification reference information, thereby achieving the verification processing of the information in the data stream information to be verified that is identical to the stored information. Data stream verification conditions can include processing all information of the data stream to be verified, specifically including information identical to the stored information and the stored data stream itself, to obtain processing methods for data stream matching information used for verification matching. This can include algorithms for calculating the data stream information to be verified, such as summation, product, and other processing methods. By processing the data stream information to be verified through data stream verification conditions, data stream matching information corresponding to the data stream information to be verified can be generated. This data stream matching information can then be used for verification matching with second verification reference information, thereby achieving the verification processing of the data stream information to be verified.
[0111] Specifically, the server determines the data stream information to be verified, the first verification reference information, and the second verification reference information from the read results obtained from the data stream through the distribution process. The data stream information to be verified includes information identical to the stored information to be verified in the reference information, as well as the stored data stream itself. The server obtains pre-set stored information verification conditions and data stream verification conditions through the distribution process. The stored information verification conditions include the processing method for identical information in the data stream information to be verified when performing verification processing on such identical information, in order to generate corresponding stored matching information for the data stream information to be verified; the data stream verification conditions include the processing method for all information in the data stream information to be verified when performing verification processing on all information, in order to generate corresponding data stream matching information for the data stream information to be verified.
[0112] The server, through its distribution process, generates storage matching information and data stream matching information based on the data stream information to be verified, according to the obtained storage information verification conditions and data stream verification conditions. Specifically, the server, through its distribution process, sums up the information in the storage information to be verified that is identical to the stored information, obtaining storage matching information; and sums up the information in the storage information to be verified, obtaining data stream matching information, according to the data stream verification conditions. The server, through its distribution process, performs verification matching between the storage matching information and the first verification reference information, and between the data stream matching information and the second verification reference information, obtaining the data stream verification result. If the storage matching information matches the first verification reference information, and the data stream matching information matches the second verification reference information, it indicates that the read data stream is legal and valid, and the data stream verification result is passed. The server can then use the distribution process to obtain the target data stream written to shared memory by the multiplexing process based on the read result.
[0113] In this embodiment, the server determines the data stream information to be verified, the first verification reference information, and the second verification reference information based on the reading result obtained from the data stream reading through the distribution process. Based on the data stream information to be verified, and according to the storage information verification conditions and the data stream verification conditions, storage matching information and data stream matching information are generated respectively. The storage matching information is verified and matched with the first verification reference information, and the data stream matching information is verified and matched with the second verification reference information to obtain the data stream verification result. When the data stream verification result is that the verification is passed, the target data stream is obtained based on the reading result, so as to realize the verification of the reading result of the data stream reading, which can ensure the legality and validity of the read data stream and improve the accuracy of data stream reading.
[0114] In one embodiment, reading stored information from the data stream information area based on the information storage location identifier of the data stream information area includes: obtaining the information storage location identifier of the data stream information area; determining the current location identifier of the information storage location currently being read by the distribution process; determining the target location identifier from the information storage location identifier of the data stream information area based on the current location identifier; and reading stored information from the data stream information area based on the target location identifier.
[0115] The information storage location identifier is the location identifier of the information storage location in the data stream information area where the stored information needs to be written. Specifically, it can be a location number, physical address, or other identifier information. The current location identifier is the location identifier of the information storage location to be read during the current read operation. The target location identifier is the location identifier of the information storage location to be read, re-determined based on the current location identifier and the information storage location identifier in the data stream information area.
[0116] Specifically, when reading stored information, the server obtains the information storage location identifier of the data stream information area through the distribution process and determines the current location identifier of the information storage location currently being read by the distribution process. Based on the current location identifier, the server determines the target location identifier from the information storage location identifiers in the data stream information area through the distribution process. In specific applications, the information storage location identifier of the data stream information area can be the location identifier of the most recently written position in the data stream information area. The server compares the current location identifier with the information storage location identifiers in the data stream information area through the distribution process to determine the difference between the information storage location currently being read by the distribution process and the most recently written position in the data stream information area. Based on this difference, the target location identifier is determined, and the distribution process reads the stored information from the data stream information area based on the target location identifier.
[0117] In practical implementation, if the information storage location currently read by the distribution process is the same as the latest written location in the data stream information area, it indicates that the distribution process is currently reading the latest written data in the data stream information area. In this case, the target location identifier can be determined as either the current location identifier or the information storage location identifier in the data stream information area. If the information storage location currently read by the distribution process is different from the latest written location in the data stream information area, and the difference does not meet the update conditions (e.g., the difference does not exceed the preset data length), the target location identifier can be determined as the current location identifier, and data is read from the data stream information area based on the current location identifier, thus ensuring the integrity of the read data stream. If the information storage location currently read by the distribution process is different from the latest written location in the data stream information area, and the difference meets the update conditions (e.g., the difference exceeds the preset data length), the target location identifier can be determined as the information storage location identifier in the data stream information area, and data is read from the data stream information area based on the information storage location identifier in the data stream information area, thus ensuring the real-time performance of the read data stream.
[0118] In this embodiment, the server determines the target location identifier by means of the current location identifier of the information storage location currently read by the distribution process and the information storage location identifier of the data stream information area, and reads the stored information from the data stream information area based on the target location identifier, which can balance the real-time performance and integrity of the data when reading the data stream.
[0119] In one embodiment, the target data stream is a media data stream. Obtaining the target data stream to be distributed through a multiplexing process includes: when the first terminal accesses the media network, obtaining the media data stream from the media network through a multiplexing process associated with the first terminal.
[0120] The target data stream is a media data stream, which can include at least one of the following: audio data stream, video data stream, image data stream, and text data stream. In different application scenarios, the media data stream can have different data formats. The media network is the network that the terminal accesses for communication. The terminal transmits media data streams through the media network to achieve network communication. The first terminal is the terminal that first accesses the media network. Specifically, when the server detects that the first terminal has accessed the media network, the server can start the process associated with the first terminal. The server selects the process associated with the first terminal as a multiplexing process and obtains the media data stream from the media network through this multiplexing process.
[0121] Furthermore, sending the target data stream to the terminal associated with the multiplexing process includes: sending the media data stream to the first terminal via the multiplexing process.
[0122] Specifically, when sending the target data stream to the terminal associated with the multiplexing process, the server can send the obtained media data stream to the first terminal through the multiplexing process, so that the first terminal can directly obtain the media data stream obtained from the media network by the multiplexing process.
[0123] Furthermore, by at least one distribution process, storage information is read from the data stream information area, and the target data stream is obtained from the data stream storage area based on the read storage information, including: when at least one second terminal accesses the media network, storage information is read from the data stream information area by the distribution process associated with the second terminal, and the media data stream is obtained from the data stream storage area based on the read storage information.
[0124] The second terminal is the terminal that accesses the media network after the first terminal. Specifically, when the server detects that at least one second terminal has accessed the media network after the first terminal, the server can start the process associated with the second terminal and set the process associated with the second terminal as a distribution process. The server reads storage information from the data stream information area through the distribution process associated with the second terminal, and obtains the media data stream from the data stream storage area based on the read storage information.
[0125] Furthermore, the target data stream obtained from shared memory is sent to the terminal associated with the distribution process through at least one distribution process, including: sending the media data stream obtained from shared memory to a second terminal through the distribution process.
[0126] Specifically, after the server obtains the media data stream from the shared memory through the distribution process associated with the second terminal, the server sends the media data stream obtained from the shared memory to the second terminal through the distribution process, so that the distribution process associated with the second terminal obtains the media data stream from the shared network without having to repeatedly pull it from the media network.
[0127] In a specific application, such as Figure 5 As shown, the first terminal connects to the server to access the media network and communicate through it. After the server connects to the first terminal, it starts process 1 associated with the first terminal and designates process 1 as a multiplexed process. The first process then pulls media data streams from the media network, sends the pulled media data streams to the first terminal, and writes the pulled media data streams to a preset shared memory. Figure 6 As shown, the second terminal also connects to the server after the first terminal to access the same media network. After the server connects to the second terminal, it starts process 2 associated with the second terminal and designates process 2 as the distribution process. Process 2 can read the media data stream pulled and written from the media network by process 1 from shared memory and send the read media data stream to the second terminal. In addition, process 2 can also send the uplink data stream sent by the second terminal to the media network. Figure 7 As shown, the third terminal connects to the server after the first and second terminals to access the same media network. After connecting to the third terminal, the server starts process 3 associated with the third terminal and designates process 3 as the distribution process. Process 3 can read the media data stream pulled and written from the media network by process 1 from shared memory and send the read media data stream to the third terminal. In addition, process 3 can also send the uplink data stream sent by the third terminal to the media network. Furthermore, other terminals can continue to connect. For each terminal that connects later, its associated process is set as the distribution process so that the distribution process can obtain the media data stream from shared memory and send it to the corresponding terminal.
[0128] In this embodiment, for the first terminal that first accesses the media network, the server obtains the media data stream from the media network through a multiplexing process associated with the first terminal, and sends the media data stream to the first terminal through the multiplexing process. For the second terminal that accesses the media network after the first terminal, the server reads the storage information from the data stream information area through a distribution process associated with the second terminal, and obtains the media data stream from the data stream storage area based on the read storage information, and sends the obtained media data stream to the second terminal. During the media data stream processing, by writing the obtained media data stream into the data stream storage area of shared memory through the multiplexing process associated with the first terminal that accesses earlier, and writing the storage information of the target data stream into the data stream information area of shared memory, the media data stream stored in shared memory can be quickly read by the distribution process and sent to the associated second terminal that accesses later. When both the first terminal and the second terminal need to obtain the same media data stream, the number of processes that directly obtain the data stream is reduced. By directly reading the media data stream from shared memory and distributing it through the distribution process, the processing efficiency of the media data stream is improved.
[0129] This application also provides an application scenario in which the above-described data stream processing method is applied. Specifically, the data stream processing method is applied in this scenario as follows:
[0130] like Figure 8As shown, in a video conferencing system, the media gateway primarily enables interconnection between video conferencing terminals and different communication networks. Specifically, the media gateway can achieve interconnection with the cloud conferencing application side, such as the media side of a conferencing app, through the transmission network. Cloud conferencing is an efficient, convenient, and low-cost conferencing format based on cloud computing technology. Users only need to perform simple and easy-to-use operations through an internet interface to quickly and efficiently share voice, data files, and video with teams and clients around the world. The complex technologies of data transmission and processing during the meeting are handled by the cloud conferencing service provider. Currently, domestic cloud conferencing mainly focuses on services based on the SaaS (Software as a Service) model, including telephone, internet, and video services. Video conferencing based on cloud computing is called cloud conferencing. In the era of cloud conferencing, data transmission, processing, and storage are all handled by the computer resources of the video conferencing vendor. Users no longer need to purchase expensive hardware or install cumbersome software; they only need to open a browser, log in to the corresponding interface, and conduct efficient remote meetings. Cloud conferencing systems support dynamic multi-server cluster deployment and provide multiple high-performance servers, greatly improving meeting stability, security, and availability. In recent years, video conferencing has gained popularity among users due to its ability to significantly improve communication efficiency, continuously reduce communication costs, and upgrade internal management. It has been widely applied in various fields such as transportation, logistics, telecommunications, education, and enterprises. Undoubtedly, with the application of cloud computing, video conferencing will be even more attractive in terms of convenience, speed, and ease of use, which will surely usher in a new wave of video conferencing applications.
[0131] A media gateway can be a multi-process architecture server. For video terminals 1 to N, the media gateway starts the media processes associated with each video terminal, such as media process 1 associated with video terminal 1 and media process N associated with video terminal N. Each media process (MP) represents a media processing process, and each video terminal corresponds to one media process (MP). The media process (MP) is used to receive uplink audio and video streams from the video terminals and send them to the conference app through the transmission network; it also receives audio and video streams from the conference app through the transmission network, processes them through transcoding and merging, and then sends them to the video terminals. If multiple video terminals join the same conference and are connected to the same media gateway, and other apps can also participate in the conference, then multiple media processes (MP) on the media gateway need to repeatedly fetch and transcode the audio and video streams from the conference app through the transmission network, causing unnecessary performance overhead. To save system overhead, in this embodiment, one media process (MP) fetches and transcodes the audio and video streams from the conference app and puts them into shared memory. Other media processes (MP) that need this audio and video stream can directly read it from the shared memory.
[0132] Specifically, the conferencing media gateway receives uplink audio and video streams from video terminals and sends downlink audio and video streams to them. It operates on a multi-process model, with each process corresponding to one video terminal. When multiple video terminals join the same conference and connect to the same media gateway, each process of the media gateway will repeatedly pull a single downlink audio and video stream. Shared memory is a common inter-process communication method. Common shared memory methods include one-write-one-read, one-write-multiple-read, multiple-write-one-read, and multiple-write-multiple-read. One-write-one-read refers to one process writing to shared memory and another process consuming from it, i.e., a single producer, single consumer model, which can achieve lock-free operation. Multiple-write-multiple-read refers to multiple processes writing to and reading from shared memory, requiring locking. Generally, a single piece of data written can only be consumed by one process, and each process moves its pointer after consumption. However, this embodiment involves a one-write-multiple-read scenario, where each piece of data written must be consumed by all reading processes; that is, each reading process must consume the full amount of data in shared memory.
[0133] Specifically, such as Figure 9 As shown, when writing audio and video streams obtained from the transmission network into shared memory via a specified multiplexing process, the streams are first written to the second-level shared memory and then to the first-level shared memory. Specifically, step 901 involves determining the shared memory, which can be determined by the server or the media gateway in the conferencing system through the multiplexing process; step 902 involves stream pulling and transcoding, specifically by the multiplexing process pulling and transcoding the streams from the transmission network to obtain the audio and video streams. Step 903: Determine the latest write position in the second-level shared memory, specifically determined by the multiplexing process. Step 904: Obtain write permission for the latest write position, specifically through a CAS algorithm. Step 905: Write the bitstream and bitstream information to the specified shared memory location, specifically by the multiplexing process writing the obtained bitstream and bitstream information, including bitstream verification information, to the specified shared memory location in the second-level shared memory. Step 906: Write the bitstream information to the first-level shared memory, specifically by the multiplexing process writing the bitstream information to the first-level shared memory. Step 907: Update the latest write position in the first-level shared memory, so that the guided multiplexing process writes the bitstream obtained from the transmission network into the two-level shared memory structure.
[0134] Furthermore, such as Figure 10As shown, when reading the bitstream from shared memory through a specified distribution process, step 1001 involves determining the shared memory, which can be done by the media gateway through the distribution process; step 1002 involves determining the latest write position of the first-level shared memory, which can also be done by the media gateway through the distribution process; step 1003 involves reading the bitstream information of the node corresponding to the latest write position, which can be done by the distribution process; step 1004 involves verifying the read bitstream information; step 1005 involves determining whether the verification passes; if the verification fails, step 1006 is executed to discard the read bitstream information, that is, when the verification fails, the read bitstream information is discarded and the reading process is repeated. Step 1007: If the verification passes, read the bitstream from the second-level shared memory. Specifically, the distribution process can read the bitstream from the second-level shared memory based on the bitstream information. Step 1008: Verify the read bitstream. Step 1009: Determine whether the verification passes. If the verification fails, proceed to step 1010, discard the read bitstream, and return to re-read the process. If the verification passes, proceed to step 1011, send the read bitstream to the terminal associated with the distribution process, and perform the next reading.
[0135] In this embodiment, a single media gateway can have multiple shared memory queues. The shared memory is divided into a two-level structure. The first-level shared memory is used to record metadata such as the address of the bitstream stored in the shared memory, while the second-level shared memory is used to store the actual data frames of the bitstream. Thus, the first-level shared memory occupies less space, and multiple queues can be used. Since the first-level shared memory is not actually used simultaneously, it can also share the storage space of the second-level shared memory, thereby reducing the total shared memory space. Furthermore, for audio and video streams, the data stored in the second-level shared memory (i.e., the element sizes in the second-level shared memory) can be different, while the element structure in the first-level shared memory can be the same.
[0136] For the first level of shared memory, its structure can be as follows:
[0137] pos elem_size elem_count elem elem …… …… ……
[0138] In this system, the shared memory is a circular array structure. `pos`, `elem_size`, and `elem_count` are metadata, each occupying 4 bytes. Following the metadata is a fixed-length data node `elem`. `pos` represents the latest write position in the first-level shared memory. `pos` is a monotonically increasing number, and its actual position in the array is `pos %elem_count`, which is the remainder of the latest write position and the number of elements. Common shared memory queues have `head` and `tail`, representing the head and tail of the queue, respectively. The tail moves when writing data, and the head moves when reading data. Since an `elem` is read by multiple processes, and the head cannot be moved after reading, a single `pos` is used to represent the latest write position. `elem_size` is the size of each element in the first-level shared memory, `elem_count` is the number of elements in the first-level shared memory, and `elem` is the specific element in the first-level shared memory. The structure of each `elem` is as follows...
[0139] seq timestamp data_size data_ptr checksum1
[0140] Where seq is the frame sequence number of the bitstream, timestamp is the timestamp when it was written, data_size is the size of each data frame in the bitstream, data_ptr is the pointer to the actual frame storage, and checksum1 is the checksum generated by seq, timestamp, data_size and data_ptr.
[0141] Specifically, for the first-level shared memory, there is only one write process. There is no contention during writing, so locking is unnecessary. When the process reads data for the first time, it can obtain the latest frame based on `pos` and periodically read new data frames. If the current `cur_pos` consumed by the process is less than `pos`, it can continue to consume data from the shared memory. The shared memory needs to be able to cache data for a sufficient duration, but during writing, it cannot be guaranteed that the write space will not be read simultaneously; that is, there is a possibility that the data might be overwritten before it is fully read. In this case, `checksum1` can be used to ensure that the read data is valid and complete. Specifically, after reading the data, the `checksum1` is checked for validity. If valid, the actual data frame is obtained based on `data_ptr`; if invalid, it indicates that the reading process is lagging behind for a considerable time. To ensure the real-time processing of the data stream, the read data stream can be discarded, and the next element `elem` can be accessed. Furthermore, if the latest write position `pos` - the current read position `cur_pos` > the number of elements `elem_size` in the first-level shared memory, it means the process is too far behind, and reading can start from the latest position to ensure the real-time processing of the data stream.
[0142] For the second level of shared memory, its structure can be as follows:
[0143] pos elem_size elem_count frame_elem frame_elem …… …… ……
[0144] Where `pos` represents the latest write position in the second-level shared memory, `elem_size` is the size of each element in the second-level shared memory, `elem_count` is the number of elements in the second-level shared memory, and `frame_elem` is a specific element in the second-level shared memory, with each `frame_elem` having a fixed length. The structure of `frame_elem` is as follows.
[0145] write_id seq timestamp data_size data checksum1 checksum2
[0146] In this structure, the `data_ptr` in the first-level shared memory element points to the `frame_elem` in the second-level shared memory. `data` represents the actual stored bitstream data, designed to fit a maximum of one 1080P frame. The size of a single 1080P YUV raw stream frame can be 1920 x 1080 x 1.5 = 3110400 pixels. `write_id` represents the writer identifier, which can be the starting address of the first-level shared memory queue. `seq` is the frame sequence number of the bitstream, `timestamp` is the timestamp at the time of writing, `data_size` is the size of each data frame in the bitstream, `checksum1` is the checksum generated from `seq`, `timestamp`, `data_size`, and `data_ptr`, while `checksum2` can be the checksum generated from the items in `frame_elem`.
[0147] The second-level shared memory may be written to by multiple processes. A CAS algorithm is used to ensure that only processes with write permissions perform write operations on the corresponding frame_elem. Similarly, the position in the second-level shared memory is also incremented to avoid the ABA problem of the CAS algorithm. Furthermore, write-overwrite read scenarios are handled specifically. When reading data, the read results are validated: seq, timestamp, and checksum1 must match those obtained from the first shared memory structure. The write_id also needs to be verified, as does checksum2, which is the checksum generated by writing all data in the frame element. If the checksum fails, it indicates data corruption and write-overwrite, and the data can be discarded.
[0148] In this embodiment, when multiple terminals acquire bitstreams through their respective processes, one process is selected to pull the bitstream and write it into a two-level shared memory. Other processes directly read the bitstream from the shared memory. Based on the shared memory, one-write-multiple-read bitstream multiplexing is achieved, avoiding all processes from repeatedly pulling bitstreams and improving bitstream processing efficiency.
[0149] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0150] Based on the same inventive concept, this application also provides a data stream processing apparatus for implementing the data stream processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data stream processing apparatus embodiments provided below can be found in the limitations of the data stream processing method described above, and will not be repeated here.
[0151] In one embodiment, such as Figure 11 As shown, a data stream processing device 1100 is provided, including: a data stream acquisition module 1102, a data stream writing module 1104, a storage information writing module 1106, a data stream reading module 1108, and a data stream distribution module 1110, wherein:
[0152] Data stream acquisition module 1102 is used to acquire the target data stream to be distributed through the multiplexing process;
[0153] The data stream writing module 1104 is used to write the target data stream into the data stream storage area of shared memory through the multiplexing process, and to obtain the storage information of the target data stream;
[0154] The storage information writing module 1106 is used to write storage information into the data stream information area of shared memory through the multiplexing process, and send the target data stream to the terminal associated with the multiplexing process;
[0155] The data stream reading module 1108 is used to read stored information from the data stream information area through at least one distribution process, and obtain the target data stream from the data stream storage area based on the read stored information;
[0156] The data stream distribution module 1110 is used to send a target data stream obtained from shared memory to the terminal associated with the distribution process through at least one distribution process.
[0157] In one embodiment, the data stream writing module 1104 includes a data stream storage area determination module, a target data stream writing module, and a storage information acquisition module; wherein: the data stream storage area determination module is used to determine a preset shared memory data stream storage area through a multiplexing process; the target data stream writing module is used to write the target data stream to the data stream storage location in the data stream storage area; and the storage information acquisition module is used to obtain the storage information of the target data stream according to the data stream storage location.
[0158] In one embodiment, the target data stream writing module is further configured to determine the data stream storage location in the data stream storage area and the attribute information of the target data stream; write the target data stream and attribute information into the data stream storage location; and the storage information acquisition module is further configured to obtain the storage information of the target data stream based on the data stream storage location and attribute information.
[0159] In one embodiment, the target data stream writing module is further configured to determine the data stream storage location in the data stream storage area based on the data stream storage location identifier of the data stream storage area; obtain write permissions for the data stream storage location; and write the target data stream in the data stream storage location based on the write permissions.
[0160] In one embodiment, the storage information writing module 1106 includes a data stream information area determination module, an information storage location determination module, and an information storage location writing module; wherein: the data stream information area determination module is used to determine the data stream information area of the shared memory through a multiplexing process; the information storage location determination module is used to determine the information storage location in the data stream information area according to the information storage location identifier of the data stream information area; and the information storage location writing module is used to write storage information in the information storage location.
[0161] In one embodiment, the data stream reading module 1108 includes a distribution process information area determination module, a storage information reading module, and a target data stream reading module; wherein: the distribution process information area determination module is used to determine the data stream information area of the shared memory through at least one distribution process; the storage information reading module is used to read storage information from the data stream information area according to the information storage location identifier of the data stream information area; and the target data stream reading module is used to obtain the target data stream from the data stream storage area of the shared memory according to the read storage information.
[0162] In one embodiment, the target data stream reading module includes a storage information verification module, a storage information processing module, and a target data stream acquisition module; wherein: the storage information verification module is used to verify the read storage information and obtain a storage information verification result; the storage information processing module is used to read the data stream from the data stream storage area of shared memory according to the storage information when the storage information verification result is successful; and the target data stream acquisition module is used to obtain the target data stream according to the reading result when the reading result obtained from the data stream reading passes the data stream verification.
[0163] In one embodiment, the storage information verification module is further configured to extract the storage information to be verified and the first verification reference information from the read storage information; generate storage matching information according to the storage information verification conditions based on the storage information to be verified; and perform verification matching between the storage matching information and the first verification reference information to obtain the storage information verification result.
[0164] In one embodiment, the target data stream acquisition module is further configured to determine the data stream information to be verified, the first verification reference information, and the second verification reference information based on the reading result obtained from the data stream reading; generate storage matching information and data stream matching information according to the data stream information to be verified, based on the storage information verification conditions and the data stream verification conditions; perform verification matching between the storage matching information and the first verification reference information, and perform verification matching between the data stream matching information and the second verification reference information to obtain the data stream verification result; when the data stream verification result is that the verification is passed, obtain the target data stream based on the reading result.
[0165] In one embodiment, the storage information reading module is further configured to obtain the information storage location identifier of the data stream information area; determine the current location identifier of the information storage location currently being read by the distribution process; determine the target location identifier from the information storage location identifiers of the data stream information area based on the current location identifier; and read the stored information from the data stream information area based on the target location identifier.
[0166] In one embodiment, the target data stream is a media data stream; the data stream acquisition module 1102 is further configured to acquire the media data stream from the media network through a multiplexing process associated with the first terminal when the first terminal accesses the media network; the storage information writing module 1106 is further configured to send the media data stream to the first terminal through the multiplexing process; the data stream reading module 1108 is further configured to read storage information from the data stream information area through a distribution process associated with the second terminal when at least one second terminal accesses the media network, and obtain the media data stream from the data stream storage area according to the read storage information; the data stream distribution module 1110 is further configured to send the media data stream obtained from the shared memory to the second terminal through a distribution process.
[0167] Each module in the aforementioned data stream processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0168] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 12 As shown. The computer device includes a processor, memory, input / output interface (I / O), and communication interface. The processor, memory, and I / O interface are connected via a system bus, and the communication interface is connected to the system bus via the I / O interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores target data stream data. The I / O interface is used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a data stream processing method. Those skilled in the art will understand that... Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0169] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0170] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0171] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.
[0172] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0173] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0174] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. The above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of this application. It should be noted that for those skilled in the art, several modifications and improvements can be made without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data stream processing method, characterized in that, The method includes: When the first terminal first accesses the media network, the media data stream is obtained from the media network through the multiplexing process associated with the first terminal; The media data stream is written to the shared memory data stream storage area through the multiplexing process, and the storage information of the media data stream is obtained. The storage information is written into the data stream information area of the shared memory through the multiplexing process, and the media data stream is sent to the first terminal through the multiplexing process. When at least one second terminal accesses the media network after the first terminal, the storage information is read from the data stream information area through the distribution process associated with the second terminal, and the media data stream is obtained from the data stream storage area based on the read storage information; The media data stream obtained from the shared memory is sent to the second terminal through the distribution process.
2. The method according to claim 1, characterized in that, The step of writing the media data stream into the shared memory data stream storage area through the multiplexing process and obtaining the storage information of the media data stream includes: The preset shared memory data stream storage area is determined through the reuse process; The media data stream is written to the data stream storage location in the data stream storage area; Based on the storage location of the data stream, the storage information of the media data stream is obtained.
3. The method according to claim 2, characterized in that, Writing the media data stream to the data stream storage location in the data stream storage area includes: Determine the storage location of the data stream in the data stream storage area, as well as the attribute information of the media data stream; The media data stream and the attribute information are written to the data stream storage location; Obtaining the storage information of the media data stream based on its storage location includes: The storage information of the media data stream is obtained based on the data stream storage location and the attribute information.
4. The method according to claim 2, characterized in that, Writing the media data stream to the data stream storage location in the data stream storage area includes: The data stream storage location in the data stream storage area is determined based on the data stream storage location identifier of the data stream storage area; Obtain write permission for the storage location of the data stream; Based on the write permission, the media data stream is written to the data stream storage location.
5. The method according to claim 1, characterized in that, The step of writing the stored information into the data stream information area of the shared memory through the multiplexing process includes: The data stream information area of the shared memory is determined through the reuse process; The information storage location in the data stream information area is determined based on the information storage location identifier of the data stream information area; The stored information is written into the information storage location.
6. The method according to claim 1, characterized in that, The step of reading the storage information from the data stream information area through the distribution process associated with the second terminal, and obtaining the media data stream from the data stream storage area based on the read storage information, includes: The data stream information area of the shared memory is determined by at least one distribution process; The stored information is read from the data stream information area according to the information storage location identifier of the data stream information area; Based on the read storage information, the media data stream is obtained from the data stream storage area of the shared memory.
7. The method according to claim 6, characterized in that, The step of obtaining the media data stream from the data stream storage area of the shared memory based on the read storage information includes: The read storage information is verified to obtain the storage information verification result; When the storage information verification result is successful, the data stream is read from the data stream storage area of the shared memory according to the storage information; When the reading result obtained from the data stream passes the data stream verification, the media data stream is obtained based on the reading result.
8. The method according to claim 7, characterized in that, The step of verifying the read stored information to obtain the storage information verification result includes: Extract the storage information to be verified and the first verification reference information from the read storage information; Based on the storage information to be verified and according to the storage information verification conditions, storage matching information is generated; The storage matching information is verified and matched with the first verification reference information to obtain the storage information verification result.
9. The method according to claim 7, characterized in that, When the read result obtained from the data stream passes the data stream verification, the media data stream is obtained based on the read result, including: Based on the reading results obtained from the data stream reading, determine the data stream information to be verified, the first verification reference information, and the second verification reference information; Based on the data stream information to be verified, storage matching information and data stream matching information are generated according to the storage information verification conditions and data stream verification conditions, respectively. The stored matching information is verified and matched with the first verification reference information, and the data stream matching information is verified and matched with the second verification reference information to obtain the data stream verification result; When the data stream verification result is successful, the media data stream is obtained based on the reading result.
10. The method according to claim 6, characterized in that, The step of reading the stored information from the data stream information area according to the information storage location identifier of the data stream information area includes: Obtain the information storage location identifier of the data stream information area; Determine the current location identifier of the information currently being read by the distribution process; Based on the current location identifier, determine the target location identifier from the information storage location identifier of the data stream information area; The stored information is read from the data stream information area based on the target location identifier.
11. A data stream processing apparatus, characterized in that, The device includes: The data stream acquisition module is used to acquire media data streams from the media network through a multiplexing process associated with the first terminal when the first terminal first accesses the media network. The data stream writing module is used to write the media data stream into the data stream storage area of shared memory through the multiplexing process, and to obtain the storage information of the media data stream; The storage information writing module is used to write the storage information into the data stream information area of the shared memory through the multiplexing process, and send the media data stream to the first terminal through the multiplexing process; A data stream reading module is used to read the storage information from the data stream information area through a distribution process associated with the second terminal when at least one second terminal accesses the media network after the first terminal, and to obtain the media data stream from the data stream storage area based on the read storage information; A data stream distribution module is used to send the media data stream obtained from the shared memory to the second terminal through the distribution process.
12. The apparatus according to claim 11, characterized in that, The data stream writing module includes a data stream storage area determination module, a target data stream writing module, and a storage information acquisition module; The data stream storage area determination module is used to determine the preset shared memory data stream storage area through the multiplexing process; The target data stream writing module is used to write the media data stream to the data stream storage location in the data stream storage area; The storage information acquisition module is used to obtain the storage information of the media data stream based on the storage location of the data stream.
13. The apparatus according to claim 12, characterized in that, The target data stream writing module is further configured to determine the data stream storage location in the data stream storage area, and the attribute information of the media data stream; and write the media data stream and the attribute information into the data stream storage location. The storage information acquisition module is further configured to obtain the storage information of the media data stream based on the storage location of the data stream and the attribute information.
14. The apparatus according to claim 12, characterized in that, The target data stream writing module is further configured to determine the data stream storage location in the data stream storage area based on the data stream storage location identifier of the data stream storage area; Obtain write permission for the storage location of the data stream; Based on the write permission, the media data stream is written to the data stream storage location.
15. The apparatus according to claim 11, characterized in that, The storage information writing module includes a data stream information area determination module, an information storage location determination module, and an information storage location writing module; The data stream information area determination module is used to determine the data stream information area of the shared memory through the multiplexing process; The information storage location determination module is used to determine the information storage location in the data stream information area based on the information storage location identifier of the data stream information area; The information storage location writing module is used to write the stored information into the information storage location.
16. The apparatus according to claim 11, characterized in that, The data stream reading module includes a distribution process information area determination module, a storage information reading module, and a target data stream reading module; The distribution process information area determination module is used to determine the data stream information area of the shared memory through at least one distribution process. The storage information reading module is used to read the stored information from the data stream information area according to the information storage location identifier of the data stream information area; The target data stream reading module is used to obtain the media data stream from the data stream storage area of the shared memory based on the read storage information.
17. The apparatus according to claim 16, characterized in that, The target data stream reading module includes a storage information verification module, a storage information processing module, and a target data stream acquisition module; The storage information verification module is used to verify the read storage information and obtain the storage information verification result. The storage information processing module is used to read data streams from the data stream storage area of the shared memory according to the storage information when the storage information verification result is a successful verification. The target data stream acquisition module is used to obtain the media data stream based on the reading result when the reading result obtained from the data stream reading passes the data stream verification.
18. The apparatus according to claim 17, characterized in that, The storage information verification module is also used to extract the storage information to be verified and the first verification reference information from the read storage information; Based on the storage information to be verified and according to the storage information verification conditions, storage matching information is generated; The storage matching information is verified and matched with the first verification reference information to obtain the storage information verification result.
19. The apparatus according to claim 17, characterized in that, The target data stream acquisition module is further configured to determine the data stream information to be verified, the first verification reference information, and the second verification reference information based on the reading result obtained from the data stream reading; and to generate storage matching information and data stream matching information respectively according to the data stream information to be verified and the storage information verification conditions and the data stream verification conditions. The stored matching information is verified and matched with the first verification reference information, and the data stream matching information is verified and matched with the second verification reference information to obtain the data stream verification result; When the data stream verification result is successful, the media data stream is obtained based on the reading result.
20. The apparatus according to claim 16, characterized in that, The storage information reading module is also used to obtain the information storage location identifier of the data stream information area; and to determine the current location identifier of the information storage location currently read by the distribution process; Based on the current location identifier, determine the target location identifier from the information storage location identifier of the data stream information area; The stored information is read from the data stream information area based on the target location identifier.
21. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.
22. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.
23. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Concurrent read-write method and device for stream data
CN106658050A