Streaming media data transmission method, device, terminal equipment and storage medium

The IOCP model receives and directly sends streaming media data. According to the client's endpoint information, the server's inefficiency problem is solved in the case of multiple clients, and the effect of improving processing efficiency is achieved.

CN111901689BActive Publication Date: 2024-12-03VISIONVERA INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010556099.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-17
Publication Date
2024-12-03
Estimated Expiration
2040-06-17

AI Technical Summary

Technical Problem

When the server interacts with multiple clients, when using the IOCP model for data transmission, it takes a lot of time to have more clients, resulting in low server efficiency.

Method used

The IOCP model receives streaming media data sent by the client, and directly sends streaming media data to the corresponding client based on the client's endpoint information, avoiding the data of each client being added to the worker thread for queueing.

Benefits of technology

Save time for clients to queue and improve server processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111901689B_ABST
    Figure CN111901689B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, apparatus, terminal device and storage medium for transmitting streaming media data, including: receiving streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client; sending the streaming media data to a client corresponding to the endpoint information according to the endpoint information of the client. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to a working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, thereby saving the queuing time of the client and improving the processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device, terminal equipment and storage medium for transmitting streaming media data. Background Art

[0002] In the prior art, when a server interacts with multiple clients, the IOCP model is used for data transmission. Based on the function of the IOCP model, the data of each client needs to be added to a working thread, and each client needs to queue up for processing. If there are many clients, it takes a lot of time and the server's working efficiency is low. Summary of the invention

[0003] In view of the above problems, embodiments of the present invention are proposed to provide a method, apparatus, terminal device and storage medium for transmitting streaming media data that overcome the above problems or at least partially solve the above problems.

[0004] In a first aspect, an embodiment of the present invention provides a method for transmitting streaming media data, the method comprising:

[0005] Receiving streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client;

[0006] According to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information.

[0007] Optionally, receiving the streaming media data sent by the client through the IOCP model includes:

[0008] Through the IOCP model, the streaming media data sent by the client using the UDP protocol is received.

[0009] Optionally, the endpoint information includes an IP address and a port, and sending the streaming media data to a client corresponding to the endpoint information according to the endpoint information of the client includes:

[0010] Processing the streaming media data to obtain processed streaming media data;

[0011] According to the IP address and port of the client, the processed streaming media data is sent to the client corresponding to the IP address and port.

[0012] Optionally, the streaming media data further includes a service type, and the processing of the streaming media data to obtain processed streaming media data includes:

[0013] The streaming media data is processed according to the service type to obtain processed streaming media data.

[0014] Optionally, pre-create the IOCP model;

[0015] Create UDP sockets corresponding to each client in advance;

[0016] Bind the IOCP model to the UDP socket.

[0017] Optionally, the method further comprises:

[0018] The endpoint information of the client is stored in a memory space pre-allocated for the IOCP model, so that the server determines the streaming media data sent by the client corresponding to the endpoint information through the IOCP model according to the endpoint information.

[0019] In a second aspect, an embodiment of the present invention provides a streaming media data transmission device, the device comprising:

[0020] A receiving module, used for receiving streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client;

[0021] The sending module is used to send the streaming media data to the client corresponding to the endpoint information according to the endpoint information of the client.

[0022] Optionally, the receiving module is used to:

[0023] Through the IOCP model, the streaming media data sent by the client using the UDP protocol is received.

[0024] Optionally, the endpoint information includes an IP address and a port, and the sending module is used to:

[0025] Processing the streaming media data to obtain processed streaming media data;

[0026] According to the IP address and port of the client, the processed streaming media data is sent to the client corresponding to the IP address and port

[0027] Optionally, the streaming media data also includes a service type, and the sending module is further used to:

[0028] The streaming media data is processed according to the service type to obtain processed streaming media data.

[0029] Optionally, the device further includes a binding module, and the binding module is used to:

[0030] Create IOCP model in advance;

[0031] Create UDP sockets corresponding to each client in advance;

[0032] Bind the IOCP model to the UDP socket.

[0033] Optionally, the device further comprises a saving module, wherein the saving module is used to:

[0034] The endpoint information of the client is stored in a memory space pre-allocated for the IOCP model, so that the server determines the streaming media data sent by the client corresponding to the endpoint information through the IOCP model according to the endpoint information.

[0035] In a third aspect, an embodiment of the present invention provides a terminal device, including: at least one processor and a memory;

[0036] The memory stores a computer program; the at least one processor executes the computer program stored in the memory to implement the streaming media data transmission method provided in the first aspect.

[0037] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed, the method for transmitting streaming media data provided in the first aspect is implemented.

[0038] The embodiments of the present invention include the following advantages:

[0039] The embodiment of the present invention provides a method, an apparatus, a terminal device and a storage medium for transmitting streaming media data. A server receives streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to a working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, thereby saving the queuing time of the client and improving the processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a flow chart of steps of an embodiment of a method for transmitting streaming media data of the present invention;

[0041] Figure 2 is a flow chart of steps of another embodiment of a method for transmitting streaming media data of the present invention;

[0042] Figure 3 is a flow chart of steps of another embodiment of a method for transmitting streaming media data of the present invention;

[0043] Figure 4 It is a structural block diagram of an embodiment of a transmission device for streaming media data of the present invention;

[0044] Figure 5 It is a structural schematic diagram of a terminal device of the present invention. DETAILED DESCRIPTION

[0045] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0046] The glossary is explained as follows:

[0047] IOCP: I / O Completion Port, commonly known as I / O completion port, is an asynchronous I / O operation model that efficiently handles large-capacity client data exchange. It is suitable for high-load servers (that can control concurrent execution). It is an asynchronous I / O API that can efficiently notify applications of I / O events.

[0048] UDP: User Datagram Protocol, is a connectionless transport layer protocol in the OSI reference model, providing simple transaction-oriented information transmission services.

[0049] IP address: Internet Protocol Address, a way of addressing a host on the Internet, also known as an Internet Protocol address. Common IP addresses are divided into two categories: IPv4 and IPv6.

[0050] An embodiment of the present invention provides a method for transmitting streaming media data, which is used to transmit streaming media data. The execution subject of this embodiment is a streaming media data transmission device, which is set on a server.

[0051] Reference Figure 1 , shows a flow chart of a method for transmitting streaming media data according to an embodiment of the present invention, which can be applied in visual networking and may specifically include the following steps:

[0052] S101, receiving streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client;

[0053] Specifically, the server uses the kernel queue of the IOCP module as the basic communication, forms a network cluster with a large number of clients, and can form a high-availability network processing architecture under the database cluster. The server architecture platform can perform data processing and analysis with high concurrency, stability, and scalability. According to the server memory size and the number of CPUs, the number of working threads and processing modes are intelligently adjusted to achieve the best state, giving full play to the potential of server hardware.

[0054] In an embodiment of the present invention, a server is connected to a large number of clients, and a large number of clients simultaneously send streaming media data to the server. In order to solve the problem of high concurrency, an IOCP model needs to be established in the server. The IOCP model consists of three main bodies, the first main thread, the second I / O operation thread, and the third operating system. First, the main thread generates a completion port, initializes the listening socket and generates two I / O operation threads with twice the number of CPUs plus two. After that, the main task of the main thread is to access new clients; the operation thread is responsible for commanding the operating system to receive and send data, and the operating system is responsible for the specific work of sending and receiving data, and sends the execution results to the completion port. The I / O operation thread continuously reads the sending and receiving execution results on the completion port to determine the next step of operation, and this cycle is repeated.

[0055] Specifically, the server receives streaming media data sent by multiple clients through the IOCP model, wherein the streaming media data can be audio or video, and the streaming media data includes the client's endpoint information, wherein the client's endpoint information includes the client's IP address and port number, and the endpoint information contained in the streaming media data is used for returning data.

[0056] Streaming media data can be a public protocol or a private protocol. The IOCP model is used as a transmission bearer and does not care about the data content of the streaming media data. However, combined with the characteristics of the bound UDP protocol, it is generally used to transmit audio and video media data.

[0057] S102: According to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information.

[0058] Specifically, in the process of business between the server and the client, the server receives the streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client, and the endpoint information of each client is saved. After being processed by the processing module on the server, the processed data of the client is not added to the working thread for queuing. Instead, after each streaming media data is processed, the processed streaming media data, i.e., audio and video data, is sent to the client corresponding to the endpoint information according to the endpoint information.

[0059] In the embodiment of the present invention, as long as the audio and video data sent by the client is received through the IOCP model, there is no need to enter the audio and video data into the working thread of the IOCP model for queue processing. The server directly sends the audio and video data to the corresponding client through the IP address and port number of the client, saving the time of queue processing.

[0060] The streaming media data transmission method provided by the embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to the working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, which saves the queuing time of the client and improves the processing efficiency.

[0061] Another embodiment of the present invention further supplements the method for transmitting streaming media data provided in the above embodiment.

[0062] like Figure 2 FIG. 1 is a flowchart showing another embodiment of a method for transmitting streaming media data according to the present invention. The method for transmitting streaming media data includes:

[0063] S201, pre-create an IOCP model;

[0064] Specifically, the IOCP model is a WIN32 network I / O model that includes both the network connection part and some I / O operation functions. It is used to facilitate our control of concurrent network I / O operations, maintains the work thread pool, and is also responsible for the memory pool of the I / O channel. It implements thread management and I / O request notifications by itself, and minimizes thread context switching. It implements thread optimization scheduling by itself, improving the utilization rate of CPU and memory buffer.

[0065] Establish an IOCP model on the server. The created IOCP model is used to manage the corresponding I / O requests for a large number of connected sockets. When the specific business is in progress, try to send large data packets, and try not to send an IOCP request for each small data packet, which can easily exhaust the internal queue of IOCP and cause errors; do not try to modify the content of the data buffer used in the request after sending the IOCP request and before receiving the completion notification, because during this period, the server may read these buffers; in order to avoid memory copying, you can try to close the SOCKET's send and receive buffers, and need more receive requests to POST to a SOCKET with a relatively large data flow, so as to ensure that the system can always find the BUFFER to receive the incoming data; when receiving multiple requests, if there is more than one WORKTHREAD, some means must be used to ensure that the received data is processed in the order of sending and receiving requests, otherwise, the received streaming media data packets will be arranged in a chaotic order in the processing queue, and errors will occur in subsequent processing.

[0066] Specifically for working threads, it is best to establish the number of CPUs * 2 + 2, and the IOCP working threads are optimized and scheduled by the system, so you don't need to do extra work yourself; after receiving the streaming media data packet sent by the client, there is no need to check whether it is sent complete, because IOCP determines whether the received streaming media data packet is complete.

[0067] When encountering memory problems during business operations, the number of worker threads should be gradually reduced, and the client where the failure occurred can be located based on the endpoint information.

[0068] The OVERLAPPED object must be saved in a persistent location and not released until the operation is completed (whether successful or failed), otherwise it may cause various problems. A brand new OVERLAPPED object must be prepared for each SEND and RECV operation, and it cannot be reused for convenience. All IOCP work is scheduled and completed inside the function that obtains the completion status, so in addition to paying attention to the number of worker threads, you should also pay attention to keeping enough worker threads in the waiting state to obtain the completion status. Doing so requires reducing the burden on the worker threads and ensuring that the worker threads have time-consuming work to handle. Try to keep the SEND and RECV buffer size a multiple of the system page size, because when the system sends or receives data, it will lock the user memory, and a buffer smaller than the page will waste an entire page.

[0069] S202, pre-create UDP sockets corresponding to each client;

[0070] Specifically, a UDP socket corresponding to each client is established on the server to receive streaming data packets sent by each client. UDP is a connectionless and unreliable datagram protocol, which is different from the connection-oriented reliable byte stream provided by TCP. From a resource perspective, UDP sockets have relatively low overhead because there is no need to maintain a network connection, and because no time is spent on connecting, UDP sockets are also faster.

[0071] In a UDP socket program, the client does not need to establish a connection with the server, but only needs to use the SENDTO function to send datagrams to the server. Similarly, the server does not need to accept connections from clients, but only needs to call the RECVfrom function and wait for data from a client to arrive.

[0072] Writing a UDP socket application involves certain steps:

[0073] 1. Create a socket;

[0074] You can use the system call SOCKET to create a socket and return the file descriptor of the socket. The created socket is an endpoint of a communication line.

[0075] #include<sys / socket.h>

[0076] int socket(int domain,int type,int protocol);

[0077] The domain parameter specifies which protocol family to use. Common protocol families include AF_UNIX and AF_INET. AF_UNIX is used for local sockets implemented through the file system, and AF_INET is used for network sockets.

[0078] The type parameter specifies the communication type of this socket, and the values ​​include SOCK_STREAM and SOCK_DGRAM.

[0079] SOCK_STREAM is a stream socket, based on TCP, providing reliable and ordered services.

[0080] SOCK_DGRAM is a datagram socket, based on UDP, providing unreliable and unordered services. SOCK_DGRAM type sockets are the focus of this article.

[0081] protocol allows specifying a protocol for the socket.

[0082] 2. Named sockets

[0083] In order to make the created socket available to other processes, the socket must be named. Naming the socket means associating the socket with an IP address and port number, which can be achieved using the system call bind.

[0084] #include<sys / socket.h>

[0085] int bind(int socket,const struct sockaddr*address,size_t address_len);

[0086] Among them: the bind system call assigns the address in the parameter address to the socket associated with the file descriptor socket, and the length of the address structure is passed by the parameter address_len.

[0087] Each socket domain has its own format. For the AF_INET domain, the socket address is specified by the structure socket_in.

[0088] The member sin_port indicates the port number of the socket. For client sockets, the port number of the socket generally does not need to be specified, but for server sockets, the port number of the socket needs to be specified so that the client can correctly send data to the server. If the port number does not need to be specified, the value of sin_port can be set to 0.

[0089] The member sin_addr represents the address of the socket, that is, the IP address of the client. If no IP address is specifically bound to the socket, the operating system can choose one, that is, sin_addr uses the address 0.0.0.0, and uses INADDR_ANY to represent this address constant.

[0090] 3. On the server side, wait for the client's message;

[0091] UDP is a connectionless and unreliable datagram protocol. The server does not accept the connection from the client, but only calls the RECVfrom system call and waits for the client's data to arrive. The declaration of RECVfrom is as follows:

[0092] #include<sys / socket.h>

[0093] int RECVfrom(int socket,void*buffer,size_t length,int flags,structsockaddr*src_addr,socklen_t*src_len);

[0094] Among them, the parameters of RECVfrom are described as follows;

[0095] socket: created socket descriptor

[0096] buffer: pointer to the input buffer length:

[0097] Buffer size flags: In this article, you can set flags to 0

[0098] src_addr: pointer to the client socket address

[0099] src_len: address length The return value of RECVfrom is the length of the read data.

[0100] UDP is connectionless, so the client can send messages directly to the server without establishing a connection. The client uses the SENDTO system call to send messages to the server;

[0101] 4. On the client side, send customer messages;

[0102] 5. Close the socket;

[0103] The server operating system allocates a file descriptor for each socket. In order for the operating system to reclaim the file descriptor, you can use the close system call:

[0104] S203: Bind the IOCP model to the UDP socket.

[0105] Specifically, a listening UDP Socket is created on the server. After receiving a new connection from a client, the UDPSocket is associated with the completion port and an I / O request is delivered to the IOCP.

[0106] In UDP, the socket created by WSASocket or Socket is bound to the completion port.

[0107] Exemplarily, an IOCP model is created on the server, wherein the number of working threads in the IOCP model is generally twice the number of cores or twice + 2. After the creation is successful, the working thread has started working. Create n (n is a natural number greater than 0, such as 10) asynchronous receiving sockets on the server to receive connections from UDP sockets, and bind the UDP sockets to the IOCP model for accessing large-scale streaming media data. This case uses the UDP transmission mode based on the IOCP model for large concurrent transmission of media streams to improve real-time performance.

[0108] S204: Receive streaming media data sent by the client using the UDP protocol through the IOCP model, wherein the streaming media data includes endpoint information of the client.

[0109] Specifically, the server receives streaming media data sent by multiple clients through the IOCP model, wherein the streaming media data can be audio or video, and the streaming media data includes the client's endpoint information, wherein the client's endpoint information includes the client's IP address and port number, and the endpoint information contained in the streaming media data is used for returning data.

[0110] Streaming media data can be a public protocol or a private protocol. The IOCP model is used as a transmission bearer and does not care about the data content of the streaming media data. However, combined with the characteristics of the bound UDP protocol, it is generally used to transmit audio and video media data.

[0111] S205: Save the endpoint information of the client in the memory space pre-allocated for the IOCP model, so that the server determines the streaming media data sent by the client corresponding to the endpoint information through the IOCP model according to the endpoint information.

[0112] Specifically, the server stores the corresponding relationship between the endpoint information of the client and the identifier of the client in a database of the server, so as to return the streaming media data to the corresponding client.

[0113] Specifically, through the endpoint information of the client, the server can locate the client corresponding to the endpoint information, and then know which client sent the streaming media data.

[0114] After creating the IOCP model, connect to the created UDP_SERVER socket. Use the query mechanism of the IOCP model to quickly locate which link data to process. Each time RECVFrom or WSARECVFrom in UDP, the IP of the UDP data source will be returned. This data structure will be modified to the IOCPDATA data receiving object, including: the number of bytes received, the IP address of the data source, and the length of the IP address of the data source, so as to distinguish various IP source data for processing.

[0115] S206: Process the streaming media data according to the service type to obtain processed streaming media data.

[0116] Specifically, the service type may be live broadcast, video phone, etc. The server processes the streaming media data according to different service types to obtain processed streaming media data.

[0117] For example, depending on the service type, the streaming media data may be encoded and decoded using H264 or other encoding methods to obtain the streaming media data in the required audio and video format.

[0118] S207: According to the IP address and port of the client, the processed streaming media data is sent to the client corresponding to the IP address and port.

[0119] Specifically, in the process of business between the server and the client, the server receives the streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client, and the endpoint information of each client is saved. After being processed by the processing module on the server (such as encoding and decoding processing), the processed data of the client is not added to the working thread for queuing. Instead, after each streaming media data is processed, the processed streaming media data, i.e., audio and video data, is sent to the client corresponding to the endpoint information according to the endpoint information.

[0120] Figure 3 FIG. 1 is a flow chart of another embodiment of a method for transmitting streaming media data according to the present invention. Figure 3 As shown, it is applied to a media resource server, referred to as a server, connected to multiple media terminals (clients), and the streaming media data transmission method includes:

[0121] 1. Create an IOCP model.

[0122] 2. Create a UDP socket.

[0123] 3. IOCP model binds UDP socket.

[0124] 4. When the client sends data through UDP, the streaming data packet sent by the client through the UDP protocol is obtained through the IOCP model, and the streaming data packet is delivered to IOCPDATA through WSARECVFrom.

[0125] 5. IOCPDATA in the server saves the OVERLAPPED structure, IP address, port number, data content, data type, data length and other information in the streaming media data.

[0126] 6. After WSARECVFrom is delivered successfully, the OVERLAPPED structure is used to accept the next delivery.

[0127] 7. IOCPDATA data can process the streaming media data packets by finding the corresponding link based on IP and other information.

[0128] 8. The processed streaming media data is sent directly to the client through the UDP socket and the corresponding endpoint information without entering the IOCP asynchronous transmission, which saves queuing time and improves business processing efficiency.

[0129] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0130] The streaming media data transmission method provided by the embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to the working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, which saves the queuing time of the client and improves the processing efficiency.

[0131] Another embodiment of the present invention provides a streaming media data transmission device, which is used to execute the streaming media data transmission method provided in the above embodiment.

[0132] Reference Figure 4 , shows a structural block diagram of an embodiment of a streaming media data transmission device of the present invention, the device may specifically include the following modules: a receiving module 301 and a sending module 302, wherein:

[0133] The receiving module 301 is used to receive streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client;

[0134] The sending module 302 is used to send the streaming media data to the client corresponding to the endpoint information according to the endpoint information of the client.

[0135] The streaming media data transmission device provided by the embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to the working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, which saves the client's queuing time and improves processing efficiency.

[0136] Another embodiment of the present invention further supplements the device for transmitting streaming media data provided in the above embodiment.

[0137] Optionally, the receiving module 301 is used to:

[0138] Through the IOCP model, the streaming media data sent by the client using the UDP protocol is received.

[0139] Optionally, the endpoint information includes an IP address and a port, and the sending module 302 is used to:

[0140] Processing the streaming media data to obtain processed streaming media data;

[0141] According to the IP address and port of the client, the processed streaming media data is sent to the client corresponding to the IP address and port

[0142] Optionally, the streaming media data further includes a service type, and the sending module 302 is further used to:

[0143] The streaming media data is processed according to the service type to obtain processed streaming media data.

[0144] Optionally, the device further includes a binding module, and the binding module is used to:

[0145] Create IOCP model in advance;

[0146] Create UDP sockets corresponding to each client in advance;

[0147] Bind the IOCP model to the UDP socket.

[0148] Optionally, the device further comprises a saving module, wherein the saving module is used to:

[0149] The endpoint information of the client is stored in the memory space pre-allocated for the IOCP model, so that the server can determine the streaming media data sent by the client corresponding to the endpoint information through the IOCP model according to the endpoint information. It should be noted that each practicable method in this embodiment can be implemented separately, or can be implemented in any combination without conflict, and this application is not limited thereto.

[0150] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0151] The streaming media data transmission device provided by the embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, wherein the streaming media data includes the endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to the working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, which saves the client's queuing time and improves processing efficiency.

[0152] Still another embodiment of the present invention provides a terminal device, which is used to execute the streaming media data transmission method provided in the above embodiment.

[0153] Figure 5 is a schematic diagram of the structure of a terminal device of the present invention, such as Figure 5 As shown, the terminal device includes: at least one processor 401 and a memory 402;

[0154] The memory stores a computer program; and the at least one processor executes the computer program stored in the memory to implement the method for transmitting streaming media data provided in the above embodiment.

[0155] Among them, the terminal device is a server.

[0156] The terminal device provided in this embodiment receives streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives streaming media data sent by the client through the IOCP model, and does not need to add the streaming media data of each client to the working thread in the IOCP model, nor does it need each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, thereby saving the queuing time of the client and improving the processing efficiency.

[0157] Yet another embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed, the method for transmitting streaming media data provided in any of the above embodiments is implemented.

[0158] According to the computer-readable storage medium of this embodiment, streaming media data sent by the client is received through the IOCP model, wherein the streaming media data includes the endpoint information of the client; according to the endpoint information of the client, the streaming media data is sent to the client corresponding to the endpoint information. The embodiment of the present invention receives the streaming media data sent by the client through the IOCP model, and there is no need to add the streaming media data of each client to the working thread in the IOCP model, nor does it require each client to queue up and wait. The server directly sends the streaming media data to the client according to the endpoint information of the client, which saves the client's queuing time and improves processing efficiency.

[0159] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0160] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0161] The embodiments of the present invention are described with reference to flowcharts and / or block diagrams of methods, electronic devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing electronic device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing electronic device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing electronic device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing electronic device so that a series of operating steps are executed on the computer or other programmable electronic device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable electronic device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0164] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0165] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or electronic device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or electronic device. In the absence of further restrictions, the elements defined by the sentence "comprises one..." do not exclude the presence of other identical elements in the process, method, article or electronic device including the elements.

[0166] A method for transmitting streaming media data and a device for transmitting streaming media data provided by the present invention are introduced in detail above. Specific examples are used herein to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there may be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for transmitting streaming media data, It is characterized in that The method comprises: Receiving streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client; the endpoint information includes an IP address and a port of the client, and the endpoint information is used to transmit data back; The endpoint information of the client is stored in the memory space pre-allocated for the IOCP model, so that the server determines the streaming media data sent by the client corresponding to the endpoint information through the IOCP model according to the endpoint information; Processing the streaming media data to obtain processed streaming media data; The processed streaming media data is not added to the working thread in the IOCP model for queuing, and the processed streaming media data is directly sent to the client corresponding to the IP address and port according to the IP address and port of the client.

2. The method according to claim 1, It is characterized in that The receiving of streaming media data sent by the client through the IOCP model includes: Through the IOCP model, the streaming media data sent by the client using the UDP protocol is received.

3. The method according to claim 1, It is characterized in that The streaming media data also includes a service type, and the processing of the streaming media data to obtain the processed streaming media data includes: The streaming media data is processed according to the service type to obtain processed streaming media data.

4. The method according to claim 1, It is characterized in that The method further comprises: Create IOCP model in advance; Create UDP sockets corresponding to each client in advance; Bind the IOCP model to the UDP socket.

5. A streaming media data transmission device, It is characterized in that The device comprises: A receiving module, used for receiving streaming media data sent by a client through an IOCP model, wherein the streaming media data includes endpoint information of the client; the endpoint information includes an IP address and a port of the client, and the endpoint information is used for returning data; A sending module, used for sending the streaming media data to a client corresponding to the endpoint information according to the endpoint information of the client; The sending module is used for: Processing the streaming media data to obtain processed streaming media data; The processed streaming media data is not added to the work thread in the IOCP model for queuing, and the processed streaming media data is directly sent to the client corresponding to the IP address and port according to the IP address and port of the client; The device further comprises a storage module, wherein the storage module is used for: The endpoint information of the client is stored in a memory space pre-allocated for the IOCP model, so that the server determines the streaming media data sent by the client corresponding to the endpoint information through the IOCP model according to the endpoint information.

6. The device according to claim 5, It is characterized in that The receiving module is used for: Through the IOCP model, the streaming media data sent by the client using the UDP protocol is received.

7. A terminal device, It is characterized in that include: at least one processor and memory; The memory stores a computer program; The at least one processor executes the computer program stored in the memory to implement the method for transmitting streaming media data according to any one of claims 1 to 4.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed, the method for transmitting streaming media data according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Information transmission method and device based on articulated naturality web

    CN110392044A