WO2023071468A1 - Live broadcasting method, content distribution service device, and storage medium - Google Patents

Live broadcasting method, content distribution service device, and storage medium Download PDF

Info

Publication number
WO2023071468A1
WO2023071468A1 PCT/CN2022/114282 CN2022114282W WO2023071468A1 WO 2023071468 A1 WO2023071468 A1 WO 2023071468A1 CN 2022114282 W CN2022114282 W CN 2022114282W WO 2023071468 A1 WO2023071468 A1 WO 2023071468A1
Authority
WO
WIPO (PCT)
Prior art keywords
live
data stream
line process
live broadcast
live data
Prior art date
Application number
PCT/CN2022/114282
Other languages
French (fr)
Chinese (zh)
Inventor
孙俊
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2023071468A1 publication Critical patent/WO2023071468A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/239Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • H04N21/6437Real-time Transport Protocol [RTP]

Definitions

  • the present application relates to the field of live broadcast technology, in particular to a live broadcast method, content distribution service equipment and storage media.
  • Embodiments of the present application provide a live broadcast method, a content distribution service device, and a storage medium.
  • the embodiment of the present application provides a live broadcast method, which is applied to a content distribution service device.
  • the content distribution service device includes a main process, a first-line process, and a second-line process.
  • the method includes: the main process Assigning the first live broadcast request to the first line process, the first live broadcast request representing the first terminal device requesting to obtain the first live data stream; the first line process from the shared Querying the back-to-source status of the first live data stream in the memory data to obtain a query result; when the query result is that the first live data stream has been back-to-source through the second-line process, the The first line process sends the first live broadcast request to the second line process, and the second line process sends the first live data stream to the first terminal device according to the first live broadcast request; If the query result is that the first live data stream does not exist in the shared memory data, the first-line process returns the first live data stream to the live source device according to the first live broadcast request source processing to obtain the first live data stream, and send the first
  • the embodiment of the present application also provides a content distribution service device, including: a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the computer program Realize the live broadcast method as described in the first aspect above.
  • the embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, and the computer-executable instructions are used to execute the foregoing live broadcast method.
  • FIG. 1 is a schematic diagram of a system architecture for performing a live broadcast method provided by an embodiment of the present application
  • Fig. 2 is a flowchart of a live broadcast method provided by an embodiment of the present application
  • Fig. 3 is a flow chart of returning to the source when there is no first live data stream in the live broadcast method provided by an embodiment of the present application;
  • Fig. 4 is a flow chart of returning to the source of the live broadcast request received for the first time in the live broadcast method provided by an embodiment of the present application;
  • Fig. 5 is the flow chart of RTMP format conversion FLV format in the live broadcast method that one embodiment of the present application provides;
  • Fig. 6 is the flowchart of RTMP format conversion TS file format in the live broadcast method that one embodiment of the present application provides;
  • Fig. 7 is a flow chart of aging live data streams in the live broadcast method provided by an embodiment of the present application.
  • the present application provides a live broadcast method, content distribution service equipment and storage medium, wherein the live broadcast method includes: first assigning the first live broadcast request to the first-line process through the main process, and the first live broadcast request represents the first terminal device requesting to obtain The first live data stream, and then the first-line process queries the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, and obtains the query result; the query result shows that the first live data stream has passed the When the second-line process performs back-to-source, the first-line process sends the first live broadcast request to the second-line process, so that the second-line process sends the first live data stream to the first terminal device according to the first live broadcast request.
  • the first-line process by querying the back-to-source status of the first live data stream from the shared memory data, the first-line process sends the first live broadcast request to the The second-line process of source processing sends the first live data stream to the first terminal device through the second-line process, so as to realize the multiplexing of the same first live data, effectively reduce the number of times of live broadcast back to the source, thereby reducing the live broadcast source device station pressure, and can save equipment investment and technical transformation costs.
  • FIG. 1 is a schematic diagram of a system architecture platform for performing a live broadcast method provided by an embodiment of the present application.
  • the system architecture platform 100 includes a live broadcast source device 110, a content distribution service device 120, and a plurality of terminal devices 130.
  • the content distribution service device 120 includes a main process 121 and a plurality of line processes.
  • the main process 121 is used to The received live broadcast request is allocated to the line process for processing, and the line process is used to return the live data stream to the source according to the live broadcast request, and send the live data stream to the terminal device 130 corresponding to the live broadcast request.
  • the multiple line processes may include the first line process 122, the second line process 123, the third line process 124 and the fourth line process 125, or include the first line process 122 and the second line process 123.
  • the number of thread processes is not specifically limited.
  • system architecture platform 100 is applicable to scenarios such as live broadcast room, conference live broadcast, sports event live broadcast, etc., which is not specifically limited in this embodiment.
  • the content distribution service device 120 may also be referred to as a CDN content distribution service system.
  • the CDN content distribution service system can receive live source audio and video data in real time by pulling stream or pushing stream, and then pass real-time message transmission protocol ( Real Time Messaging Protocol, RTMP), HTTP-FLV protocol (HTTP-FLV protocol content is mainly to encapsulate audio and video data into streaming media (FLASH VIDEO, FLV) format, and then pass Hyper Text Transfer Protocol (Hyper Text Transfer Protocol, HTTP) transmitted to the terminal device 130) and the HTTP-based adaptive code rate streaming media transmission protocol (HTTP Live Streaming, HLS) to the received live data stream (comprising live audio and video data and/or live video data) repacking and packaging,
  • RTMP Real Time Messaging Protocol
  • HTTP-FLV protocol content is mainly to encapsulate audio and video data into streaming media (FLASH VIDEO, FLV) format, and then pass Hyper Text Transfer Protocol (Hyper Text Transfer Protocol, HTTP) transmitted to the terminal device 130
  • the terminal equipment 130 may also be called user equipment (user equipment, UE), access terminal, subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device , user terminal, terminal, wireless communication device, user agent or user device.
  • the terminal device 130 in the embodiment of the present application may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with a wireless transceiver function, a virtual reality (virtual reality, VR) terminal device, an augmented reality (augmented reality, AR) Terminal equipment, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, transportation safety Wireless terminals in (transportation safety), wireless terminals in smart cities, wireless terminals in smart homes, etc.
  • VR virtual reality
  • AR augmented reality Terminal equipment
  • system architecture platform 100 can be applied to 2G, 3G, 4G, 5G communication network systems and subsequent evolved mobile communication network systems, etc., which is not specifically limited in this embodiment.
  • FIG. 1 does not constitute a limitation to the embodiment of the present application, and may include more or less components than those shown in the illustration, or combine some components, or have different Part placement.
  • Fig. 2 is a flowchart of a live broadcast method provided by an embodiment of the present application.
  • the live broadcast method is applied to a content distribution service device, and the content distribution service device includes a main process, a first-line process and a second-line process.
  • the live broadcast method includes but not limited to step S100, step S200 and step S300.
  • step S100 the main process assigns a first live broadcast request to a first-line process, where the first live broadcast request indicates that the first terminal device requests to acquire a first live data stream.
  • the main process of the content distribution service device receives the first live broadcast request sent from the first terminal device for requesting to obtain the first live data stream, then the main process can determine to process the first live data stream among multiple thread processes.
  • the line process of the live broadcast request is the first line process, and then the first live broadcast request is assigned to the first line process for processing.
  • the main process is mainly used to allocate the received live broadcast request to the line process for processing.
  • the main process can evenly distribute the live broadcast request to each line process for processing according to the number of live broadcast requests and the number of line processes, or it can also According to the processing capacity of the line process, the live broadcast request is allocated to the target line process for processing. This example does not specifically limit how the main process allocates the live broadcast request to the line process.
  • Step S200 the first-line process inquires the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, and obtains the query result.
  • the first-line process can search the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, so as to obtain the query result.
  • each line process (the first line process or the second line process) returns the live data stream to the source, it will store the live data stream in the memory, and then store the information corresponding to the live data stream and the line process The information updates the shared memory data, so that each thread process can find the back-to-source status of all thread processes from the shared memory data.
  • Step S300 when the query result is that the first live data stream has been returned to the source through the second-line process, the first-line process sends the first live broadcast request to the second-line process, so that the second-line process sends the The first terminal device sends the first live data stream.
  • the first-line process can determine the processing method for the first live broadcast request according to the query result.
  • a live broadcast request is sent to the second-line process, so that the second-line process sends the first live data stream to the first terminal device according to the first live broadcast request, so that the multiplexing of the same first live data can be realized, and the cost of live broadcast back to the source can be effectively reduced The number of times, thereby reducing the pressure on the live broadcast source equipment station, and saving equipment investment and technical transformation costs.
  • the first line process when the multiple line processes include the first line process, the second line process and the third line process, and the query result shows that the first live data stream has been returned to the source through the second line process, the first line process The process receives the first live broadcast request representing the first terminal device’s request to obtain the first live data stream, and the third-line process receives the second live broadcast request representing the second terminal device’s request to obtain the first live data stream, then the first The first-line process can send the first live broadcast request to the second-line process, so that the second-line process can send the first live data stream to the first terminal device according to the first live broadcast request, and the third-line process can send the second live broadcast request to the second-line process process, so that the second-line process sends the first live data stream to the second terminal device according to the second live broadcast request, so that the multiplexing of the same first live data can be realized, effectively reducing the number of times the live broadcast returns to the source, thereby reducing the cost of the live broadcast source device Station pressure, and can save equipment investment
  • the live broadcast method further includes but not limited to the following step S310.
  • Step S310 when the query result is that the first live data stream does not exist in the shared memory data, the first-line process performs back-source processing on the first live data stream to the live source device according to the first live broadcast request, and obtains the first live stream data stream, and send the first live data stream to the first terminal device.
  • the first-line process can perform back-source processing on the first live data stream to the live broadcast source device according to the first live broadcast request, obtain the first live data stream, and send the first live data stream to the first terminal device, At the same time, the first-line process can share the back-to-source status of the first live data stream to the shared memory data, so that other line processes can find the back-to-source status of the first-line process from the shared memory data, thereby achieving simultaneous
  • the multiplexing of the first live broadcast data can effectively reduce the number of times the live broadcast returns to the source, thereby reducing the pressure on the live broadcast source equipment station, and can save equipment investment and technical transformation costs.
  • step S300 before step S300, the following steps S410 and S420 are also included, but not limited.
  • Step S410 the main process assigns the second live broadcast request to the second line process, and the second live broadcast request indicates that the second terminal device requests to obtain the first live data stream;
  • step S420 the second line process performs back-source processing on the first live data stream according to the second live broadcast request, obtains the first live data stream, and sends the first live data stream to the second terminal device.
  • the main process when the main process receives the second live request representing the request of the second terminal device to obtain the first live data stream, the main process can assign the second live request to the second line process, and then the second line process can obtain the first live data stream according to the second
  • the live broadcast request performs back-to-source processing on the first live data stream, obtains the first live data stream, and sends the first live data stream to the second terminal device, and at the same time, the second-line process can share the back-to-source status of the first live data stream to the shared memory data, so that other line processes can search the back-to-source status of the first-line process from the shared memory data, so as to realize the multiplexing of the same first live data and effectively reduce the number of times of live back-to-source, thereby Reduce the pressure on the live broadcast source equipment station, and save equipment investment and technical transformation costs.
  • the main process when the main process receives the second live request representing the request of the second terminal device to obtain the first live data stream, the main process can obtain the load balancing information of all line processes, and then determine the target according to the load balancing information
  • the second-line process is the second-line process, and assigns the second live broadcast request to the second-line process, and then the second-line process can process the first live data stream back to the source according to the second live broadcast request, obtain the first live data stream, and send the second live data stream
  • a live data stream is sent to the second terminal device, and the second-line process can share the return status of the first live data stream to the shared memory data, so that other line processes can find the first-line process from the shared memory data
  • the same first live broadcast data can be reused, effectively reducing the number of live broadcast back-to-source, thereby reducing the pressure on the live broadcast source equipment station, and saving equipment investment and technical transformation costs.
  • step S300 includes but not limited to the following steps S510 , S520 and S530 .
  • Step S510 the first-line process returns to the source device the first live data stream according to the first live broadcast request, and obtains the first live data stream in RTMP format;
  • Step S520 the first-line process performs format conversion processing on the first live data stream in RTMP format to obtain the first live data stream in FLV format;
  • step S530 the first-line process sends the first live data stream in FLV format to the first terminal device through the HTTP protocol.
  • the first terminal device when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in FLV format, since the format of the first live data stream returned from the live source device is in RTMP format, the first The online process needs to perform format conversion processing on the first live data stream in RTMP format to obtain the first live data stream in FLV format, and then send the first live data stream in FLV format to the first terminal device through hypertext transfer HTTP protocol, Thus, the first terminal device can play the audio and video content of the first live data stream.
  • the first-line process after the first-line process obtains the first live data stream in RTMP format, it can perform format conversion processing on the first live data stream in RTMP format to obtain the first live data stream in FLV format, and then first The line process divides the first live data stream in FLV format into chunks according to CHUNK encoding of the HTTP protocol, and sends the first live data stream in FLV format after the chunking processing to the first terminal device, so that the first live data stream in FLV format is processed by chunking.
  • a terminal device can play the audio and video content of the first live data stream.
  • the first terminal device when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in FLV format, since the format of the first live data stream returned from the live source device is in RTMP format, the first The line process can transcode the first live data stream in RTMP format according to the HTTP-FLV protocol and virtualize it into an infinite first live data stream in FLV format, and transmit it through the HTTP protocol.
  • the first terminal device only sends An HTTP GET request, the request carries the live stream name corresponding to the first live data stream to be accessed, the CDN content distribution service system can return an HTTP response, and the response information does not carry the content length of the message body, and directly sends unlimited data to the first terminal device
  • step S300 includes but not limited to the following steps S610 , S620 , S630 and S640 .
  • Step S610 the first-line process returns to the source device the first live data stream according to the first live broadcast request, and obtains the first live data stream in RTMP format;
  • Step S620 slice the first live data stream in RTMP format according to the dynamic code rate adaptive technology HLS protocol, and generate multiple first live data streams in TS file format;
  • Step S630 generating a live mapping list according to a plurality of first live data streams in TS file format
  • Step S640 sending the first live data stream in the TS file format to the first terminal device through the HTTP protocol according to the live mapping list.
  • the The first-line process needs to slice the first live data stream in RTMP format according to the HLS protocol, generate multiple first live data streams in TS file format, and then generate a live map based on the first live data stream in multiple TS file formats list, and then send the first live data stream in TS file format to the first terminal device through the HTTP protocol according to the live mapping list, so that the first terminal device can play the audio and video content of the first live data stream.
  • the first-line process after the first-line process connects back to the source to obtain the first live data stream in RTMP format, it can generate TS slices from the first live data stream in RTMP format according to the HLS protocol, and establish a storage mapping relationship for each TS slice table, generating a live M3U8 list according to the storage mapping table of TS slices, and then sending the first live data stream in TS file format to the first terminal device through the HTTP protocol according to the live M3U8 list, so that the first terminal device can play the first The audio and video content of the live data stream.
  • the live broadcast method further includes but not limited to the following steps S710 , S720 , S730 and S740 .
  • Step S710 the first-line process sets a ring buffer queue for the memory, and the ring buffer queue includes the first frame data and the last frame data;
  • Step S720 determining the second video key frame data according to a plurality of video key frame data
  • Step S730 in the case that the time difference between the time stamp of the last frame data and the time stamp of the second video key frame is greater than the preset buffer time, convert the time stamp between the time stamp of the first frame data and the first time stamp All live data streams in the period of time are subjected to aging processing, wherein the first time stamp is the time stamp obtained by adding the time stamp of the first frame of data to the preset buffer time, and all live data streams include the first live data stream .
  • first the first-line process sets a ring buffer queue in the memory.
  • the number of items in the ring buffer queue can be configured as 2048 items by default, and the buffer time cachetime is preset.
  • Each item of the ring buffer queue stores one frame For audio and video data, the first frame data in the ring queue is set to gop_po, and the last frame data in the ring queue is set to gop_last.
  • the aging The rule can be set as follows: if there is only one video key frame in the ring queue, the live data stream will not be aged.
  • the time stamp of the frame data corresponding to the live data stream actually stored in the ring queue may be greater than the cachetime.
  • the time difference between the time stamp of the frame data corresponding to gop_last minus the time stamp of the second video key frame is greater than cachetime, then the frame data from gop_pos to gop_pos+cachetime ( Including the live data stream) are all aged out, the gos_pos of the ring buffer queue will jump forward every once in a while, and the gop_last will be incremented, and then return to the head of the queue after reaching the end of the queue.
  • the number of items in the ring buffer queue may be set to 2048 items, and may be set to 1024 items, which is not specifically limited in this embodiment.
  • the progress client_pos and gop_pos of the live data stream obtained by the user are basically consistent under normal circumstances, but if due to network, speed limit and other reasons, the live data flow to the first terminal device If the transmission is delayed, client_pos will slowly lag behind gop_pos. When client_pos lags behind gop_pos and reaches cachetime, client_pos of the first terminal device will jump forward cachetime to make client_pos equal to gop_pos.
  • the second terminal device When the second terminal device needs to watch the live data stream of the same channel as the first terminal device, set the client_pos of the second terminal device equal to gop_pos, and then send the live data stream of client_pos+cachetime to the second terminal device, and then the second terminal device
  • the device client_pos will skip cachetime forward so that client_pos is equal to gop_pos. If the configuration item low latency mode is enabled, when the second terminal device client_pos lags behind the latest key frame, it will jump forward to the latest video key frame.
  • an embodiment of the present application also provides a content distribution service device, the content distribution service device includes: a memory, a processor, and a computer program stored in the memory and operable on the processor.
  • the processor and memory can be connected by a bus or other means.
  • memory can be used to store non-transitory software programs and non-transitory computer-executable programs.
  • the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage devices.
  • the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the content distribution service device in this embodiment can be applied, for example, the content distribution service device 120 in the embodiment shown in FIG.
  • these embodiments all belong to the same inventive concept, so these embodiments have the same implementation principle and technical effect, and will not be described in detail here.
  • the non-transitory software programs and instructions required to realize the live broadcast method of the above-mentioned embodiment are stored in the memory, and when executed by the processor, the live broadcast method in the above-mentioned embodiment is executed, for example, the method steps in Fig. 2 described above are executed S100 to S300, method steps S310 in FIG. 3 , method steps S410 to S420 in FIG. 4 , method steps S510 to S530 in FIG. 5 , method steps S610 to S640 in FIG. 6 , method steps S710 to S710 in FIG. 7 S730.
  • an embodiment of the present application also provides a smart panel, which includes: a memory, a processor, and a computer program stored in the memory and operable on the processor.
  • the processor and memory can be connected by a bus or other means.
  • memory can be used to store non-transitory software programs and non-transitory computer-executable programs.
  • the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage devices.
  • the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the communication device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor or a controller, for example, by the above-mentioned Execution by a processor in the embodiment of the communication device can cause the above-mentioned processor to execute the live broadcast method in the above-mentioned embodiment, for example, execute the above-described method steps S100 to S300 in FIG. 2 , method steps S310 in FIG. 3 , and 4, method steps S510 to S530 in FIG. 5, method steps S610 to S640 in FIG. 6, and method steps S710 to S730 in FIG. 7.
  • the first live broadcast request is assigned to the first-line process through the main process.
  • the first live broadcast request indicates that the first terminal device requests to obtain the first live data stream, and then the first-line process obtains the first live data stream according to the first live broadcast request.
  • Query the back-to-source status of the first live data stream in the data and get the query result; if the query result shows that the first live data stream has been back-to-source through the second-line process, the first-line process sends the first live broadcast request to the second-line process, so that the second-line process sends the first live data stream to the first terminal device according to the first live broadcast request.
  • the first-line process by querying the back-to-source status of the first live data stream from the shared memory data, the first-line process sends the first live broadcast request to the The second-line process of source processing sends the first live data stream to the first terminal device through the second-line process, so as to realize the multiplexing of the same first live data, effectively reduce the number of times of live broadcast back to the source, thereby reducing the live broadcast source device station pressure, and can save equipment investment and technical transformation costs.
  • Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tape, magnetic disk storage or other magnetic storage devices, or can Any other medium used to store desired information and which can be accessed by a computer.
  • communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

Disclosed in the present application are a live broadcasting method, a content distribution service device, and a storage medium. The live broadcasting method comprises: firstly, a main process distributing a first live broadcast request to a first thread process, wherein the first live broadcast request represents that a first terminal device requests the acquisition of a first live broadcast data stream; then, the first thread process querying, according to the first live broadcast request, an origin-pull state of the first live broadcast data stream from shared memory data, so as to obtain a query result; and if the query result indicates that the first live broadcast data stream has been subjected to origin-pull by means of a second thread process, the first thread process sending the first live broadcast request to the second thread process, such that the second thread process sends the first live broadcast data stream to the first terminal device according to the first live broadcast request.

Description

直播方法、内容分发服务设备及存储介质Live broadcast method, content distribution service device and storage medium
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202111239620.7,申请日为2021年10月25日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on a Chinese patent application with application number 202111239620.7 and a filing date of October 25, 2021, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated by reference into this application.
技术领域technical field
本申请涉及直播技术领域,尤其是一种直播方法、内容分发服务设备及存储介质。The present application relates to the field of live broadcast technology, in particular to a live broadcast method, content distribution service equipment and storage media.
背景技术Background technique
在互联网发展初期,受限网络宽带影响,网络直播发展比较缓慢,各互联网直播平台支持的协议也较少,直播时延较大,用户体验不友好。而近年来伴随着4G和5G技术的不断发展和普及,令到网络直播行业得到高速的发展,使得直播市场规模和用户规模快速增长,但是也因为用户规模的快速增长,使得互联网直播平台在面对大规模的用户提供直播数据服务时的压力也相应增大,从而出现用户体验不好的问题。In the early days of Internet development, due to the influence of limited network broadband, the development of online live broadcasting was relatively slow, and the protocols supported by Internet live broadcast platforms were also few, the live broadcast delay was large, and the user experience was not friendly. In recent years, with the continuous development and popularization of 4G and 5G technologies, the online live broadcast industry has developed rapidly, resulting in rapid growth in the live broadcast market and user scale. The pressure to provide live broadcast data services to large-scale users also increases accordingly, resulting in the problem of poor user experience.
发明内容Contents of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics described in detail in this article. This summary is not intended to limit the scope of the claims.
本申请实施例提供了一种直播方法、内容分发服务设备及存储介质。Embodiments of the present application provide a live broadcast method, a content distribution service device, and a storage medium.
第一方面,本申请实施例提供了一种直播方法,应用于内容分发服务设备,所述内容分发服务设备包括主进程、第一线进程和第二线进程,所述方法包括:所述主进程将所述第一直播请求分配至所述第一线进程,所述第一直播请求表征第一终端设备请求获取第一直播数据流;所述第一线进程根据所述第一直播请求从共享内存数据中对所述第一直播数据流的回源状态进行查询,得到查询结果;在所述查询结果为所述第一直播数据流已通过所述第二线进程进行回源的情况下,所述第一线进程将所述第一直播请求发送至所述第二线进程,所述第二线进程根据所述第一直播请求向所述第一终端设备发送所述第一直播数据流;在所述查询结果为所述共享内存数据中不存在所述第一直播数据流的情况下,所述第一线进程根据所述第一直播请求向直播源设备对所述第一直播数据流进行回源处理,得到所述第一直播数据流,并将所述第一直播数据流发送至所述第一终端设备。In the first aspect, the embodiment of the present application provides a live broadcast method, which is applied to a content distribution service device. The content distribution service device includes a main process, a first-line process, and a second-line process. The method includes: the main process Assigning the first live broadcast request to the first line process, the first live broadcast request representing the first terminal device requesting to obtain the first live data stream; the first line process from the shared Querying the back-to-source status of the first live data stream in the memory data to obtain a query result; when the query result is that the first live data stream has been back-to-source through the second-line process, the The first line process sends the first live broadcast request to the second line process, and the second line process sends the first live data stream to the first terminal device according to the first live broadcast request; If the query result is that the first live data stream does not exist in the shared memory data, the first-line process returns the first live data stream to the live source device according to the first live broadcast request source processing to obtain the first live data stream, and send the first live data stream to the first terminal device.
第二方面,本申请实施例还提供了一种内容分发服务设备,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上第一方面所述的直播方法。In the second aspect, the embodiment of the present application also provides a content distribution service device, including: a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the computer program Realize the live broadcast method as described in the first aspect above.
第三方面,本申请实施例还提供了一种计算机可读存储介质,存储有计算机可执行指令,计算机可执行指令用于执行如前面的直播方法。In a third aspect, the embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, and the computer-executable instructions are used to execute the foregoing live broadcast method.
本申请的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of the application will be set forth in the description which follows, and, in part, will be obvious from the description, or may be learned by practice of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
附图说明Description of drawings
附图用来提供对本申请技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solution of the present application, and constitute a part of the specification, and are used together with the embodiments of the present application to explain the technical solution of the present application, and do not constitute a limitation to the technical solution of the present application.
图1是本申请一个实施例提供的用于执行直播方法的系统架构的示意图;FIG. 1 is a schematic diagram of a system architecture for performing a live broadcast method provided by an embodiment of the present application;
图2是本申请一个实施例提供的直播方法的流程图;Fig. 2 is a flowchart of a live broadcast method provided by an embodiment of the present application;
图3是本申请一个实施例提供的直播方法中在不存在第一直播数据流的情况下的回源的流程图;Fig. 3 is a flow chart of returning to the source when there is no first live data stream in the live broadcast method provided by an embodiment of the present application;
图4是本申请一个实施例提供的直播方法中第一次接收直播请求的回源的流程图;Fig. 4 is a flow chart of returning to the source of the live broadcast request received for the first time in the live broadcast method provided by an embodiment of the present application;
图5是本申请一个实施例提供的直播方法中RTMP格式转换FLV格式的流程图;Fig. 5 is the flow chart of RTMP format conversion FLV format in the live broadcast method that one embodiment of the present application provides;
图6是本申请一个实施例提供的直播方法中RTMP格式转换TS文件格式的流程图;Fig. 6 is the flowchart of RTMP format conversion TS file format in the live broadcast method that one embodiment of the present application provides;
图7是本申请一个实施例提供的直播方法中老化直播数据流的流程图。Fig. 7 is a flow chart of aging live data streams in the live broadcast method provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, not to limit the present application.
需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于流程图中的顺序执行所示出或描述的步骤。说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than in the flowchart. The terms "first", "second" and the like in the specification and claims and the above drawings are used to distinguish similar objects, and not necessarily used to describe a specific sequence or sequence.
本申请提供了一种直播方法、内容分发服务设备及存储介质,其中,直播方法包括:先通过主进程将第一直播请求分配至第一线进程,第一直播请求表征第一终端设备请求获取第一直播数据流,然后第一线进程根据第一直播请求从共享内存数据中对第一直播数据流的回源状态进行查询,得到查询结果;在查询结果为第一直播数据流已通过第二线进程进行回源的情况下,第一线进程将第一直播请求发送至第二线进程,以使第二线进程根据第一直播请求向第一终端设备发送第一直播数据流。也就是说,本申请实施例通过从共享内存数据中对第一直播数据流的回源状态进行查询,根据查询结果第一线进程将第一直播请求发送至已对第一直播数据流进行回源处理的第二线进程,通过第二线进程向第一终端设备发送第一直播数据流,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。The present application provides a live broadcast method, content distribution service equipment and storage medium, wherein the live broadcast method includes: first assigning the first live broadcast request to the first-line process through the main process, and the first live broadcast request represents the first terminal device requesting to obtain The first live data stream, and then the first-line process queries the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, and obtains the query result; the query result shows that the first live data stream has passed the When the second-line process performs back-to-source, the first-line process sends the first live broadcast request to the second-line process, so that the second-line process sends the first live data stream to the first terminal device according to the first live broadcast request. That is to say, in this embodiment of the present application, by querying the back-to-source status of the first live data stream from the shared memory data, the first-line process sends the first live broadcast request to the The second-line process of source processing sends the first live data stream to the first terminal device through the second-line process, so as to realize the multiplexing of the same first live data, effectively reduce the number of times of live broadcast back to the source, thereby reducing the live broadcast source device station pressure, and can save equipment investment and technical transformation costs.
下面结合附图,对本申请实施例作进一步阐述。The embodiments of the present application will be further described below in conjunction with the accompanying drawings.
如图1所示,图1是本申请一个实施例提供的用于执行的直播方法的系统架构平台的示意图。As shown in FIG. 1 , FIG. 1 is a schematic diagram of a system architecture platform for performing a live broadcast method provided by an embodiment of the present application.
在图1的示例中,该系统架构平台100包括直播源设备110、内容分发服务设备120和多个终端设备130,内容分发服务设备120包括主进程121和多个线进程,主进程121用于将接收到直播请求分配至线进程进行处理,线进程用于根据直播请求对直播数据流进行回源,并将直播数据流发送至直播请求对应的终端设备130。In the example of FIG. 1, the system architecture platform 100 includes a live broadcast source device 110, a content distribution service device 120, and a plurality of terminal devices 130. The content distribution service device 120 includes a main process 121 and a plurality of line processes. The main process 121 is used to The received live broadcast request is allocated to the line process for processing, and the line process is used to return the live data stream to the source according to the live broadcast request, and send the live data stream to the terminal device 130 corresponding to the live broadcast request.
需要说明的是,多个线进程可以包括第一线进程122、第二线进程123、第三线进程124和第四线进程125,或者包括第一线进程122和第二线进程123,本实施例对线进程的数量不 作具体限定。It should be noted that the multiple line processes may include the first line process 122, the second line process 123, the third line process 124 and the fourth line process 125, or include the first line process 122 and the second line process 123. The number of thread processes is not specifically limited.
需要说明的是,系统架构平台100适用于直播间、会议直播、体育赛事直播等场景,本实施例对其不作具体限定。It should be noted that the system architecture platform 100 is applicable to scenarios such as live broadcast room, conference live broadcast, sports event live broadcast, etc., which is not specifically limited in this embodiment.
在一实施例中,内容分发服务设备120,也可以称为CDN内容分发服务系统,CDN内容分发服务系统能够通过拉流或推流方式实时接收直播源音视频数据,然后通过实时消息传输协议(Real Time Messaging Protocol,RTMP)、HTTP-FLV协议(HTTP-FLV协议内容主要是将音视频数据封装成流媒体(FLASH VIDEO,FLV)格式,然后通过超文本传输协议(Hyper Text Transfer Protocol,HTTP)传输至终端设备130)和基于HTTP的自适应码率流媒体传输协议(HTTP Live Streaming,HLS)对接收到的直播数据流(包括直播音视频数据和/或直播视频数据)重新打包与封装,当终端设备130发送RTMP、HTTP-FLV或HLS协议的直播请求时,可以通过负载均衡设备(LVS/SLB)将直播请求调度至CDN内容分发服务器,CDN内容分发服务器会根据接收到的客户端发送的直播协议响应对应直播协议的直播数据流,并向直播请求对应的终端设备130发送,以使终端设备130在接收到直播数据流后能够进行播放。In one embodiment, the content distribution service device 120 may also be referred to as a CDN content distribution service system. The CDN content distribution service system can receive live source audio and video data in real time by pulling stream or pushing stream, and then pass real-time message transmission protocol ( Real Time Messaging Protocol, RTMP), HTTP-FLV protocol (HTTP-FLV protocol content is mainly to encapsulate audio and video data into streaming media (FLASH VIDEO, FLV) format, and then pass Hyper Text Transfer Protocol (Hyper Text Transfer Protocol, HTTP) transmitted to the terminal device 130) and the HTTP-based adaptive code rate streaming media transmission protocol (HTTP Live Streaming, HLS) to the received live data stream (comprising live audio and video data and/or live video data) repacking and packaging, When the terminal device 130 sends a live broadcast request of RTMP, HTTP-FLV or HLS protocol, the live broadcast request can be dispatched to the CDN content distribution server through the load balancing device (LVS/SLB), and the CDN content distribution server will send the request according to the received client The live broadcast protocol responds to the live data stream corresponding to the live broadcast protocol, and sends it to the terminal device 130 corresponding to the live broadcast request, so that the terminal device 130 can play the live data stream after receiving the live data stream.
本领域技术人员可以理解的是,终端设备130,也可以称为用户设备(user equipment,UE)、接入终端、用户单元、用户站、移动站、移动台、远方站、远程终端、移动设备、用户终端、终端、无线通信设备、用户代理或用户装置。本申请的实施例中的终端设备130可以是手机(mobile phone)、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等等。Those skilled in the art can understand that the terminal equipment 130 may also be called user equipment (user equipment, UE), access terminal, subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device , user terminal, terminal, wireless communication device, user agent or user device. The terminal device 130 in the embodiment of the present application may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with a wireless transceiver function, a virtual reality (virtual reality, VR) terminal device, an augmented reality (augmented reality, AR) Terminal equipment, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, transportation safety Wireless terminals in (transportation safety), wireless terminals in smart cities, wireless terminals in smart homes, etc.
本领域技术人员可以理解的是,该系统架构平台100可以应用于2G、3G、4G、5G通信网络系统以及后续演进的移动通信网络系统等,本实施例对此并不作具体限定。Those skilled in the art can understand that the system architecture platform 100 can be applied to 2G, 3G, 4G, 5G communication network systems and subsequent evolved mobile communication network systems, etc., which is not specifically limited in this embodiment.
本领域技术人员可以理解的是,图1中示出的系统架构平台并不构成对本申请实施例的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the system architecture platform shown in FIG. 1 does not constitute a limitation to the embodiment of the present application, and may include more or less components than those shown in the illustration, or combine some components, or have different Part placement.
基于上述系统架构平台,下面提出本申请的直播方法的各个实施例。Based on the above-mentioned system architecture platform, various embodiments of the live broadcast method of the present application are proposed below.
如图2所示,图2是本申请一个实施例提供的直播方法的流程图,该直播方法应用于内容分发服务设备,内容分发服务设备包括主进程、第一线进程和第二线进程。该直播方法包括但不限于有步骤S100、步骤S200以及步骤S300。As shown in Fig. 2, Fig. 2 is a flowchart of a live broadcast method provided by an embodiment of the present application. The live broadcast method is applied to a content distribution service device, and the content distribution service device includes a main process, a first-line process and a second-line process. The live broadcast method includes but not limited to step S100, step S200 and step S300.
步骤S100,主进程将第一直播请求分配至第一线进程,第一直播请求表征第一终端设备请求获取第一直播数据流。In step S100, the main process assigns a first live broadcast request to a first-line process, where the first live broadcast request indicates that the first terminal device requests to acquire a first live data stream.
具体地,当内容分发服务设备的主进程接收到来自第一终端设备所发送的用于请求获取第一直播数据流的第一直播请求,然后主进程可以在多个线进程中确定处理第一直播请求的线进程为第一线进程,再将第一直播请求分配至第一线进程进行处理。Specifically, when the main process of the content distribution service device receives the first live broadcast request sent from the first terminal device for requesting to obtain the first live data stream, then the main process can determine to process the first live data stream among multiple thread processes. The line process of the live broadcast request is the first line process, and then the first live broadcast request is assigned to the first line process for processing.
需要说明的是,主进程主要用于将接收到直播请求分配至线进程进行处理,主进程可以根据直播请求的数量以及线进程的数量将直播请求平均分配至各个线进程进行处理,或者也可以根据线进程的处理能力将直播请求分配至目标线进程进行处理,本实例对主进程如何分配直播请求至线进程不作具体限定。It should be noted that the main process is mainly used to allocate the received live broadcast request to the line process for processing. The main process can evenly distribute the live broadcast request to each line process for processing according to the number of live broadcast requests and the number of line processes, or it can also According to the processing capacity of the line process, the live broadcast request is allocated to the target line process for processing. This example does not specifically limit how the main process allocates the live broadcast request to the line process.
步骤S200,第一线进程根据第一直播请求从共享内存数据中对第一直播数据流的回源状 态进行查询,得到查询结果。Step S200, the first-line process inquires the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, and obtains the query result.
具体地,第一线进程可以根据第一直播请求从共享内存数据中查找第一直播数据流的回源状态,从而可以得到查询结果。Specifically, the first-line process can search the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, so as to obtain the query result.
可以理解的是,每个线进程(第一线进程或者第二线进程)对直播数据流进行回源处理后,会将直播数据流存储在内存中,然后将直播数据流对应的信息以及线进程信息更新共享内存数据,从而使得每个线进程能够从共享内存数据中查找所有线进程的回源状态。It is understandable that after each line process (the first line process or the second line process) returns the live data stream to the source, it will store the live data stream in the memory, and then store the information corresponding to the live data stream and the line process The information updates the shared memory data, so that each thread process can find the back-to-source status of all thread processes from the shared memory data.
步骤S300,在查询结果为第一直播数据流已通过第二线进程进行回源的情况下,第一线进程将第一直播请求发送至第二线进程,以使第二线进程根据第一直播请求向第一终端设备发送第一直播数据流。Step S300, when the query result is that the first live data stream has been returned to the source through the second-line process, the first-line process sends the first live broadcast request to the second-line process, so that the second-line process sends the The first terminal device sends the first live data stream.
具体地,第一线进程可以根据查询结果情况确定对第一直播请求的处理方法,在查询结果为第一直播数据流已通过第二线进程进行回源的情况下,第一线进程可以将第一直播请求发送至第二线进程,以使第二线进程根据第一直播请求向第一终端设备发送第一直播数据流,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。Specifically, the first-line process can determine the processing method for the first live broadcast request according to the query result. A live broadcast request is sent to the second-line process, so that the second-line process sends the first live data stream to the first terminal device according to the first live broadcast request, so that the multiplexing of the same first live data can be realized, and the cost of live broadcast back to the source can be effectively reduced The number of times, thereby reducing the pressure on the live broadcast source equipment station, and saving equipment investment and technical transformation costs.
在一实施例中,当多个线进程包括第一线进程、第二线进程和第三线进程,且在查询结果为第一直播数据流已通过第二线进程进行回源的情况下,第一线进程接收到用于表征第一终端设备请求获取第一直播数据流的第一直播请求,第三线进程接收到用于表征第二终端设备请求获取第一直播数据流的第二直播请求,那么第一线进程可以将第一直播请求发送至第二线进程,以使第二线进程根据第一直播请求向第一终端设备发送第一直播数据流,第三线进程可以将第二直播请求发送至第二线进程,以使第二线进程根据第二直播请求向第二终端设备发送第一直播数据流,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。In one embodiment, when the multiple line processes include the first line process, the second line process and the third line process, and the query result shows that the first live data stream has been returned to the source through the second line process, the first line process The process receives the first live broadcast request representing the first terminal device’s request to obtain the first live data stream, and the third-line process receives the second live broadcast request representing the second terminal device’s request to obtain the first live data stream, then the first The first-line process can send the first live broadcast request to the second-line process, so that the second-line process can send the first live data stream to the first terminal device according to the first live broadcast request, and the third-line process can send the second live broadcast request to the second-line process process, so that the second-line process sends the first live data stream to the second terminal device according to the second live broadcast request, so that the multiplexing of the same first live data can be realized, effectively reducing the number of times the live broadcast returns to the source, thereby reducing the cost of the live broadcast source device Station pressure, and can save equipment investment and technical transformation costs.
在一些实施例中,如图3所示,直播方法还包括但不限于以下步骤S310。In some embodiments, as shown in FIG. 3 , the live broadcast method further includes but not limited to the following step S310.
步骤S310,在查询结果为共享内存数据中不存在第一直播数据流的情况下,第一线进程根据第一直播请求向直播源设备对第一直播数据流进行回源处理,得到第一直播数据流,并将第一直播数据流发送至第一终端设备。Step S310, when the query result is that the first live data stream does not exist in the shared memory data, the first-line process performs back-source processing on the first live data stream to the live source device according to the first live broadcast request, and obtains the first live stream data stream, and send the first live data stream to the first terminal device.
具体地,在查询结果为共享内存数据中不存在第一直播数据流的情况下,即可以理解为没有任何线进程对第一直播数据流进行回源,或者第一直播数据流已经在内存中被老化,那么第一线进程可以根据第一直播请求向直播源设备对第一直播数据流进行回源处理,得到第一直播数据流,并将第一直播数据流发送至第一终端设备,同时,第一线进程可以将第一直播数据流的回源情况共享至共享内存数据中,以使其他线进程可以在从共享内存数据中查找第一线进程的回源状态,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。Specifically, when the query result is that the first live data stream does not exist in the shared memory data, it can be understood that there is no line process back to the source of the first live data stream, or the first live data stream is already in the memory is aged out, then the first-line process can perform back-source processing on the first live data stream to the live broadcast source device according to the first live broadcast request, obtain the first live data stream, and send the first live data stream to the first terminal device, At the same time, the first-line process can share the back-to-source status of the first live data stream to the shared memory data, so that other line processes can find the back-to-source status of the first-line process from the shared memory data, thereby achieving simultaneous The multiplexing of the first live broadcast data can effectively reduce the number of times the live broadcast returns to the source, thereby reducing the pressure on the live broadcast source equipment station, and can save equipment investment and technical transformation costs.
在一写实施例中,如图4所示,步骤S300之前还包括但不限于以下步骤S410和步骤S420。In an embodiment, as shown in FIG. 4 , before step S300, the following steps S410 and S420 are also included, but not limited.
步骤S410,主进程将第二直播请求分配至第二线进程,第二直播请求表征第二终端设备请求获取第一直播数据流;Step S410, the main process assigns the second live broadcast request to the second line process, and the second live broadcast request indicates that the second terminal device requests to obtain the first live data stream;
步骤S420,第二线进程根据第二直播请求对第一直播数据流进行回源处理,得到第一直播数据流,并将第一直播数据流发送至第二终端设备。In step S420, the second line process performs back-source processing on the first live data stream according to the second live broadcast request, obtains the first live data stream, and sends the first live data stream to the second terminal device.
具体地,当主进程接收到用于表征第二终端设备请求获取第一直播数据流的第二直播请 求时,主进程可以将第二直播请求分配至第二线进程,然后第二线进程可以根据第二直播请求对第一直播数据流进行回源处理,得到第一直播数据流,并将第一直播数据流发送至第二终端设备,同时第二线进程可以将第一直播数据流的回源情况共享至共享内存数据中,以使其他线进程可以在从共享内存数据中查找第一线进程的回源状态,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。Specifically, when the main process receives the second live request representing the request of the second terminal device to obtain the first live data stream, the main process can assign the second live request to the second line process, and then the second line process can obtain the first live data stream according to the second The live broadcast request performs back-to-source processing on the first live data stream, obtains the first live data stream, and sends the first live data stream to the second terminal device, and at the same time, the second-line process can share the back-to-source status of the first live data stream to the shared memory data, so that other line processes can search the back-to-source status of the first-line process from the shared memory data, so as to realize the multiplexing of the same first live data and effectively reduce the number of times of live back-to-source, thereby Reduce the pressure on the live broadcast source equipment station, and save equipment investment and technical transformation costs.
在一实施例中,当主进程接收到用于表征第二终端设备请求获取第一直播数据流的第二直播请求时,主进程可以获取所有线进程的负载均衡信息,然后根据负载均衡信息确定目标线进程为第二线进程,并将第二直播请求分配至第二线进程,然后第二线进程可以根据第二直播请求对第一直播数据流进行回源处理,得到第一直播数据流,并将第一直播数据流发送至第二终端设备,同时第二线进程可以将第一直播数据流的回源情况共享至共享内存数据中,以使其他线进程可以在从共享内存数据中查找第一线进程的回源状态,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。In an embodiment, when the main process receives the second live request representing the request of the second terminal device to obtain the first live data stream, the main process can obtain the load balancing information of all line processes, and then determine the target according to the load balancing information The second-line process is the second-line process, and assigns the second live broadcast request to the second-line process, and then the second-line process can process the first live data stream back to the source according to the second live broadcast request, obtain the first live data stream, and send the second live data stream A live data stream is sent to the second terminal device, and the second-line process can share the return status of the first live data stream to the shared memory data, so that other line processes can find the first-line process from the shared memory data In this way, the same first live broadcast data can be reused, effectively reducing the number of live broadcast back-to-source, thereby reducing the pressure on the live broadcast source equipment station, and saving equipment investment and technical transformation costs.
在一实施例中,如图5所示,步骤S300包括但不限于以下步骤S510、步骤S520和步骤S530。In an embodiment, as shown in FIG. 5 , step S300 includes but not limited to the following steps S510 , S520 and S530 .
步骤S510,第一线进程根据第一直播请求向直播源设备对第一直播数据流进行回源处理,得到RTMP格式的第一直播数据流;Step S510, the first-line process returns to the source device the first live data stream according to the first live broadcast request, and obtains the first live data stream in RTMP format;
步骤S520,第一线进程将RTMP格式的第一直播数据流进行格式转换处理,得到FLV格式的第一直播数据流;Step S520, the first-line process performs format conversion processing on the first live data stream in RTMP format to obtain the first live data stream in FLV format;
步骤S530,第一线进程将FLV格式的第一直播数据流通过超文本传输HTTP协议发送至第一终端设备。In step S530, the first-line process sends the first live data stream in FLV format to the first terminal device through the HTTP protocol.
在一实施例中,当第一终端设备表征第一终端设备需要获取FLV格式的第一直播数据流,由于从直播源设备所回源的第一直播数据流的格式为RTMP格式,所以第一线进程需要将RTMP格式的第一直播数据流进行格式转换处理,得到FLV格式的第一直播数据流,然后通过超文本传输HTTP协议将FLV格式的第一直播数据流发送至第一终端设备,从而使得第一终端设备能够播放第一直播数据流的音视频内容。In an embodiment, when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in FLV format, since the format of the first live data stream returned from the live source device is in RTMP format, the first The online process needs to perform format conversion processing on the first live data stream in RTMP format to obtain the first live data stream in FLV format, and then send the first live data stream in FLV format to the first terminal device through hypertext transfer HTTP protocol, Thus, the first terminal device can play the audio and video content of the first live data stream.
在一实施例中,第一线进程在获取RTMP格式的第一直播数据流之后,可以对RTMP格式的第一直播数据流进行格式转换处理,得到FLV格式的第一直播数据流,然后第一线进程根据HTTP协议的分块传输CHUNK编码将FLV格式的第一直播数据流进行分块处理,并将分块处理后的FLV格式的第一直播数据流发送至第一终端设备,从而使得第一终端设备能够播放第一直播数据流的音视频内容。In an embodiment, after the first-line process obtains the first live data stream in RTMP format, it can perform format conversion processing on the first live data stream in RTMP format to obtain the first live data stream in FLV format, and then first The line process divides the first live data stream in FLV format into chunks according to CHUNK encoding of the HTTP protocol, and sends the first live data stream in FLV format after the chunking processing to the first terminal device, so that the first live data stream in FLV format is processed by chunking. A terminal device can play the audio and video content of the first live data stream.
在一实施例中,当第一终端设备表征第一终端设备需要获取FLV格式的第一直播数据流,由于从直播源设备所回源的第一直播数据流的格式为RTMP格式,所以第一线进程可以按HTTP-FLV协议将RTMP格式的第一直播数据流进行转码处理并虚拟成为一个无限大的FLV格式的第一直播数据流,并通过HTTP协议进行传输,第一终端设备仅发送一次HTTP GET请求,请求中携带需要访问的第一直播数据流对应的直播流名,CDN内容分发服务系统能够返回HTTP响应,响应信息中不携带消息体内容长度,直接向第一终端设备发送无限长FLV文件内容,或者使用HTTP CHUNK模式将无限长FLV文件按分段模式向第一终端设备进行发送,从而 使得第一终端设备能够播放第一直播数据流的音视频内容。In an embodiment, when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in FLV format, since the format of the first live data stream returned from the live source device is in RTMP format, the first The line process can transcode the first live data stream in RTMP format according to the HTTP-FLV protocol and virtualize it into an infinite first live data stream in FLV format, and transmit it through the HTTP protocol. The first terminal device only sends An HTTP GET request, the request carries the live stream name corresponding to the first live data stream to be accessed, the CDN content distribution service system can return an HTTP response, and the response information does not carry the content length of the message body, and directly sends unlimited data to the first terminal device The content of the long FLV file, or use the HTTP CHUNK mode to send the infinitely long FLV file to the first terminal device in segmented mode, so that the first terminal device can play the audio and video content of the first live data stream.
在一实施例中,如图6所示,步骤S300包括但不限于以下步骤S610、步骤S620、步骤S630和步骤S640。In one embodiment, as shown in FIG. 6 , step S300 includes but not limited to the following steps S610 , S620 , S630 and S640 .
步骤S610,第一线进程根据第一直播请求向直播源设备对第一直播数据流进行回源处理,得到实时消息传输协议RTMP格式的第一直播数据流;Step S610, the first-line process returns to the source device the first live data stream according to the first live broadcast request, and obtains the first live data stream in RTMP format;
步骤S620,根据动态码率自适应技术HLS协议将RTMP格式的第一直播数据流进行切片处理,生成多个TS文件格式的第一直播数据流;Step S620, slice the first live data stream in RTMP format according to the dynamic code rate adaptive technology HLS protocol, and generate multiple first live data streams in TS file format;
步骤S630,根据多个TS文件格式的第一直播数据流生成直播映射列表;Step S630, generating a live mapping list according to a plurality of first live data streams in TS file format;
步骤S640,根据直播映射列表将TS文件格式的第一直播数据流通过HTTP协议发送至第一终端设备。Step S640, sending the first live data stream in the TS file format to the first terminal device through the HTTP protocol according to the live mapping list.
在一实施例中,当第一终端设备表征第一终端设备需要获取传输TS文件格式的第一直播数据流,由于从直播源设备所回源的第一直播数据流的格式为RTMP格式,所以第一线进程需要根据HLS协议将RTMP格式的第一直播数据流进行切片处理,生成多个TS文件格式的第一直播数据流,然后根据多个TS文件格式的第一直播数据流生成直播映射列表,再根据直播映射列表将TS文件格式的第一直播数据流通过HTTP协议发送至第一终端设备,从而使得第一终端设备能够播放第一直播数据流的音视频内容。In one embodiment, when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in TS file format, since the format of the first live data stream returned from the live source device is in RTMP format, the The first-line process needs to slice the first live data stream in RTMP format according to the HLS protocol, generate multiple first live data streams in TS file format, and then generate a live map based on the first live data stream in multiple TS file formats list, and then send the first live data stream in TS file format to the first terminal device through the HTTP protocol according to the live mapping list, so that the first terminal device can play the audio and video content of the first live data stream.
在一实施例中,第一线进程接回源得到RTMP格式的第一直播数据流后,可以按HLS协议将RTMP协议的第一直播数据流生成TS切片,为每个TS切片建立存储映射关系表,根据TS切片的存储映射关系表生成直播M3U8列表,然后根据直播M3U8列表将TS文件格式的第一直播数据流通过HTTP协议发送至第一终端设备,从而使得第一终端设备能够播放第一直播数据流的音视频内容。In one embodiment, after the first-line process connects back to the source to obtain the first live data stream in RTMP format, it can generate TS slices from the first live data stream in RTMP format according to the HLS protocol, and establish a storage mapping relationship for each TS slice table, generating a live M3U8 list according to the storage mapping table of TS slices, and then sending the first live data stream in TS file format to the first terminal device through the HTTP protocol according to the live M3U8 list, so that the first terminal device can play the first The audio and video content of the live data stream.
在一实施例中,如图7所示,直播方法还包括但不限于以下步骤S710、步骤S720、步骤S730和步骤S740。In one embodiment, as shown in FIG. 7 , the live broadcast method further includes but not limited to the following steps S710 , S720 , S730 and S740 .
步骤S710,第一线进程对内存设置环形缓冲队列,环形缓冲队列包括第一帧数据和最后一帧数据;Step S710, the first-line process sets a ring buffer queue for the memory, and the ring buffer queue includes the first frame data and the last frame data;
步骤S720,根据多个视频关键帧数据确定第二个视频关键帧数据;Step S720, determining the second video key frame data according to a plurality of video key frame data;
步骤S730,在最后一帧数据的时间戳和第二个视频关键帧的时间戳的时间差值大于预设的缓冲时间的情况下,将第一帧数据的时间戳和第一时间戳之间的时间段中的所有直播数据流进行老化处理,其中,第一时间戳为第一帧数据的时间戳加上预设的缓冲时间所得到的时间戳,所有直播数据流包括第一直播数据流。Step S730, in the case that the time difference between the time stamp of the last frame data and the time stamp of the second video key frame is greater than the preset buffer time, convert the time stamp between the time stamp of the first frame data and the first time stamp All live data streams in the period of time are subjected to aging processing, wherein the first time stamp is the time stamp obtained by adding the time stamp of the first frame of data to the preset buffer time, and all live data streams include the first live data stream .
在一实施例中,首先第一线进程在内存中设置环形缓冲队列,例如环形缓冲队列的项数量可以默认配置是2048项,并预设置缓冲时间cachetime,环形缓冲队列的每一项存放一帧音视频数据,环形队列中第一帧数据设置为gop_po,环形队列中最后一帧数据设置为gop_last,当环形缓冲队列中所存放的直播数据流对应的帧数据的时间戳超过cachetime后,老化的规则可以设定为:若环形队列中只有一个视频关键帧,则不对直播数据流进行老化处理,此时则有可能出现环形队列中实际存放的直播数据流对应的帧数据的时间戳大于cachetime,当来了第二个关键帧后,gop_last对应的帧数据的时间戳减去第二个视频关键帧的时间戳的时间差大于cachetime后,则把从gop_pos开始到gop_pos+cachetime之间的帧数据(包括直播数据流)全部老化掉,环形缓冲队列的gos_pos是隔一段时间会向前跳, 而gop_last则是递增,到队列尾后再回到队列头。In one embodiment, first the first-line process sets a ring buffer queue in the memory. For example, the number of items in the ring buffer queue can be configured as 2048 items by default, and the buffer time cachetime is preset. Each item of the ring buffer queue stores one frame For audio and video data, the first frame data in the ring queue is set to gop_po, and the last frame data in the ring queue is set to gop_last. When the timestamp of the frame data corresponding to the live data stream stored in the ring buffer queue exceeds the cachetime, the aging The rule can be set as follows: if there is only one video key frame in the ring queue, the live data stream will not be aged. At this time, the time stamp of the frame data corresponding to the live data stream actually stored in the ring queue may be greater than the cachetime. When the second key frame comes, the time difference between the time stamp of the frame data corresponding to gop_last minus the time stamp of the second video key frame is greater than cachetime, then the frame data from gop_pos to gop_pos+cachetime ( Including the live data stream) are all aged out, the gos_pos of the ring buffer queue will jump forward every once in a while, and the gop_last will be incremented, and then return to the head of the queue after reaching the end of the queue.
需要说明的是,环形缓冲队列的项数量可以设置为2048项,可以设置为1024项,本实施例对其不作具体限定。It should be noted that the number of items in the ring buffer queue may be set to 2048 items, and may be set to 1024 items, which is not specifically limited in this embodiment.
可以理解的是,第一终端设备触发频道回源,正常情况下用户的获取的直播数据流的进度client_pos和gop_pos基本保持一致,但是如果由于网络、限速等原因,直播数据流向第一终端设备发送延时,则client_pos会慢慢落后于gop_pos,当client_pos落后gop_pos达到cachetime后,则第一终端设备的client_pos会向前跳cachetime,以使client_pos等于gop_pos。It is understandable that when the first terminal device triggers channel back-to-source, the progress client_pos and gop_pos of the live data stream obtained by the user are basically consistent under normal circumstances, but if due to network, speed limit and other reasons, the live data flow to the first terminal device If the transmission is delayed, client_pos will slowly lag behind gop_pos. When client_pos lags behind gop_pos and reaches cachetime, client_pos of the first terminal device will jump forward cachetime to make client_pos equal to gop_pos.
第二终端设备需要观看与第一终端设备相同频道的直播数据流时,则设置第二终端设备的client_pos等于gop_pos,然后把client_pos+cachetime的直播数据流发送给第二终端设备,然后第二终端设备client_pos会向前跳cachetime,以使client_pos等于gop_pos,如果配置项低延迟lowlatency模式开启,当第二终端设备client_pos落后于最近的关键帧时,则会向前跳到最新的视频关键帧。When the second terminal device needs to watch the live data stream of the same channel as the first terminal device, set the client_pos of the second terminal device equal to gop_pos, and then send the live data stream of client_pos+cachetime to the second terminal device, and then the second terminal device The device client_pos will skip cachetime forward so that client_pos is equal to gop_pos. If the configuration item low latency mode is enabled, when the second terminal device client_pos lags behind the latest key frame, it will jump forward to the latest video key frame.
需要说明的是,上述内容分发服务设备侧的直播方法的实施例均属于相同的发明构思,因此这些实施例具有相同的实现原理以及技术效果,此处不再详述。It should be noted that the above-mentioned embodiments of the live broadcast method on the content distribution service device side all belong to the same inventive concept, so these embodiments have the same implementation principle and technical effect, and will not be described in detail here.
另外,本申请的一个实施例还提供了一种内容分发服务设备,该内容分发服务设备包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序。In addition, an embodiment of the present application also provides a content distribution service device, the content distribution service device includes: a memory, a processor, and a computer program stored in the memory and operable on the processor.
处理器和存储器可以通过总线或者其他方式连接。The processor and memory can be connected by a bus or other means.
存储器作为一种非暂态计算机可读存储介质,可用于存储非暂态软件程序以及非暂态性计算机可执行程序。此外,存储器可以包括高速随机存取存储器,还可以包括非暂态存储器,例如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施方式中,存储器可选包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至该处理器。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。As a non-transitory computer-readable storage medium, memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
需要说明的是,本实施例中的内容分发服务设备,可以应用为例如图1所示实施例中的内容分发服务设备120,本实施例中的内容分发服务设备能够构成例如图1所示实施例中的系统架构的一部分,这些实施例均属于相同的发明构思,因此这些实施例具有相同的实现原理以及技术效果,此处不再详述。It should be noted that the content distribution service device in this embodiment can be applied, for example, the content distribution service device 120 in the embodiment shown in FIG. These embodiments all belong to the same inventive concept, so these embodiments have the same implementation principle and technical effect, and will not be described in detail here.
实现上述实施例的直播方法所需的非暂态软件程序以及指令存储在存储器中,当被处理器执行时,执行上述实施例中的直播方法,例如,执行以上描述的图2中的方法步骤S100至S300、图3中的方法步骤S310、图4中的方法步骤S410至S420、图5中的方法步骤S510至S530、图6中的方法步骤S610至S640、图7中的方法步骤S710至S730。The non-transitory software programs and instructions required to realize the live broadcast method of the above-mentioned embodiment are stored in the memory, and when executed by the processor, the live broadcast method in the above-mentioned embodiment is executed, for example, the method steps in Fig. 2 described above are executed S100 to S300, method steps S310 in FIG. 3 , method steps S410 to S420 in FIG. 4 , method steps S510 to S530 in FIG. 5 , method steps S610 to S640 in FIG. 6 , method steps S710 to S710 in FIG. 7 S730.
另外,本申请的一个实施例还提供了一种智能面板,该智能面板包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序。In addition, an embodiment of the present application also provides a smart panel, which includes: a memory, a processor, and a computer program stored in the memory and operable on the processor.
处理器和存储器可以通过总线或者其他方式连接。The processor and memory can be connected by a bus or other means.
存储器作为一种非暂态计算机可读存储介质,可用于存储非暂态软件程序以及非暂态性计算机可执行程序。此外,存储器可以包括高速随机存取存储器,还可以包括非暂态存储器,例如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施方式中,存储器可选包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至该处理器。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。As a non-transitory computer-readable storage medium, memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
以上所描述的通信设备实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The communication device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
此外,本申请的一个实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被一个处理器或控制器执行,例如,被上述通信设备实施例中的一个处理器执行,可使得上述处理器执行上述实施例中的直播方法,例如,执行以上描述的图2中的方法步骤S100至S300、图3中的方法步骤S310、图4中的方法步骤S410至S420、图5中的方法步骤S510至S530、图6中的方法步骤S610至S640、图7中的方法步骤S710至S730。In addition, an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor or a controller, for example, by the above-mentioned Execution by a processor in the embodiment of the communication device can cause the above-mentioned processor to execute the live broadcast method in the above-mentioned embodiment, for example, execute the above-described method steps S100 to S300 in FIG. 2 , method steps S310 in FIG. 3 , and 4, method steps S510 to S530 in FIG. 5, method steps S610 to S640 in FIG. 6, and method steps S710 to S730 in FIG. 7.
本申请实施例先通过主进程将第一直播请求分配至第一线进程,第一直播请求表征第一终端设备请求获取第一直播数据流,然后第一线进程根据第一直播请求从共享内存数据中对第一直播数据流的回源状态进行查询,得到查询结果;在查询结果为第一直播数据流已通过第二线进程进行回源的情况下,第一线进程将第一直播请求发送至第二线进程,以使第二线进程根据第一直播请求向第一终端设备发送第一直播数据流。也就是说,本申请实施例通过从共享内存数据中对第一直播数据流的回源状态进行查询,根据查询结果第一线进程将第一直播请求发送至已对第一直播数据流进行回源处理的第二线进程,通过第二线进程向第一终端设备发送第一直播数据流,从而可以实现同一个第一直播数据的复用,有效减少直播回源的次数,从而降低直播源设备站的压力,并能够节省设备投入和技术改造成本。In this embodiment of the present application, the first live broadcast request is assigned to the first-line process through the main process. The first live broadcast request indicates that the first terminal device requests to obtain the first live data stream, and then the first-line process obtains the first live data stream according to the first live broadcast request. Query the back-to-source status of the first live data stream in the data, and get the query result; if the query result shows that the first live data stream has been back-to-source through the second-line process, the first-line process sends the first live broadcast request to the second-line process, so that the second-line process sends the first live data stream to the first terminal device according to the first live broadcast request. That is to say, in this embodiment of the present application, by querying the back-to-source status of the first live data stream from the shared memory data, the first-line process sends the first live broadcast request to the The second-line process of source processing sends the first live data stream to the first terminal device through the second-line process, so as to realize the multiplexing of the same first live data, effectively reduce the number of times of live broadcast back to the source, thereby reducing the live broadcast source device station pressure, and can save equipment investment and technical transformation costs.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统可以被实施为软件、固件、硬件及其适当的组合。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those skilled in the art can understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware and an appropriate combination thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit . Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As known to those of ordinary skill in the art, the term computer storage media includes both volatile and nonvolatile media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules, or other data. permanent, removable and non-removable media. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tape, magnetic disk storage or other magnetic storage devices, or can Any other medium used to store desired information and which can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .
以上是对本申请的一些实施进行了具体说明,但本申请并不局限于上述实施方式,熟悉本领域的技术人员在不违背本申请精神的前提下还可作出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。The above is a specific description of some implementations of the present application, but the present application is not limited to the above-mentioned embodiments. Those skilled in the art can also make various equivalent deformations or replacements without violating the spirit of the present application. Any modification or substitution is included within the scope defined by the claims of the present application.

Claims (10)

  1. 一种直播方法,应用于内容分发服务设备,所述内容分发服务设备包括主进程、第一线进程和第二线进程,所述方法包括:A live broadcast method applied to a content distribution service device, the content distribution service device includes a main process, a first-line process and a second-line process, and the method includes:
    所述主进程将第一直播请求分配至所述第一线进程,所述第一直播请求表征第一终端设备请求获取第一直播数据流;The main process assigns a first live broadcast request to the first line process, and the first live broadcast request indicates that the first terminal device requests to obtain the first live data stream;
    所述第一线进程根据所述第一直播请求从共享内存数据中对所述第一直播数据流的回源状态进行查询,得到查询结果;The first-line process queries the back-to-source status of the first live data stream from the shared memory data according to the first live broadcast request, and obtains a query result;
    在所述查询结果为所述第一直播数据流已通过所述第二线进程进行回源的情况下,所述第一线进程将所述第一直播请求发送至所述第二线进程,以使所述第二线进程根据所述第一直播请求向所述第一终端设备发送所述第一直播数据流。When the query result is that the first live data stream has been returned to the source through the second line process, the first line process sends the first live broadcast request to the second line process, so that The second line process sends the first live data stream to the first terminal device according to the first live broadcast request.
  2. 根据权利要求1所述的直播方法,其中,所述方法还包括:The live broadcast method according to claim 1, wherein the method further comprises:
    在所述查询结果为所述共享内存数据中不存在所述第一直播数据流的情况下,所述第一线进程根据所述第一直播请求向直播源设备对所述第一直播数据流进行回源处理,得到所述第一直播数据流,并将所述第一直播数据流发送至所述第一终端设备。When the query result is that the first live data stream does not exist in the shared memory data, the first-line process requests the live source device for the first live data stream according to the first live broadcast request Perform back-to-source processing to obtain the first live data stream, and send the first live data stream to the first terminal device.
  3. 根据权利要求1所述的直播方法,其中,所述在所述查询结果为所述第一直播数据流已通过所述第二线进程进行回源的情况下,所述第一线进程将所述第一直播请求发送至所述第二线进程,所述第二线进程根据所述第一直播请求向所述第一终端设备发送所述第一直播数据流之前,所述方法还包括:The live broadcast method according to claim 1, wherein, when the query result is that the first live data stream has been returned to the source through the second line process, the first line process sends the The first live broadcast request is sent to the second line process, and before the second line process sends the first live data stream to the first terminal device according to the first live broadcast request, the method further includes:
    所述主进程将所述第二直播请求分配至所述第二线进程,所述第二直播请求表征第二终端设备请求获取所述第一直播数据流;The main process assigns the second live broadcast request to the second line process, and the second live broadcast request indicates that the second terminal device requests to obtain the first live data stream;
    所述第二线进程根据所述第二直播请求对所述第一直播数据流进行回源处理,得到所述第一直播数据流,并将所述第一直播数据流发送至所述第二终端设备。The second line process performs back-source processing on the first live data stream according to the second live broadcast request, obtains the first live data stream, and sends the first live data stream to the second terminal equipment.
  4. 根据权利要求1所述的直播方法,其中,所述主进程将所述第一直播请求分配至所述第一线进程,包括:The live broadcast method according to claim 1, wherein the main process assigns the first live broadcast request to the first-line process, comprising:
    所述主进程获取线进程的负载均衡信息;The main process obtains the load balancing information of the line process;
    所述主进程根据所述负载均衡信息将所述第一直播请求分配至所述第一线进程。The main process distributes the first live broadcast request to the first-line process according to the load balancing information.
  5. 根据权利要求1至4任意一项所述的直播方法,其中,当所述第一终端设备表征所述第一终端设备需要获取FLV格式的第一直播数据流,所述第一线进程根据所述第一直播请求向直播源设备对所述第一直播数据流进行回源处理,得到所述第一直播数据流,并将所述第一直播数据流发送至所述第一终端设备,包括:The live broadcast method according to any one of claims 1 to 4, wherein when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in FLV format, the first line process according to the The first live broadcast request performs back-source processing on the first live data stream to the live source device to obtain the first live data stream, and sends the first live data stream to the first terminal device, including :
    所述第一线进程根据所述第一直播请求向直播源设备对所述第一直播数据流进行回源处理,得到实时消息传输协议RTMP格式的第一直播数据流;The first-line process performs back-source processing on the first live data stream to the live source device according to the first live broadcast request, and obtains the first live data stream in RTMP format;
    所述第一线进程将所述RTMP格式的第一直播数据流进行格式转换处理,得到FLV格式的第一直播数据流;The first line process performs format conversion processing on the first live data stream in the RTMP format to obtain the first live data stream in the FLV format;
    所述第一线进程将所述FLV格式的第一直播数据流通过超文本传输HTTP协议发送至所述第一终端设备。The first-line process sends the first live data stream in the FLV format to the first terminal device through a hypertext transfer HTTP protocol.
  6. 根据权利要求5所述的直播方法,其中,所述将所述FLV格式的第一直播数据流通过超文本传输HTTP协议发送至所述第一终端设备,包括:The live broadcast method according to claim 5, wherein the sending the first live data stream in the FLV format to the first terminal device through the hypertext transfer HTTP protocol includes:
    所述第一线进程根据所述HTTP协议的分块传输CHUNK编码将所述FLV格式的第一直播数据流进行分块处理,并将所述分块处理后的所述FLV格式的第一直播数据流发送至所述第一终端设备。The first-line process performs block processing on the first live data stream in the FLV format according to the block transmission CHUNK encoding of the HTTP protocol, and processes the first live data stream in the FLV format after the block processing. The data stream is sent to the first terminal device.
  7. 根据权利要求1至4任意一项所述的直播方法,其中,当所述第一终端设备表征所述第一终端设备需要获取传输TS文件格式的第一直播数据流,所述第一线进程根据所述第一直播请求向直播源设备对所述第一直播数据流进行回源处理,得到所述第一直播数据流,并将所述第一直播数据流发送至所述第一终端设备,包括:The live broadcast method according to any one of claims 1 to 4, wherein, when the first terminal device indicates that the first terminal device needs to obtain the first live data stream in TS file format, the first line process Perform back-source processing on the first live data stream to the live source device according to the first live broadcast request, obtain the first live data stream, and send the first live data stream to the first terminal device ,include:
    所述第一线进程根据所述第一直播请求向直播源设备对所述第一直播数据流进行回源处理,得到实时消息传输协议RTMP格式的第一直播数据流;The first-line process performs back-source processing on the first live data stream to the live source device according to the first live broadcast request, and obtains the first live data stream in RTMP format;
    根据动态码率自适应技术HLS协议将所述RTMP格式的第一直播数据流进行切片处理,生成多个所述TS文件格式的第一直播数据流;According to the dynamic code rate adaptive technology HLS protocol, the first live data stream in the RTMP format is sliced to generate a plurality of first live data streams in the TS file format;
    根据多个所述TS文件格式的第一直播数据流生成直播映射列表;Generate a live mapping list according to a plurality of first live data streams in the TS file format;
    根据所述直播映射列表将所述TS文件格式的第一直播数据流通过HTTP协议发送至所述第一终端设备。Sending the first live data stream in the TS file format to the first terminal device through the HTTP protocol according to the live mapping list.
  8. 根据权利要求1所述的直播方法,其中,所述方法还包括:The live broadcast method according to claim 1, wherein the method further comprises:
    所述第一线进程对内存设置环形缓冲队列,所述环形缓冲队列包括第一帧数据和最后一帧数据;The first-line process sets a ring buffer queue for the memory, and the ring buffer queue includes the first frame data and the last frame data;
    获取所述环形缓冲队列中的多个视频关键帧数据;Obtain a plurality of video key frame data in the ring buffer queue;
    根据所述多个视频关键帧数据确定第二个视频关键帧数据;determining a second video key frame data according to the plurality of video key frame data;
    在所述最后一帧数据的时间戳和第二个视频关键帧的时间戳的时间差值大于预设的缓冲时间的情况下,将所述第一帧数据的时间戳和第一时间戳之间的时间段中的所有直播数据流进行老化处理,其中,第一时间戳为所述第一帧数据的时间戳加上所述预设的缓冲时间所得到的时间戳,所述所有直播数据流包括所述第一直播数据流。When the time difference between the time stamp of the last frame data and the time stamp of the second video key frame is greater than the preset buffer time, the time difference between the time stamp of the first frame data and the first time stamp All live data streams in the period between are subjected to aging processing, wherein the first time stamp is the time stamp obtained by adding the preset buffer time to the time stamp of the first frame data, and all the live data streams The stream includes the first live data stream.
  9. 一种内容分发服务设备,包括:存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1至8任意一项所述的直播方法。A content distribution service device, comprising: a memory, a processor, and a computer program stored on the memory and operable on the processor, wherein, when the processor executes the computer program, any one of claims 1 to 8 is implemented. The live broadcast method described in the item.
  10. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1至8任意一项所述的直播方法。A computer-readable storage medium storing computer-executable instructions, the computer-executable instructions being used to execute the live broadcast method according to any one of claims 1 to 8.
PCT/CN2022/114282 2021-10-25 2022-08-23 Live broadcasting method, content distribution service device, and storage medium WO2023071468A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111239620.7 2021-10-25
CN202111239620.7A CN116033191A (en) 2021-10-25 2021-10-25 Live broadcast method, content distribution service device, and storage medium

Publications (1)

Publication Number Publication Date
WO2023071468A1 true WO2023071468A1 (en) 2023-05-04

Family

ID=86074618

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/114282 WO2023071468A1 (en) 2021-10-25 2022-08-23 Live broadcasting method, content distribution service device, and storage medium

Country Status (2)

Country Link
CN (1) CN116033191A (en)
WO (1) WO2023071468A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824707A (en) * 2016-04-21 2016-08-03 乐视控股(北京)有限公司 Merging back-source method and device for multiple processes of streaming media service
CN107302525A (en) * 2017-06-02 2017-10-27 上海帝联信息科技股份有限公司 Draw method of flow control and device, readable storage medium storing program for executing, streaming media server
CN109257335A (en) * 2018-08-22 2019-01-22 网宿科技股份有限公司 It keeps back the method for source link, return source method, relevant apparatus and storage medium
CN112218100A (en) * 2019-07-09 2021-01-12 阿里巴巴集团控股有限公司 Content distribution network, data processing method, device, equipment and storage medium
CN112995753A (en) * 2019-12-16 2021-06-18 中兴通讯股份有限公司 Media stream distribution method, CDN node server, CDN system and readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824707A (en) * 2016-04-21 2016-08-03 乐视控股(北京)有限公司 Merging back-source method and device for multiple processes of streaming media service
CN107302525A (en) * 2017-06-02 2017-10-27 上海帝联信息科技股份有限公司 Draw method of flow control and device, readable storage medium storing program for executing, streaming media server
CN109257335A (en) * 2018-08-22 2019-01-22 网宿科技股份有限公司 It keeps back the method for source link, return source method, relevant apparatus and storage medium
CN112218100A (en) * 2019-07-09 2021-01-12 阿里巴巴集团控股有限公司 Content distribution network, data processing method, device, equipment and storage medium
CN112995753A (en) * 2019-12-16 2021-06-18 中兴通讯股份有限公司 Media stream distribution method, CDN node server, CDN system and readable storage medium
WO2021121123A1 (en) * 2019-12-16 2021-06-24 中兴通讯股份有限公司 Media stream distribution method, cdn node server, cdn system, and readable storage medium

Also Published As

Publication number Publication date
CN116033191A (en) 2023-04-28

Similar Documents

Publication Publication Date Title
US9288250B2 (en) Mobile multimedia real-time transcoding system, apparatus, storage medium and method
US10986397B2 (en) Reception apparatus, transmission apparatus, and data processing method
US20140165119A1 (en) Offline download method, multimedia file download method and system thereof
US10499094B2 (en) Transmission apparatus, transmitting method, reception apparatus, and receiving method
US20110082943A1 (en) P2p network system and data transmitting and receiving method thereof
WO2021143360A1 (en) Resource transmission method and computer device
US10939150B2 (en) Content supply device, content supply method, program, terminal device, and content supply system
WO2015120766A1 (en) Video optimisation system and method
CN114501052B (en) Live broadcast data processing method, cloud platform, computer equipment and storage medium
CN107438201B (en) Message processing system, method and device
US10306272B2 (en) Content supply device, content supply method, program, terminal device, and content supply system
US10893315B2 (en) Content presentation system and content presentation method, and program
Zeng et al. TVSR‐OR: Tile‐based 360‐degree video streaming over real time streaming protocol with optimized read
US10057635B2 (en) Content supply device, content supply method, program, terminal device and content supply system
CA3213773A1 (en) Methods and systems for packaging and sending content
WO2023071468A1 (en) Live broadcasting method, content distribution service device, and storage medium
KR102373195B1 (en) Receiving device, transmission device, data communication method, and data processing method
KR102024642B1 (en) Live Steaming Server device and operating method thereof
US10051024B2 (en) System and method for adapting content delivery
KR20130027755A (en) System for encoding distributed moving pictur file and method for the same
CN113949696B (en) Resource distribution method, electronic device, and computer-readable storage medium
WO2017071524A1 (en) Multimedia resource publishing method and apparatus
US11350160B1 (en) Management of a client device buffer
US8660002B1 (en) Managing media resources utilizing session initiation protocol
JP2017143475A (en) Distribution management apparatus, reception apparatus, distributed processing system, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22885367

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE