WO2020216277A1 - 一种媒体流发送方法、装置、设备和系统 - Google Patents
一种媒体流发送方法、装置、设备和系统 Download PDFInfo
- Publication number
- WO2020216277A1 WO2020216277A1 PCT/CN2020/086335 CN2020086335W WO2020216277A1 WO 2020216277 A1 WO2020216277 A1 WO 2020216277A1 CN 2020086335 W CN2020086335 W CN 2020086335W WO 2020216277 A1 WO2020216277 A1 WO 2020216277A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- client
- live
- media stream
- proxy
- request message
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 180
- 238000012545 processing Methods 0.000 claims description 35
- 102100037812 Medium-wave-sensitive opsin 1 Human genes 0.000 claims description 26
- 239000000872 buffer Substances 0.000 claims description 9
- 230000008859 change Effects 0.000 claims description 7
- 230000004044 response Effects 0.000 description 57
- 230000008569 process Effects 0.000 description 45
- 230000006870 function Effects 0.000 description 17
- 230000005540 biological transmission Effects 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 239000012634 fragment Substances 0.000 description 7
- 238000004590 computer program Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 230000011664 signaling Effects 0.000 description 4
- 240000007643 Phytolacca americana Species 0.000 description 3
- 239000003795 chemical substances by application Substances 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 101000946275 Homo sapiens Protein CLEC16A Proteins 0.000 description 2
- 102100034718 Protein CLEC16A Human genes 0.000 description 2
- 230000002146 bilateral effect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000001151 other effect Effects 0.000 description 2
- 101100122750 Caenorhabditis elegans gop-2 gene Proteins 0.000 description 1
- 101100476639 Caenorhabditis elegans gop-3 gene Proteins 0.000 description 1
- 101100048435 Caenorhabditis elegans unc-18 gene Proteins 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 230000010267 cellular communication Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/61—Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
- H04L65/611—Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio for multicast or broadcast
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/21—Server components or server architectures
- H04N21/222—Secondary servers, e.g. proxy server, cable television Head-end
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/10—Architectures or entities
- H04L65/1045—Proxies, e.g. for session initiation protocol [SIP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
- H04L65/403—Arrangements for multi-party communication, e.g. for conferences
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/75—Media network packet handling
- H04L65/752—Media network packet handling adapting media to network capabilities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/75—Media network packet handling
- H04L65/762—Media network packet handling at the source
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/75—Media network packet handling
- H04L65/765—Media network packet handling intermediate
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/21—Server components or server architectures
- H04N21/218—Source of audio or video content, e.g. local disk arrays
- H04N21/2187—Live feed
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/239—Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
- H04N21/2393—Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests involving handling client requests
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
- H04N21/47202—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for requesting content on demand, e.g. video on demand
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/60—Network 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/63—Control 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/64—Addressing
- H04N21/6408—Unicasting
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/60—Network 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/63—Control 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/643—Communication protocols
- H04N21/6437—Real-time Transport Protocol [RTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/2866—Architectures; Arrangements
Definitions
- This application relates to the field of video playback, and in particular to a method, device, device, and system for sending media streams.
- Video viewing includes live broadcast and on-demand.
- the user can choose to fast forward or rewind the video content at any time while watching it, but it cannot choose for the live broadcast.
- the so-called live broadcast can be broadly understood as a process in which each frame of data is tagged with time sequence and then streamed.
- collection devices such as cameras and microphones continuously collect audio and video information, and then process the information through encoding, packetization, streaming, etc., and then transmit it through the distribution network.
- the playback terminal continuously downloads the data and follows the sequence Perform decoding and playback.
- the entire process of live video streaming can be divided into a series of processes such as collection, encoding, streaming, transcoding, distribution, and decoding/rendering.
- Mainstream Internet video live broadcast manufacturers generally use unicast transmission protocol to transmit video, so for N users watching the video, there will be N video streams.
- video live broadcasts carried out in enterprises it is required to support functions such as presentation document sharing and text comments while supporting live video. While displaying video content on the web page of the enterprise live broadcast, it is necessary to delay sharing documents and texts. Comment content to meet user needs and enhance user experience.
- live broadcast platforms In order to improve user experience and save backbone network bandwidth, live broadcast platforms generally deploy live content delivery networks (Content Delivery Network, CDN).
- CDN Content Delivery Network
- the live CDN is a distributed content distribution platform that supports a multi-level architecture, and the servers used for caching can be deployed hierarchically and hierarchically, so as to provide nearby services for users in different regions.
- the real-time messaging protocol (RTMP), or real-time messaging protocol, is generally used for the push and distribution process of the video; for the distribution process, RTMP, HLS ( HTTP Live Streaming and HyperText Transfer Protocol (HTTP)-Flash Video (FLV), referred to as "HTTP-FLV" three protocols.
- HLS HTTP Live Streaming and HyperText Transfer Protocol (HTTP)-Flash Video (FLV), referred to as "HTTP-FLV” three protocols.
- HLS HTTP Live Streaming and HyperText Transfer Protocol (HTTP)-Flash Video
- HLS is Apple's HTTP-based streaming media transmission protocol, which is mainly used in iOS devices including iPhone, iPad, iPod touch and Mac OSX to provide audio and video live broadcast services and recorded content (on-demand) services.
- HLS does not request a complete data stream at once, but cuts the streaming media data into continuous small files with shorter duration on the server side, and accesses the small files sequentially through the index file. As long as the client continuously plays these small files received from the server in sequence, it can play audio and video.
- the content source sends audio and video media streams to the enterprise data center (Enterprise Data Center, EDC) via RTMP
- EDC enterprise Data Center
- the EDC includes a Web server (Web server) and multiple Media server
- the Web server in the EDC is responsible for responding to the client's (PC) live viewing request, authenticating the user, and assigning a media server nearby to provide services according to the user's location.
- the selected media server will send the audio and video media stream to the next-level Regional Data Center (RDC) according to the preset policy.
- the media server in the RDC will receive the media stream (live content) after receiving the media stream (live content). , It will be sent to the next-level media server in the server room (SR) according to the preset strategy.
- the media server in the computer room caches the media stream (live content) distributed by the upper-level media server and directly Provide users with live broadcast services.
- the media server in the upper-level RDC needs to send the live media stream to each client in the live room requesting media streams, so that the upper-level media server must send it to every user in the live room
- WAN wide area network
- the embodiments of the application provide a method, device, device, and system for sending media streams, which are used to reduce the resource overhead of media servers sending media streams to clients in the same live broadcast room.
- the embodiments of the application disclose the following technologies Program:
- this application provides a method for sending a media stream.
- the method provides a live media stream for a client entering a live broadcast room.
- the method includes: the proxy server respectively receives a request from the same proxy client to enter the live broadcast room.
- the first live room request message and the second live room request message wherein the first live room request message is from a first client, and the second live room request message is from a second client;
- the proxy server receives the media server respectively The first live media stream sent to the first client through the proxy server and the second live media stream sent to the second client;
- the proxy server determines the first live media stream according to the first live room request message The role of a client, and determine the role of the second client according to the second live room request message;
- the proxy server is determining the role of the first client as the master user and the role of the second client as the servant In the case of the user, only the first live media stream is sent to the proxy client, so that the proxy client sends the first live media stream to the first client and the second client
- the proxy client when requesting to obtain the live media stream, the proxy client only needs to directly send the first media stream requested by the first client in the primary user role cached locally To the second client, thereby avoiding the proxy server from sending the live media stream to the proxy client, the proxy server does not need to send the live media stream for each client that enters the live room through the proxy client, and the method reduces the proxy server The traffic of sending media streams with the proxy client effectively reduces the export bandwidth and saves resource overhead.
- the first live broadcast room request message includes the identification of the proxy client
- the second live broadcast room request message includes the proxy client's Identification
- the method further includes: the proxy server determines the identification of the proxy client according to the identification of the proxy client included in the first live broadcast room request message, and the identification of the proxy client included in the second live broadcast room request message
- the first live room request message and the second live room request message come from the same proxy client.
- the proxy server can determine the receiving end object when forwarding the message and response, which facilitates message sending and receiving.
- the proxy server determining the role of the second client according to the second live broadcast request message includes: In the second live room request message, whether there is a client in the live room that enters the live room through the proxy client in the role of the master user; if so, it is determined that the role of the second client is the servant user.
- the proxy server only needs to determine whether there is a primary user in the live broadcast room to determine the identity role of the client entering the live broadcast room, and can quickly identify the role of the client and mark it .
- the method further includes: the proxy server receives the proxy client A request message for exiting the live broadcast room sent by the client, where the request message for exiting the live broadcast room is used to request the first client to exit the live broadcast room; when the proxy server determines to use the second client as the new primary user , Changing the role of the second client from the servant user to the master user; and switching the first live media stream sent to the second client to the second live media stream.
- the second client with the new main user role is used to request and obtain the live media stream from the media server, thereby ensuring that the second client is still in the live broadcast room.
- the client's viewing of media content is not affected, and the user experience of the second client's user in the live broadcast room is guaranteed.
- the last frame of the first live media stream sent by the proxy server to the second client is the same as the last frame sent to the second client
- the first frame of the second live media stream is an adjacent frame; before the proxy server switches the first live media stream sent to the second client to the second live media stream, the method further includes: proxy The server identifies the first I frame and the second I frame belonging to the first live media stream and the second live media stream according to the first live media stream and the second live media stream, and the first The I frame and the second I frame are the same video frame.
- the proxy server determines, according to the first I frame and the second I frame, adjacent first switching frames and second switching frames that belong to the first live media stream and the second live media stream, and Use the first switching frame and the second switching frame as the last frame of the first live media stream sent to the second client, respectively, and the second live broadcast sent to the first client
- the proxy server determining the role of the second client according to the second live room request message includes: the proxy server receives the second When requesting a message in the live broadcast room, it is judged whether the number of clients that enter the live broadcast room through the proxy client as the main user reaches a preset upper limit, and the preset upper limit is greater than or equal to 2 and a positive integer; if it reaches the If the upper limit is preset, it is determined that the role of the second client is a servant user.
- the size between the number of clients in the primary user role in the live broadcast room and the preset upper limit is calculated To determine the role of the client. Understandably, the role of the client can also be determined in other ways, for example, according to the number of requests for the live broadcast room, which is not limited in this embodiment.
- the proxy server determines The role of the second client is the backup master user.
- the method further includes: the agent The server receives a request message for exiting the live broadcast room from the first client; the proxy server changes the role of the second client from the servant user to the backup master user when determining to use the second client as the new backup master user; The proxy server buffers the received second live media stream in a unit of a group of pictures GOP.
- the proxy server receives the second live media stream from the media server and stores it locally, so as to provide the client in the live room when the user role is subsequently changed. The cached second live media stream.
- the method further includes: The proxy server caches the received second live media stream in units of GOPs; according to the identification of the first live media stream and the cached second live media stream that belong to the first live media stream and the second live media stream, respectively The first I frame and the second I frame of the live media stream, where the first I frame and the second I frame are the same video frame.
- the method further includes: the proxy server receives a request message for exiting the live broadcast room from the first client; When a new primary primary user is used, the role of the second client is changed from the backup primary user to the primary primary user; the proxy server determines the adjacent and the second I frame according to the first I frame and the second I frame. Belong to the first switching frame and the second switching frame of the first live media stream and the second live media stream respectively; the proxy server will send the first switching frame to the first switching frame and the second switching frame according to the first switching frame and the second switching frame.
- the first live media stream sent by the second client is switched to the second live media stream, wherein the last frame of the first live media stream sent by the proxy server to the second client is the first switch Frame, the first frame of the second live media stream sent to the first client is the second switching frame.
- the role of the second client changes from the backup master user to the primary master user
- the second live media stream from the media server is received and cached, and the cached second live media stream is copied and distributed to the live broadcast room To ensure that other clients in the live broadcast room can watch the live content normally without being affected.
- the proxy server caches the first live media stream and the second live media stream in units of GOPs.
- the 3 GOPs of the first live media stream and the 3 GOPs of the second live media stream are cached locally on the proxy server.
- an embodiment of the present application also provides a method for sending a media stream.
- the method provides a live media stream for a client entering a live broadcast room.
- the method includes: the proxy client respectively receives a message sent by the first client for A request message for the first live room requesting to enter the live room, and, the second client sends a second live room request message for requesting to enter the live room, and the proxy client sends the first live room request to the media server through the proxy server Message and the second live room request message, the proxy client receives the first live media stream sent by the proxy server, and the first live media stream is the media server to the first client through the proxy server
- the role of the first client is the master user
- the role of the second client is the servant user
- the proxy client sends the first live media stream to the first client and the second client.
- the proxy server for all users accessing the live room from the same proxy client, the proxy server only needs to send a live media stream to the proxy client, that is, the proxy client only needs to consume a wide area bandwidth to receive Compared with the transmission resources occupied by the media server to send the live media stream to each client in the live room, the live media stream sent by the proxy server reduces the load of the WAN network link and saves transmission overhead.
- the method before the proxy client sends the first live room request message to the media server through the proxy server, the method further includes: the proxy client sends the Adding the identifier of the proxy client to the first live room request message; and, before the proxy client sends the second live room request message to the media server through the proxy server, the method further includes: the proxy client The identifier of the proxy client is added to the second live room request message.
- the method further includes: the proxy client uses the group of pictures GOP Cache the first live media stream for the unit.
- the method before the proxy client sends the first live media stream to the second client, the method further includes: The time stamp of the first live media stream is such that the adjusted time stamp satisfies: the time stamp of the first frame of the first live media stream sent by the proxy client to the second client is 0, and the second The time stamps of adjacent frames of the first live media stream sent by the client are continuous.
- the method further includes: the proxy client receiving the first sent by the proxy server 2.
- a live media stream is a media stream sent by a media server to a second client through the proxy client, and the second client is a client whose role is changed from a servant user to a master user;
- the proxy client sends the second live media stream to the second client.
- the method before the proxy client sends the second live media stream to the second client, the method further includes: The timestamp of the second live media stream is such that the adjusted timestamp satisfies: the timestamp of the first frame of the second live media stream sent by the proxy client to the second client The time stamp of the last frame of the first live media stream sent by the client is continuous.
- an apparatus for sending a media stream includes: the apparatus includes a unit for executing the method steps in the foregoing first aspect and various implementation manners of the first aspect.
- the device includes a receiving unit, a processing unit, and a sending unit.
- it may also include other modules or units such as a storage unit.
- the device is a proxy server.
- an apparatus for sending a media stream in an embodiment of the present application includes: the apparatus includes a unit for executing the above-mentioned second aspect and the method steps in the various implementation manners of the second aspect.
- the device includes a receiving unit, a processing unit, and a sending unit.
- it may also include other modules or units such as a storage unit.
- the device is a proxy client.
- an embodiment of the present application also provides a network device, including a transceiver, a processor, and a memory, the processor is coupled to the memory, and the memory is used to store instructions; and the processor is used to call all
- the instruction causes the network device to execute the media stream sending method in the foregoing first aspect and various implementations of the first aspect, or calls the instruction to cause the network device to execute the foregoing second aspect and various implementations of the second aspect
- the media stream sending method in the mode including a transceiver, a processor, and a memory, the processor is coupled to the memory, and the memory is used to store instructions; and the processor is used to call all
- the instruction causes the network device to execute the media stream sending method in the foregoing first aspect and various implementations of the first aspect, or calls the instruction to cause the network device to execute the foregoing second aspect and various implementations of the second aspect The media stream sending method in the mode.
- the network device is a proxy server, or a proxy client.
- the transceiver when the network device serves as a proxy server, the transceiver is configured to respectively receive the first live room sent by the same proxy client for requesting to enter the live room
- the request message and the second live room request message respectively receive the first live media stream sent by the media server to the first client through the proxy server and the second live media stream sent to the second client, where
- the first live room request message comes from a first client
- the second live room request message comes from a second client
- the processor is configured to determine the first client according to the first live room request message And determine the role of the second client according to the second live room request message
- the transceiver is also used to determine the role of the first client as the master user and the role of the second client In the case of a servant user, only the first live media stream is sent to the proxy client, so that the proxy client sends the first live media stream to the first client and the The second client.
- the transceiver when the network device serves as a proxy client, the transceiver is configured to respectively receive the first client sent by the first client for requesting to enter the live broadcast room. A live room request message, and a second live room request message sent by the second client for requesting to enter the live room; and, sending the first live room request message and the media server through a proxy server The second live broadcast request message; the transceiver is also used to receive the first live media stream sent by the proxy server, and send the first live media stream to the first client and the second Client.
- the first live media stream is a media stream sent by the media server to the first client through the proxy server, the role of the first client is the master user, and the role of the second client is Servant user.
- the embodiments of the present application also provide a computer-readable storage medium.
- the storage medium stores instructions.
- the instructions run on a computer or a processor, they are used to execute the aforementioned first aspect and the first aspect.
- the embodiments of the present application also provide a computer program product.
- the computer program product includes computer instructions. When the instructions are executed by a computer or a processor, the foregoing first aspect and various aspects of the first aspect can be implemented. The method in the implementation manner, or the method in the foregoing second aspect and various implementation manners of the second aspect.
- an embodiment of the present application also provides a media stream sending system.
- the system includes at least one client, a proxy client, a proxy server, and a media server, wherein each of the clients passes through the proxy client
- the system implements the media stream sending methods described in the foregoing first aspect, second aspect, and various implementation manners of the first or second aspect through the proxy client and the proxy server.
- the proxy client is used to execute the media stream sending method described in the second aspect or any implementation manner of the second aspect
- the proxy server is used to execute the media stream sending method described in the first aspect or any implementation manner of the first aspect.
- the proxy server is the media sending device described in the foregoing third aspect or any implementation manner of the third aspect
- the proxy client is the foregoing fourth aspect or any implementation manner of the fourth aspect Said media sending device.
- the proxy server and the media server are located in a regional data center RDC, the RDC also includes a Web server, and the Web server is used to The proxy client enters the live broadcast room to assign the media server to the client.
- system further includes an enterprise data center EDC and a content source.
- the media stream sending system is a content distribution network CDN system.
- an embodiment of the present application also provides a chip system, the chip system includes a processor and an interface circuit, the interface circuit is coupled with the processor, and the processor is used to execute a computer program or instruction to implement the foregoing The first aspect and the methods in the various implementations of the first aspect, or the methods in the foregoing second aspect and the various implementations of the second aspect; wherein the interface circuit is used to communicate with other than the chip system The module communicates.
- the method provided in this application uses the proxy client and proxy server to obtain the live media stream requested by the main user’s client, and cache some media stream fragments locally on the proxy client.
- the proxy client directly sends the locally cached media streams to these clients, thereby avoiding the proxy server from sending live media streams to the proxy client.
- only one live media stream requested by the main user client is sent between the proxy server and the proxy client, that is, only a wide area bandwidth is needed to transmit the live media stream, compared to the media server through the proxy server
- the traffic of sending the media stream is reduced, the load of the WAN network link is reduced, and the resource overhead is saved.
- the proxy client also adjusts the timestamp of the live media stream when sending a live media stream to all clients in the live room. For example, when the first client in the primary user role exits the live room, the proxy client will When the first live media stream sent to the second client is switched to the second live media stream, the timestamp of the second live media stream is adjusted so that the proxy client sends the second live media stream to the second client Seamlessly connect the media content of the first live media stream that was originally being played, to avoid video jams or other effects on the media content viewed by the second client due to the exit of the first client, so this method adjusts the timestamp through the proxy client The user viewing experience is also guaranteed.
- FIG. 1 is a schematic diagram of a live broadcast system architecture provided by this application.
- FIG. 2 is a schematic diagram of the architecture of a video live broadcast bilateral agency system provided by an embodiment of the application;
- FIG. 3 is a flowchart of a method for sending a media stream according to an embodiment of the application
- FIG. 4 is a flowchart of another media stream sending method provided by an embodiment of the application.
- FIG. 5 is a signaling flowchart of a method for sending a media stream according to an embodiment of the application
- FIG. 6 is a signaling flowchart of another media stream sending method provided by an embodiment of the application.
- FIG. 7 is a signaling flowchart of another method for sending a media stream according to an embodiment of the application.
- FIG. 8 is a signaling flowchart of another method for sending a media stream according to an embodiment of the application.
- FIG. 9 is a schematic structural diagram of a media stream sending device according to an embodiment of the application.
- FIG. 10 is a schematic structural diagram of a network device provided by an embodiment of this application.
- the technical solution of the present application can be applied to a content delivery network (CDN) system, and the newly added devices in the system include a proxy server (proxy server) and a proxy client (proxy client).
- CDN content delivery network
- the proxy server is used to proxy the user's video bearer protocol, identify the roles of all clients that enter the live room through the proxy server, obtain at least one live media stream from the media server, and set the role as the live media stream of the main user identity Sent to the proxy client.
- the proxy server is also used to update the roles of other users in the live broadcast room and switch the new live media stream when the client in the main user role exits the live broadcast room.
- the proxy client is used to proxy the user's video bearer protocol, receives the live media stream of the client whose role is the main user sent by the proxy server, and copies and distributes the live media stream to the live room accessed through the proxy client All clients in.
- the proxy server may be located in a regional data center (Region Data Center, RDC).
- RDC Regional Data Center
- the proxy server may be specifically deployed on a server, or may also be deployed on a Universal Customer Premise Equipment (uCPE) in the form of Network Functions Virtualization (NFV).
- uCPE Universal Customer Premise Equipment
- NFV Network Functions Virtualization
- the proxy client may be a device located at the edge of the local area network, and the client in the local area network enters the live room through the proxy client and obtains the live media stream through the proxy client.
- the proxy client can be deployed on a server, or deployed on uCPE in the form of NFV.
- this embodiment provides a video CDN system, which includes: content source (content source) 101, enterprise data center (enterprise data center, EDC) 102, RDC 103, proxy client 104. At least one client (client, C), such as a first client C1 105, a second client C2 106, and a third client C3 107.
- EDC 102 includes multiple media servers (media servers) and Web servers (Web servers)
- RDC 103 includes proxy servers, multiple media servers, and Web servers.
- the proxy server and the proxy client are connected through a WAN network, and the proxy client and at least one client associated with it are connected through a local area network (LAN).
- LAN local area network
- the CDN live broadcast is a distributed content distribution platform that supports a multi-level architecture. By deploying multiple media servers hierarchically and hierarchically, it provides nearby services to users in different regions. Among them, when the users in the EDC watch the live broadcast in the live broadcast room, the allocated media server can be deployed in the RDC, and the live broadcast media transmitted circulates too much. Client.
- the proxy server may correspond to one or more proxy clients.
- the proxy server corresponds to proxy client 1 and proxy client 2.
- the client of LAN 1 enters the live room through proxy client 1 and the proxy server; the client of LAN 2 enters the live room through proxy client 2 and the proxy server. Studio.
- the proxy server may determine the role of each client that enters the live broadcast room through the proxy server through the following embodiment A or embodiment B.
- Implementation A The role of the client is uniformly determined for all clients that enter the live broadcast room through the same proxy client.
- the proxy server corresponds to the proxy client 1 and the proxy client 2. It determines at least one master user among the clients that enter the live broadcast room through the proxy client 1, and determines the other clients as servant users.
- the proxy client 2 determines at least one master user among the clients entering the live broadcast room, and determines other clients as servant users.
- the proxy server sends the live media stream of the client whose role is the primary user to the proxy client, and then the proxy client sends the live media stream to the The proxy client enters all clients in the live broadcast room.
- the clients that enter the live broadcast room through each proxy client include the client whose role is the main user, and the proxy server sends media to any proxy client.
- Streams are all media streams of the client that enters the live broadcast room through the proxy client and the role of the primary user.
- Embodiment B The role of the client is uniformly determined for all clients entering the live broadcast room through the proxy server.
- the proxy server corresponds to proxy client 1 and proxy client 2, and determines at least one master user among all the clients that enter the live broadcast room through proxy client 1 and proxy client 2, and determines other clients as servants. user.
- the role of the client is determined in Embodiment B, correspondingly, the live media stream of the client whose role is the primary user is sent to each proxy client corresponding to the proxy server in the system, and then each proxy client Send the live media stream to all clients that enter the live room through their respective proxy clients.
- the role described is the client of the master user, which can be referred to simply as: the client of the master user.
- the role is the client of the servant user, which can be referred to simply as: the client of the servant user.
- a media stream sending method provided by this embodiment, the method provides live media streams for all clients that enter the live room through the same proxy client. Specifically, the method includes:
- Step 101 The proxy server respectively receives the first live room request message and the second live room request message sent by the same proxy client for requesting to enter the live room, wherein the first live room request message comes from the first client, and the second live room request message The time request message comes from the second client.
- the first live room request message includes the identification of the proxy client
- the second live room request message includes the identification of the proxy client
- the identification may be the IP address or port number of the proxy client, etc.
- the proxy server may determine the proxy client that forwards the first live room request message according to the identifier of the proxy client included in the first live room request message, and according to all the proxy clients included in the second live room request message
- the identifier of the proxy client determines the proxy client that forwards the second live room request message, and it can be determined that the first live room request message and the second live room request message are from the same proxy client.
- Step 102 The proxy server respectively receives the first live media stream sent by the media server to the first client through the proxy server and the second live media stream sent to the second client.
- the proxy server forwards the first media request message to the media server, and receives a message sent by the media server according to the first media request message.
- the first live media stream and, after receiving the second media request message sent by the second client, forward the second media request message to the media server, and receive the media server according to the second media request The second live media stream sent by the message.
- Step 103 The proxy server determines the role of the first client according to the first live room request message, and determines the role of the second client according to the second live room request message.
- Embodiment A can be used to implement step 103.
- the proxy server determines whether there is a request message for a live broadcast room (such as the second live broadcast room request message) every time a request message for a live broadcast room exists in the live broadcast room.
- the role of the proxy client entering the live room is the client of the master user; if it exists, it is determined that the role of the client (such as the second client) that sends the request message for the live room is the slave user. ). If it does not exist, it is determined that the role of the client is a master user (master user).
- step 103 specifically includes: each time the proxy server receives a live room request message (as described in the first (2) Live room request message), to determine whether the number of clients in the current live room that enter the live room through the proxy client in the role of the main user reaches a preset upper limit, the preset upper limit is greater than or equal to 2, and if it reaches all According to the preset upper limit, it is determined that the role of the client (such as the second client) that sends the live room request message is a servant user. If the preset upper limit is not reached and the number is not 0, it is determined that the role of the client is a secondary-master user. If the number is 0, it is determined that the role of the client is the main-master user.
- Embodiment B may also be used to implement step 103, and the specific implementation manner is similar to the foregoing specific implementation manner of "Embodiment A".
- the only difference from the specific implementation of "Embodiment A” is that it is determined whether there is a role of the primary user in the live broadcast room that enters the live broadcast room through the proxy server Client.
- the only difference from the specific implementation of "Embodiment A” is that it is determined that the role of the primary user’s client in the current live broadcast room that enters the live broadcast room through the proxy server Whether the quantity reaches the preset upper limit.
- the proxy server caches the first live media stream in a unit of a group of pictures (GOP).
- GOP can refer to the image sequence between two I-frames.
- the I-frame is also known as an intra picture, which generally refers to each image processed by moving picture experts group (MPEG) technology.
- MPEG moving picture experts group
- the MPEG technology processing includes moderately compressing the video image, so that the first frame can be used as a reference point for random access, and there is no need to refer to other pictures.
- 3 GOPs are cached locally on the proxy server, and the duration of each GOP is 5s.
- Step 104 When the proxy server determines that the role of the first client is the master user and the role of the second client is the servant user, the proxy server only sends the first live media stream to the proxy client to Enabling the proxy client to send the first live media stream to the first client and the second client.
- the proxy server receives the first live room request message in step 101, receives the first live media stream in step 102, and determines the role of the first client as the master in step 103.
- the user because the role of the first client is the master user, in step 104, the live media stream of the first client (that is, the first live media stream) is sent to the proxy client, and accordingly, The proxy client sends the first live media stream to the first client.
- the proxy server receives the second live room request message in step 101, receives the second live media stream in step 102, and determines the role of the second client as a servant user in step 103.
- the role of the second client is a servant user and corresponds to the same proxy client as the first client.
- the proxy server does not send the media stream of the second client to the proxy client (that is, the The second live media stream). Accordingly, after receiving the first live media stream sent by the proxy server, the proxy client not only sends the first live media stream to the first client, but also copies the first live media stream. Live the media stream, and send the copied first live media stream to the second client. Understandably, if more clients are included in the live broadcast room, the proxy client copies multiple copies of the first live media stream, and sends the copied first live media stream to the proxy client to enter the Every client in the live room.
- the role of the first client may be the main master user, and the second client may be the servant user or the backup master user.
- the proxy server is only the first live media requested by the first client The stream is sent to the proxy client.
- the proxy server will also correspondingly send the first live media stream to other proxy clients, and the other proxy The client terminal copies and distributes the received first live media stream to the corresponding client terminal.
- the proxy client when requesting to obtain the live media stream, the proxy client only needs to send the first media stream requested by the first client in the master user role cached locally To the second client, thereby avoiding the proxy server from sending the live media stream to the proxy client, the proxy server does not need to send the live media stream for each client that enters the live room through the proxy client, and the method reduces the proxy server The traffic of sending media streams with the proxy client effectively reduces the export bandwidth and saves resource overhead.
- this embodiment also includes the process of changing the role of the client.
- the method further includes : The proxy server receives a request message for exiting the live broadcast room sent by the proxy client, and the request message for exiting the live broadcast room is used to request the first client to exit the live broadcast room; the proxy server is determining to transfer the second client As a new master user, change the role of the second client from the servant user to the master user (slave-to-master), and the proxy server will send the first live media to the proxy client The stream is switched to the second live media stream, so that the proxy client sends the second live media stream to the clients (including the second client) that enter the live broadcast room through the proxy client end).
- the last frame of the first live media stream sent by the proxy server to the proxy client and the first frame of the second live media stream sent to the second client are adjacent frames.
- the proxy server switches the first live media stream sent to the second client to the second live media stream, it also includes media stream alignment A step of.
- the media stream alignment step specifically includes: the proxy server identifies the first I frame and the second I frame belonging to the first live media stream and the second live media stream according to the first live media stream and the second live media stream.
- the proxy server determines according to the first I frame and the second I frame that adjacent ones belong to the first live broadcast Media stream and the first switching frame and the second switching frame of the second live media stream, and using the first switching frame and the second switching frame as the first switching frame sent to the second client The last frame of a live media stream and the first frame of the second live media stream sent to the first client.
- the proxy server forwards the request message for exiting the live broadcast room from the first client to the media server.
- the process of the corresponding client exiting the live broadcast room includes: when the first client is the main master user and the second client is the servant user, the first client The client requests to exit the live broadcast room, and the proxy server receives a request message from the first client to exit the live broadcast room.
- the proxy server sends The role is changed from the servant user to the backup master user; the proxy server receives the second live media stream sent by the media server in real time, and caches the second live media stream in GOP units.
- the proxy server caches the second live media stream of the backup master user locally, so that when the role of the backup master user is changed to the master master user, it can directly Using the second live media stream improves the transmission efficiency of the media stream.
- the process of the first client exiting the live broadcast room includes: the proxy server receives from the first client The proxy server changes the role of the second client from the backup master user to the primary master user (secondary-master to a request message for exiting the live broadcast room) when determining to use the second client as the new primary master user. main-master), and switch the first live media stream sent to the proxy client to the second live media stream.
- the proxy server caches the received media stream of the client every time after confirming that a new role is the client of the backup primary user, and takes the cached media stream of the client and the current role as the main
- the media streams of the client of the primary user are aligned, that is, the media streams of the client whose role is the primary primary user and the media streams of the client whose role is the backup primary user are cached to identify the same video frames belonging to the two media streams. .
- the received second live media stream is buffered in GOP units, and the first live media stream and the second live media stream are identified as belonging to the first live media respectively
- the first I frame and the second I frame of the stream and the second live media stream, the first I frame and the second I frame are the same video frame.
- the proxy server determines, according to the first I frame and the second I frame, neighboring ones that belong to the first live media stream and the first live media stream, respectively. 2.
- the proxy server switches the first live media stream sent to the second client to the first according to the first switching frame and the second switching frame Two live media streams, wherein the last frame of the first live media stream sent to the second client is the first switching frame, and the first frame of the second live media stream sent to the first client The frame is the second switching frame.
- the embodiment of the present application also provides a media stream sending method, which can be applied to a proxy client. Further, as shown in Figure 4, the method includes:
- Step 201 The proxy client respectively receives a first live room request message sent by the first client to request to enter the live room, and a second live room request sent by the second client to request to enter the live room news.
- Step 202 The proxy client sends the first live room request message and the second live room request message to the media server through the proxy server.
- the proxy client may also add the identifier of the proxy client to the first live room request before forwarding the first live room request message to the proxy server, and, before forwarding it to the proxy server Before the second live room request message, the identifier of the proxy client is added to the second live room request.
- the identifier of the proxy client is the IP address of the proxy client.
- Step 203 The proxy client receives a first live media stream sent by the proxy server, where the first live media stream is a media stream sent by the media server to the first client through the proxy server, and The role of the first client is the master user, and the role of the second client is the servant user.
- Step 204 The proxy client sends the first live media stream to the first client and the second client.
- the proxy client before sending the first live media stream, the proxy client further includes: buffering the first live media stream in a GOP unit, and adjusting the timestamp of the first live media stream.
- the proxy client receives the first live room request message of the first client, and in step 202 forwards the first live room request message to the proxy server, because the proxy server
- the first client is determined as the master user
- the proxy client receives the live media stream of the first client (ie, the first live media stream) in step 203, and sends the first live media stream to the second client in step 204 One client.
- the proxy client receives the second live room request message of the second client, and in step 202 forwards the second live room request message to the proxy server, because the proxy server has the second client
- the client is determined to be a servant user, so the proxy client does not receive the live media stream of the second client (that is, the second live media stream), but directly executes step 204 to copy and send the first live media stream to the second client.
- the proxy client When copying and sending the first live media stream to the second client, the proxy client also adjusts the timestamp of the first live media stream so that the first live media stream sent to the second client meets:
- the time stamp of the first frame of the first live media stream sent by the client to the second client is 0; and the time stamps of adjacent frames of the first live media stream sent to the second client are continuous Yes, the “continuous” means that the time interval between adjacent frames of the first live video stream is the same, which is the reciprocal of the frame rate f of the first live video stream.
- the method further includes: when the first client exits the live broadcast room, the proxy client forwards the related process of the first client's exit live broadcast request message, which specifically includes: the proxy client receives the request to exit the live broadcast room from the first client Message, send the quit live broadcast room request message to the proxy server; receive the quit live broadcast response message sent by the proxy server according to the quit live broadcast request message, and send the quit live broadcast response message to The first client.
- the proxy client forwards the related process of the first client's exit live broadcast request message, which specifically includes: the proxy client receives the request to exit the live broadcast room from the first client Message, send the quit live broadcast room request message to the proxy server; receive the quit live broadcast response message sent by the proxy server according to the quit live broadcast request message, and send the quit live broadcast response message to The first client.
- it also includes: when the proxy client receives the first live room request message, marking the role of the first client as working; when the second live room request message is received In this case, the role of the second client is marked as work; in the case of receiving a request message for exiting the live broadcast room sent by the first client, the role of the first client is marked as exiting. And update the role mark of the first client to the "live room user relationship table".
- the method further includes: the proxy client receives a second live media stream sent by the proxy server, and the second live media stream is the media server through the proxy client A media stream sent by the client to a second client, the second client being a client whose role is changed from a servant user to a master user; the proxy client sends the second live media stream to the second client.
- the method further includes: the proxy client adjusts the timestamp of the second live media stream so that the adjusted time The stamp satisfies: the time stamp of the first frame of the second live media stream sent by the proxy client to the second client and the time of the last frame of the first live media stream sent to the second client Poke continuously. Further, the last frame of the first live media stream sent by the proxy client to the second client and the first frame of the second live media stream sent to the second client are adjacent frames.
- the proxy server adjusts the timestamp of the media stream according to the formula so that the adjusted timestamp meets the following constraints:
- the timestamp of the first frame of the live media stream sent by the proxy client to the second client is 0;
- the time stamps of the adjacent frames of the live media stream sent by the proxy client to the second client are continuous, that is, the time interval of the adjacent frames of the sent live media stream is the same, and the time interval is the live video
- the frame rate of the stream is the inverse of f.
- ⁇ t is the time before adjustment of the first frame of the live media stream sent by the proxy client to the second client The opposite of poke.
- the GOP of the first live media stream cached by the proxy client is 5 seconds (s), and 3 GOPs are cached locally.
- the content of each GOP is updated in real time.
- the first client (Client C1 for short) is the first client to enter the live broadcast room, and the role of client C1 at the 0th second is the main user, and continues to watch the first live media stream in the live broadcast room until the 60s Duration.
- the 3 GOPs of the video media stream cached locally by the proxy client are: 45s-50s, 50s-55s, 55s-60s media content, these 3 GOPs are the media server passing the proxy server For the media stream segment sent to the client C1, the timestamp corresponding to each frame sent is the relative time of the client C1.
- the second client enters the live broadcast room at the 60th second, and the role is a servant user.
- the proxy client needs to send the latest first live media stream sent to client C1 and locally cached to the client C2.
- the live media stream closest to 60s is the third GOP segment, and the media content of the 55s-60s is cached.
- 55s is the timestamp of the frame sent by the media server.
- the proxy server when the client C1 requests to exit the live broadcast room, the proxy server needs to switch the first live media stream sent to the client C2 to the second live media stream, and the role of the client C2 is changed to the main user at this time , And the second live broadcast media stream is a media stream sent by the media server to the client C2.
- the proxy client receives the second live media stream sent by the media server, and adjusts the timestamp of the second live media stream.
- the proxy server determines to change the role of the client C2 as the primary user, and then the proxy server sends the second live media stream of the client C2 to the proxy client.
- the proxy client receives and caches the second live media stream. It is assumed that the media content of the 3 GOPs locally cached by the proxy client are: 105s-110s, 110s-115s, 115s-120s, After 10s, the proxy client caches the latest GOP 1 as the 115th-120s video content.
- the time stamp on the frame in this GOP 1 is the relative time of client C1.
- the proxy client when it adjusts the timestamp, it can be divided into two situations to calculate the time difference. Specifically,
- the proxy client and proxy server when used to obtain the live media stream requested by the client of the main user, some media stream fragments are cached locally at the proxy client.
- the proxy client When other clients enter the live room and request live media When streaming, the proxy client directly sends the locally cached media streams to these clients, thereby avoiding the proxy server from sending live media streams to the proxy client.
- only one live media stream requested by the main user client is sent between the proxy server and the proxy client, that is, only a wide area bandwidth is needed to transmit the live media stream, compared to the media server through the proxy server
- the traffic of sending the media stream is reduced, the load of the WAN network link is reduced, and the resource overhead is saved.
- the proxy client also adjusts the timestamp of the live media stream when sending a live media stream to all clients in the live room. For example, when the first client in the primary user role exits the live room, the proxy client will When the first live media stream sent to the second client is switched to the second live media stream, the timestamp of the second live media stream is adjusted so that the proxy client sends the second live media stream to the second client Seamlessly connect the media content of the first live media stream that was originally being played, to avoid video jams or other effects on the media content viewed by the second client due to the exit of the first client, so this method adjusts the timestamp through the proxy client The user viewing experience is also guaranteed.
- This embodiment provides a method for sending a live video media stream.
- the method can be applied to the live video system shown in FIG. 2.
- the method includes a proxy server sending a first client that enters the live room through the same proxy client and
- the second client provides a live media stream, where the live media stream comes from a content source and is forwarded through a media server in the RDC.
- the method includes 39 steps (steps, S) in total, from S1 to S39.
- client C1 the first client
- client C2 the second client
- the process for the client C1 to enter the live room and obtain the live media stream includes:
- the content source sends the first live media stream to the media server in the EDC.
- the media server in the EDC receives the first live media stream, and sends the first media stream to the media server in the next-level RDC. Wherein, before sending the first live media stream, it also includes: the step of the Web server in the EDC to authenticate the media server in the next level RDC, if and only if the authentication result is qualified, the media server in the RDC will be the first The live media stream is sent to the media server in the RDC.
- S2 further includes: a proxy server that identifies the transmission protocol corresponding to the proxy client according to the service characteristics of the first live media stream; wherein, the service characteristics include the IP address and port number of the Web server, For example, for the HyperText Transfer Protocol (HTTP) protocol, the configurable service features include: the IP address and port number of the Web server. Further, it can be determined that the transmission protocol corresponding to the HTTP protocol is Transmission Control Protocol (TCP), so as to use the TCP protocol to transmit the media stream.
- TCP Transmission Control Protocol
- the client C1 sends a request message of an accessible media server to the Web server in the RDC. Further, the request message includes: the user name, IP address, live room name of the client C1, the key Token obtained by the client C1 after authentication, and other information, where the IP address is used to determine the location of the client C1 .
- the client C1 sends the request message to the proxy client, and the proxy client forwards the request message to the proxy server after receiving the request message, and then the proxy server forwards the request message to the Web server in the RDC.
- the Web server in the RDC receives the request message, and sends a response message of an accessible media server to the client C1, where the response message is used to inform the client C1 of the media server it can access.
- the Web server determines, according to the request message, a target media server that can provide media streaming services for the client C1, where the target media server is one of multiple media servers in RDC, and then sends the response message to the client
- the response message includes relevant information of the target media server, such as uniform resource locator (URL) information, IP address, and port number of the target media server.
- URL uniform resource locator
- the Web server in the RDC sends the response message to the proxy server, the proxy server sends the response message to the proxy client, and the proxy client forwards the response message to the client C1.
- the Web server determines the location of the client C1 according to the IP address carried in the request message for accessing the media server sent by the client C1, and selects the media server that is closer to the client C1 as the target media according to the location information server.
- the response message carries relevant information of the target media server, such as the URL information, IP address, and port number of the target media server. Therefore, when the proxy server and the proxy client forward the response message, the client The information of the media server that the terminal C1 can access, that is, the relevant information of the target media server.
- the client C1 sends a first live room request message for requesting to enter the live room to the proxy client.
- the first live room request message indicates that the client C1 requests to enter the live room.
- the first live broadcast room request message includes the user name, IP address, port number, live broadcast room name, and Token obtained after authentication of the client C1.
- the proxy client receives the first live room request message sent by the client C1, and sets the role of the client C1 to a working state.
- a "live room user relationship table" is established, and a record about client C1 is added to the user relationship table in the live room.
- the recorded content includes: the IP address, port number, user status, and user name of client C1 , The IP address and port number of the target media server selected in RDC, the name of the live broadcast room and other information.
- the user status of the client C1 is working.
- the IP address of the client C1 may be a primary key (primary key) stored in the database.
- the proxy client adds its own identifier to the first live broadcast room request message, and the identifier of the proxy client is the IP address or port number of the proxy client.
- the proxy client sends the first live room request message with the proxy client identifier added to the proxy server, where the modified first live room request message includes: the proxy client's identifier, the client The user name of the terminal C1, the name of the live broadcast room, and the token obtained after authentication.
- the proxy server receives the modified first live room request message, determines the role of the client C1 according to the first live room request message, and refreshes the user relationship table in the live room.
- determining the role of the client C1 includes: determining whether there is a client whose role is the main user among the clients that enter the live broadcast room through the proxy client when the first live broadcast room request message is received ; If it exists, it is determined that the client C1 is a servant user; if it does not exist, it is determined that the client C1 is a master user.
- the proxy server since the client C1 is the first user to enter the live room through the proxy client, there is no master user, so when the proxy server receives the first live room request message, it determines that the role of the client C1 is The master user, and identifies the role of the client C1 as the master user.
- the proxy server also includes: after determining the role of the client C1, the proxy server refreshes the “user relationship table in the live broadcast room”, marking the role of the client C1 as the main user. Understandably, the proxy server can update the "live room user relationship table" at any time according to the received live room request message sent through the same proxy client, so as to record the role status of each client in the live room at all times. Optionally, the proxy server also records the identification (IP address and port number) of the proxy client in the "live room user relationship table".
- the number of clients that set the role of the master user in the live broadcast room is 1, that is, there is only one master user in the live broadcast room, and the rest of the clients are all servant users.
- it can be called a single master user scenario .
- the proxy server sends the first live broadcast room request message to the media server in the RDC.
- the first live broadcast room request message does not include the identifier of the proxy client.
- the media server in the RDC receives the first live room request message, and sends the first live room response message to the client C1.
- the first live broadcast room response message is used to notify the client C1 that it has successfully entered the live broadcast room.
- the media server first forwards the first live room response message to the proxy client through the proxy server, and then the proxy client forwards the first live room response message to the client C1.
- the client C1 sends a first media request message to the proxy client, where the first media request message is used to request the media server to obtain the first live media stream.
- the first identifier of the client C1 carried in the first media request message, and the first identifier is used to uniquely identify the client C1.
- the first identifier includes the client C1's IP address and user name, etc.
- the proxy client receives the first media request message, it forwards it to the proxy server, and the proxy server sends the first media request message to the media server in the RDC.
- the media server After receiving the first media request message, the media server sends a first media response message to the client C1.
- the first media response message is used to notify the client C1 to allow obtaining the first live media stream.
- the media server sends the first media response message to the proxy server, and then the proxy server forwards the first media response message to the proxy client, and finally the proxy client forwards the first media response message to the client C1.
- S14 The media server sends the first live media stream to the proxy server.
- the proxy server obtains the first live media stream sent by the media server in real time, and then caches the first live media stream locally. Specifically, the proxy server locally caches the first live media stream segment in units of GOPs, such as Cache the latest 3 GOP media stream segments, respectively: t1-t2, t2-t3, t3-t4.
- S16 The proxy server sends the buffered first live media stream segment to the proxy client, so that the proxy client sends the first live media stream to the client C1.
- the proxy client receives the first live media stream sent by the proxy server, and caches the first live media stream locally in a GOP unit. Among them, the proxy client only caches a number of the latest first live broadcast media stream fragments.
- the proxy client in the process of sending the first live media stream to the client C1, the proxy client also needs to adjust the timestamp of the first live media stream, so that the adjusted timestamp satisfies: the proxy client sends to the client C1
- the time stamp of the first frame of the first live media stream is 0, and the time stamps of adjacent frames of the first live media stream sent to the client C1 are continuous.
- the “continuous” means that the time interval between adjacent video frames of the first live media stream received by the client C1 is the same, where the time interval is the reciprocal of the frame rate f.
- the following describes how the client C2 enters the live broadcast room and obtains the live media stream. Specifically include the following steps:
- Client C2 sends an accessible media server request message to the Web server in RDC.
- the request message includes the user name, IP address, live broadcast room name of client C2, and the secret obtained by client C2 after being authenticated. Key Token and other information.
- the client C2 forwards the request message to the Web server in the RDC through the proxy client and the proxy server, and during the forwarding process, both the proxy client and the proxy server obtain the information carried in the request message.
- the Web server in the RDC receives the request message, and sends a response message to the client C2, where the response message is used to inform the client C2 of the media servers it can access.
- the Web server selects one of the multiple media servers to provide media streaming services for the client C2, and sends relevant information of the selected media server, such as the URL information, IP address, and port of the media server The number, etc. are sent to the proxy server and the proxy client through the response message.
- the proxy client and the proxy server obtain the information carried in the request message, including the information of the media server that the client C2 can access. For example, the IP address and port number of the media server.
- the client C2 sends a second live room request message for requesting to enter the live room to the proxy client, where the second live room request message indicates that the client C2 requests to enter the live room.
- the second live broadcast room request message includes the user name, IP address, port number, live broadcast room name, and Token obtained after authentication of the client C2.
- the proxy client receives the second live room request message sent by the client C2, and sets the role of the client C2 to a working state. At the same time, add a record about client C2 in the "live room user relationship table". Specifically, the recorded content includes: client C2's IP address, port number, user status, user name, and target media server selected in RDC The IP address and port number, the name of the live broadcast room and other information. Among them, the user status of the client C2 is working. The IP address of the client C2 may be the primary key stored in the database.
- the proxy client adds its own identifier to the second live broadcast room request message, and the identifier of the proxy client is the IP address or port number of the proxy client.
- the proxy client sends the second live room request message added with the proxy client identifier to the proxy server.
- the modified second live room request message includes information such as the identifier of the proxy client, the user name of the client C2, the name of the live room, and the token obtained after authentication.
- the proxy server receives the modified second live room request message sent by the proxy client, determines the role of the client C2 according to the second live room request message, and refreshes the user relationship table in the live room. Specifically, one possible implementation is that after receiving the second live broadcast room request message, the proxy server determines whether there is a role of the main user who enters the live broadcast room through the proxy client in the current live broadcast room. The client, if it exists, determines that the role of the client C2 is a servant user. In this embodiment, the role of the client C1 already exists in the current live broadcast room as the client of the master user, so it is determined that the role of the client C2 is the servant user.
- S25 also includes that the proxy server refreshes the "user relationship table in the live broadcast room" and identifies the role of the client C2 as a slave. In addition, it also includes: the proxy server adds the identification of the proxy client, such as the IP address and port number of the proxy client, to the record of the client C2.
- the proxy server sends the second live room request message to the media server in the RDC.
- the second live broadcast room request message does not include the identifier of the proxy client.
- the media server receives the second live room request message, and sends a second live room response message to the client C2, where the second live room response message is used to notify the client C2 that it has successfully entered the live room. Specifically, the media server passes the second live room response message through the proxy server and the proxy client, and then the proxy client forwards the second live room response message to the client C2.
- the client C2 sends a second media request message to the proxy client, where the second media request message is used to request the media server to obtain the live media stream.
- a second identifier of the client C2 carried in the second media request message and the second identifier is used to uniquely identify the client C2.
- the second identifier includes the client C2's IP address and user name, etc.
- the proxy client forwards it to the proxy server, and the proxy server sends the second media request message to the media server in the RDC.
- the media server After receiving the second media request message, the media server sends a second media response message to the client C2, where the second media response message is used to notify the client C2 that the first live media stream is allowed to be obtained. Specifically, the media server sends the second media response message to the proxy server, then the proxy server forwards the second media response message to the proxy client, and finally the proxy client forwards the second media response message to the client C2.
- the proxy client sends the locally cached first live media stream to the client C2. Further, when sending the first live media stream, the time stamp of the first live media stream is adjusted so that the adjusted time stamp is It is satisfied that the time stamp of the first frame of the first live media stream sent by the proxy client to the client C2 is 0, and the time stamps of adjacent frames of the first live media stream sent to the client C2 are continuous.
- the media server sends a second live media stream to the proxy server.
- the second live media stream is a media stream sent to the client C2, and the role of the client C2 is a servant user.
- the proxy server After receiving the second live media stream, the proxy server does not cache or forward the second live media stream to the client C2, because the second live media stream is a media stream sent to the client C2 of the servant user.
- S33 The media server sends the first live media stream to the proxy server in real time.
- the proxy server receives the first live media stream sent by the media server, and caches the fragments of the first live media stream locally in GOP units.
- the proxy server locally caches 3 GOPs, and can also cache more or fewer GOPs, which is not limited in this embodiment.
- S35 The proxy server sends the first live media stream to the proxy client.
- the proxy client receives the first live media stream, and caches the first live media stream segment locally in a GOP unit.
- the proxy client determines the number of clients of the master user and the servant user in the live room according to the content recorded in the "live room user relationship table", and copies the cached first live media stream segment to prepare for sending to the live room In the client.
- client C1 and client C2 there are only two clients in the current live broadcast room, client C1 and client C2, where client C1 is the main user and client C2 is the servant user, so the proxy client copies the first live media stream , To prepare to send to client C2.
- the proxy client sends the locally cached first live media stream to the client C1.
- the proxy client adjusts the time stamp in the first live media stream according to the time when the client C1 receives the video frame of the media stream.
- the proxy client sends the locally cached first live media stream to the client C2.
- the proxy client adjusts the time stamp in the first live media stream according to the time when the client C2 receives the video frame of the media stream.
- the proxy client adjusts the timestamp of the video frame watched by the user entering the live broadcast room, so that the client C1 and the client C2 in the live broadcast room can watch the media content of the first live broadcast "synchronously", thereby improving user experience.
- the proxy client and the proxy server are used to obtain the live media stream requested by the first client of the main user, some of the live media stream fragments are cached locally at the proxy client.
- the proxy client When the second client enters the live broadcast room When requesting a live media stream, the proxy client directly sends the locally cached live media stream to the second client, thereby avoiding the proxy server from sending the live media stream to the proxy client.
- the proxy server in this method only needs to send one Sending a live media stream to the proxy client only needs a wide area bandwidth to transmit the live media stream, which can effectively reduce the flow of sending media streams, reduce the load on the WAN network link, and save resource overhead.
- the method of this embodiment can also combine the first live room request message and the first media request message of the client C1 into one message, and the combined message has the first live room request message and the first media.
- the request message has two functions.
- the proxy server can count the total number of clients currently entering the live broadcast room with the role of the main user according to the number of first media request messages.
- the second live room request message and the second media request message of the client C2 can also be combined into one message, and the corresponding method for determining the role of the client C2 is also the same, which will not be repeated in this embodiment.
- the method provided in this embodiment also includes: when the role of the client C2 changes, for example, the servant user role is changed to the master user, and the media server continues to send the live media stream to the client C2. Further, as shown in Figure 6, including S40 to S53, the specific method flow is as follows:
- the client C1 sends a request message for exiting the live broadcast room to the proxy client, where the request message for exiting the live broadcast room is used to request the client C1 to exit the live broadcast room.
- the request message for exiting the live broadcast room includes the user name, IP address, port number, user role, and name of the live broadcast room of the client C1.
- the proxy client After receiving the request message for exiting the live broadcast room, the proxy client marks the role of the client C1 as an exiting user, and records it in the "live room user relationship table".
- S42 The proxy client sends the request message for exiting the live broadcast room to the proxy server.
- the proxy server receives the request message for exiting the live broadcast room, and does not forward the request message for exiting the live broadcast room to the media server for the time being, because at this time the first live media stream requested by the client C1 as the main user is being watched by the client C2 .
- the role of the client C1 is marked as an exiting user, and is recorded in the "live room user relationship table".
- the proxy server selects one of the clients in the live broadcast room as the new primary user.
- the only clients that enter the live broadcast room through the proxy client are clients C1 and C2, and when the client C1 When requesting to exit the live broadcast room, select client C2 as the new master user, and change the role of client C2 from the servant user to the master user, and mark it as the slave-to-master user.
- the media server sends the second live media stream to the proxy server in real time.
- the content of the second live media stream is the same as the content of the first live media stream, and both come from the content source.
- the proxy server receives the second live media stream, and caches the second live media stream locally in a GOP unit.
- the method further includes: the proxy server uses an alignment algorithm to align the first live media stream and the second live media stream.
- the process includes: each time the proxy server receives an I frame of the first live media stream, it compares the I frame with the locally buffered I frame of the second live media stream, and every time the second live media stream is received Compare the I frame with the locally buffered I frame of the first live media stream, if the above comparison process finds the I frames that belong to the first live media stream and the second live media stream and have the same media content (Hereinafter referred to as I frame a and I frame b respectively), it is determined that the two live media streams are aligned. It can be understood that the I frame a and the I frame b are the same video frame.
- switching frame x determines the last frame of the first live media stream sent to the proxy client (hereinafter referred to as switching frame x) and the second live broadcast sent to the proxy client
- the first frame of the media stream (hereinafter referred to as switching frame y), switching frame x and switching frame y are adjacent frames.
- the nth frame after I frame a in the first live media stream may be determined as the switching frame x
- the n+1th frame after I frame b in the second live media stream may be determined as the switching frame y, where n is An integer greater than or equal to 0. Since I frame a and I frame b are the same video frames, the nth frame after I frame a and the n+1th frame after I frame b are naturally adjacent frames.
- the client C2 of the new primary user is used to request and obtain the second live media stream, and align the first live media stream and the second live media stream
- the proxy server sends the second live media stream to the proxy client, the proxy server seamlessly connects the media content of the first live media stream that was originally playing, avoiding the problem of the proxy server switching the live media stream.
- video content has the effect of repeated or less playback.
- the proxy server sends the request message for exiting the live broadcast room to the media server.
- the media server After receiving the request message for exiting the live broadcast room, the media server sends a response message for exiting the live broadcast room to the proxy server, where the exiting live broadcast room response message is used to notify the client C1 that the exit is successful.
- the proxy server deletes the record corresponding to the client C1 from the "user relationship table between live broadcasts".
- the proxy server receives the response message for exiting the live broadcast room sent by the media server, and forwards the response message for exiting the live broadcast room to the proxy client.
- the proxy client receives the exit live room response message sent by the proxy server, and deletes the record corresponding to the client C1 from the "live room user relationship table".
- S52 The proxy client sends the response message for exiting the live broadcast room to the client C1.
- it also includes: sending the second live media stream buffered by the proxy server to the proxy client, and the proxy client receives the second live media stream and caches it locally in units of GOP, and then caches the second live media stream segment. Sent to the client C2 to ensure that the client C2 in the live broadcast room can watch the live media content normally.
- the proxy client sends the second live media stream to the client C2, it adjusts the time stamp of the second live media stream so that the time stamp of the first frame of the second live media stream received by the client C2 It is continuous with the time stamp of the last frame of the first live media stream, and the corresponding time interval is the reciprocal of the frame rate parameter f.
- the proxy server selects a new client from the live broadcast room as the new main user, aligns the live media stream of the new main user and sends it to the agent Client.
- the proxy client receives the live media stream of the new main user sent by the proxy server, it adjusts the timestamp of the live media stream, so that other users in the live room watching the media content have no perception of the media stream switching. This method guarantees The viewing experience of users in the live broadcast room.
- This embodiment provides another method for sending live media streams.
- the method is applied to a technical scenario of multiple primary user roles, where the multiple primary users refer to the number of clients of the primary user role set in the live room being greater than or equal to 2. Further, it includes a primary master user, which can be identified as a main master user, and multiple backup master users, which can be identified as a secondary master user, and at least one role is a slave user.
- the process of requesting and obtaining the live media stream for the client that enters the live room through the same proxy client is similar to that of the previous embodiment, but the differences include: the identification of the client's role and when there is a master When the client of the user role exits the live broadcast room, the identity of the client's role and the live media stream are copied and distributed still in the live broadcast room.
- this embodiment also includes a third client (hereinafter referred to as "client C3"), and the preset upper limit of the number of main user roles in the live broadcast room is set to 2.
- client C3 a third client
- each client The process of entering the live room and requesting the live media stream: as shown in Figure 7, including the following:
- S1 to S18 are processes for the client C1 to enter the live broadcast room and request to obtain the live media stream.
- the process is the same as S1 to S18 in the first embodiment, except that when the "live room user relationship table" is refreshed in S9, the role flag of the client C1 is set as the main-master.
- the role flag of the client C1 is set as the main-master.
- the proxy server obtains the first live media stream sent by the media server
- the 3 first live media stream fragments are cached locally in GOP units, and the first live media stream fragments are sent to the client through the proxy client in real time End C1.
- S19 to S39 are processes for the client C2 to enter the live broadcast room and request to obtain the live media stream. Specifically, it includes: S19 to S24, which is a process in which the client C2 enters the live broadcast room through the proxy client and sends a second live broadcast request message to the proxy client. The process is the same as S19 to S24 in the first embodiment, so it can Please refer to the specific description of the first embodiment above, which will not be repeated here.
- the proxy server After receiving the second live room request message sent by the proxy client, the proxy server determines the role of the client C2 according to the second live room request message. Specifically, it is determined whether the number of clients that enter the live broadcast room through the proxy client and the role of the master user when obtaining the second live room request message reaches a preset upper limit, and if the preset upper limit is reached, it is determined that client C2 is a servant User; if the preset upper limit is not reached and the number of clients of the primary user is not 0, it is determined that the client C2 is the backup primary user.
- the preset upper limit is 2, and the proxy server determines that two live room request messages are currently obtained, which are the first live room request message from client C1 and the second live room request message from client C2. , And the role of the client C1 is the main primary user. At this time, the number of primary users in the live broadcast room is 1, which has not reached the preset upper limit, so the proxy server determines that the role of the client C2 is the backup primary user.
- it also includes refreshing the record about the client C2 in the "user relationship table between live broadcasts", and marking the role of the client C2 as the backup master user.
- S26 to S39 It also includes: S26 to S39, a process for the client C2 to obtain the first live media stream sent by the proxy client, and a process for the proxy client to send the first live media stream to the client C1.
- This process is the same as the embodiment S26 to S39 in No. 1 are the same, so this embodiment will not repeat them in detail.
- the proxy server obtains the second live media stream from the media server
- the second live media stream is the media stream sent to the client C2
- the role of the client C2 is the backup master user.
- the proxy server caches the second live media stream locally in GOP units, and uses an alignment algorithm to align the first live media stream and the second live media stream.
- the process of aligning the first live media stream and the second live media stream by the proxy server using an alignment algorithm includes: each time an I frame of the first live media stream is received by the proxy server, the I frame is combined with the locally cached I frame.
- the I frames of the second live media stream are compared, and every time an I frame of the second live media stream is received, the I frame is compared with the locally buffered I frame of the first live media stream. If the above comparison process is passed I frames that belong to the first live media stream and the second live media stream and have the same media content are found (hereinafter referred to as I frame a and I frame b respectively), and it is determined that the two live media streams are aligned.
- I frame a and the I frame b are the same video frame. Then determine the switching point according to I frame a and I frame b, that is, determine the last frame of the first live media stream sent to client C2 (hereinafter referred to as switching frame x) and the second live media sent to each client C2
- the first frame of the stream hereinafter referred to as switching frame y
- switching frame x and switching frame y are adjacent frames.
- the nth frame after I frame a in the first live media stream may be determined as the switching frame x
- the n+1th frame after I frame b in the second live media stream may be determined as the switching frame y, where n is An integer greater than or equal to 0, since the I frame a and the I frame b are the same video frame, the nth frame after the I frame a and the n+1th frame after the I frame b are naturally adjacent frames.
- the proxy server locally caches the second live media stream on the proxy server for subsequent use.
- the client C3 enters the live room and requests and obtains the live media stream, which specifically includes:
- the client C3 sends a request message of an accessible media server to the Web server in the RDC. Further, the request message includes: the user name, IP address, live room name of the client C3, the key Token obtained by the client C3 after authentication, and other information, where the IP address is used to determine the location of the client C3 .
- the Web server in the RDC receives the request message, and sends a response message of an accessible media server to the client C3, where the response message is used to inform the client C3 of the media server it can access.
- the Web server in the RDC sends the response message to the proxy server, the proxy server sends the response message to the proxy client, and the proxy client forwards the response message to the client C3.
- the Web server determines the location of the client C3 according to the IP address carried in the request message for accessing the media server sent by the client C3, and selects the media server that is closer to the client C3 as the target media according to the location information server.
- the response message carries relevant information of the target media server, such as URL information, IP address, and port number of the target media server. Therefore, the proxy server and the proxy client obtain the client when forwarding the response message.
- the client C3 sends a third live room request message for requesting to enter the live room to the proxy client.
- the third live room request message indicates that the client C3 requests to enter the live room.
- the third live broadcast room request message includes the user name, IP address, port number, live broadcast room name, and Token obtained after authentication of the client C3.
- the proxy client receives the third live room request message, and sets the client C3 role to a working state.
- update the "user relationship table in the live broadcast room” add a record about the client C3 in the user relationship table in the live broadcast room.
- the recorded content includes: the IP address of the client C3, port number, user status, user name, The IP address and port number of the target media server selected in RDC, the name of the live broadcast room, and other information. Among them, the user status of the client C3 is working.
- the record also includes the identification of the proxy client, such as the IP address and port number of the proxy client.
- the proxy client adds its own identifier to the third live broadcast room request message, and the identifier of the proxy client is the IP address or port number of the proxy client.
- the proxy client sends the third live room request message with the proxy client identifier added to the proxy server, where the modified third live room request message includes: the proxy client's identifier, the client The user name of the terminal C3, the name of the live broadcast room, and the token obtained after authentication.
- the proxy server receives the modified third live room request message, determines the role of the client C3 according to the third request message, and refreshes the user relationship table in the live room. Specifically, determining the role of the client C3 includes: determining whether the number of primary users entering the live broadcast room through the proxy client reaches a preset upper limit when the third live broadcast room request message is received, and if it reaches , It is determined that the role of the client C3 is a servant user; if the preset upper limit is not reached and the number of master users is not 0, the role of the client C3 is determined to be the backup master user. In this embodiment, the preset upper limit is 2. When the client C3 enters the live broadcast room through the proxy client, the number of clients of the current master user is 2, which is equal to the preset upper limit, so it is determined that the role of the client C3 is Servant user.
- the proxy server refreshes the "user relationship table in the live broadcast room", marking the role of the client C3 as a servant user.
- the proxy server sends the third live broadcast room request message to the media server in the RDC.
- the third live broadcast room request message does not include the identifier of the proxy client.
- the media server in the RDC receives the third live room request message, and sends a third live room response message to the client C3, where the third live room response message is used to notify the client C3 that it has successfully entered the live room. Specifically, the media server first sends the third live room response message to the proxy server, and then the proxy server sends the third live room response message to the proxy client, and finally the proxy client sends the third live broadcast The response message is forwarded to the client C3.
- the client C3 sends a third media request message, where the third media request message is used to request the media server to obtain the live media stream.
- the identifier of the client C3 carried in the third media request message is used to uniquely identify the client C3.
- the identifier includes the IP address of the client C3 and the user Name etc.
- the media server After receiving the third media request message, the media server sends a third media response message to the client C3, where the third media response message is used to notify the client C3 that the live media stream is allowed to be obtained. Specifically, the media server forwards the third media response message to the client C3 through the proxy server and the proxy client.
- the proxy client sends the locally cached first live media stream to the client C3. Wherein, before sending the first live media stream, the proxy client also needs to adjust the timestamp of the first live media stream, so that the client C3 receives the first frame of the first live media stream. The timestamp is 0, and the timestamps of adjacent frames of the first live media stream sent to the client C3 are continuous.
- the media server sends a third live media stream to the proxy server, the third live media stream originates from a content source, and the third live media stream is a media stream sent to the client C3.
- the proxy server After receiving the third live media stream, the proxy server does not cache or forward the third live media stream, because the role of the client C3 is a servant user.
- the proxy server receives the first live media stream sent by the media server in real time.
- the proxy server caches the first live media stream locally in the unit of GOP. Among them, the proxy server only caches several latest GOPs locally.
- the proxy server sends the cached first live media stream to the proxy client.
- the proxy client caches the first live media stream locally in a GOP unit.
- S58 The proxy client copies the first live media stream according to the user relationship table between the live broadcasts.
- the proxy client in addition to the client C1 of the main main user, there are also backup main user client C2 and servant user client C3. So make two copies of the first live media stream.
- the proxy client sends the first live media stream to the client C1.
- the proxy client adjusts the timestamp of the first live media stream according to the play time of the client C1.
- the proxy client sends the first live media stream to the client C2.
- it also includes: the proxy client adjusting the time stamp of the first live media stream according to the playing time of the client C2.
- the proxy client sends the first live media stream to the client C3.
- it also includes: the proxy client adjusting the timestamp of the first live media stream according to the playing time of the client C3.
- this embodiment also includes the main main client C1 exiting the live broadcast room process, which is similar to the flow of the client C1 exiting the live broadcast room in the previous example, specifically, as shown in FIG. 8.
- S62 to S65 are the same as S40 to S43 in the first embodiment.
- the proxy server selects the backup primary user client C2 as the new primary primary user, and changes the role of the client C2 from the backup primary user to the primary primary user, and at the same time updates the client C2 in the "live room user relationship table" recording.
- S67 to S73 are the same as S48 to S53 in the first embodiment.
- the media server sends a third live media stream to the proxy server.
- the third live media stream is a media stream sent to the client C3 and originated from the content source. At this time, the role of the client C3 is changed from a servant user to Backup the main user.
- the proxy server switches the first live media stream sent to the client in the live broadcast room (such as client C2) to the second live media stream, and the media server continues to send the media server through the proxy server.
- the client C2 sends the second live media stream, and after switching, the proxy server distributes the second live media stream continuously received to the proxy client. For details, see the subsequent steps.
- the media server sends a second live media stream to the proxy server in real time.
- the second live media stream is the media stream sent to the client C2, and the source is the content source.
- the role of the client C2 is from the backup
- the main user is changed to the main main user.
- the proxy server After receiving the second live media stream, the proxy server locally caches the second live media stream in units of GOPs, and uses an alignment algorithm to align the first live media stream and the second live media stream .
- S78 The proxy server sends the second live media stream to the proxy client.
- the proxy client After receiving the second live media stream sent by the proxy server, the proxy client locally caches the second live media stream in units of GOPs.
- S80 The proxy client copies and distributes the second live media stream according to the "user relationship table in the live broadcast room".
- the second live media stream is copied and is ready to be sent to the role of the backup master in the live broadcast room.
- the proxy client sends the locally cached second live media stream to the client C2.
- the proxy client adjusts the time stamp in the second live media stream according to the time when the client C2 receives the video frame of the media stream.
- the proxy client sends the locally cached second live media stream to the client C3.
- the proxy client adjusts the time stamp in the second live media stream according to the time when the client C3 receives the video frame of the media stream.
- the proxy server when the client C1 of the main main user exits the live broadcast room, the proxy server sends the live media stream of the client C2 of the new main main user to the proxy client, and the proxy client sends the new live media stream to the proxy client.
- the live broadcast media stream is sent to the clients C2 and C3, so as to ensure that when the main main user in the live room exits, the viewing experience of other users in the live room is not affected.
- the proxy server obtains multiple live media streams sent by the media server, and each live media stream corresponds to a media request message from a client.
- the proxy server sends media streams to the proxy client, it only sets the role as the main master.
- a copy of the live media stream corresponding to the user's client is sent to the proxy client.
- the obtained live media stream whose role is the backup master user is cached locally on the proxy server, and the obtained live media stream of the servant user is not cached and directly discarded , So that the proxy server only consumes a portion of bandwidth to transmit the live media stream to the proxy client, saving the WAN network resources between the proxy server and the proxy client.
- the proxy client copies and distributes the live media stream to all clients in the live room, and adjusts the time of each client before sending the live media stream Poke so that all users who enter the live broadcast room through the proxy client can watch the live broadcast content at the same time.
- the method provided in this embodiment also includes the client C2 and the client C1 requesting to exit the live broadcast room at the same time.
- the process of the client C2 requesting to exit the live broadcast room is similar to the aforementioned method for the client C1 to exit the live broadcast room.
- the process is the same as the aforementioned S62 to S73 (as shown in FIG. 8), and will not be described in detail.
- the role of the client C2 is changed from the backup master user to the main master user
- the role of the client C3 is changed from the servant user to the backup master user.
- S73 is the process of client C2 requesting and exiting the live broadcast room, which specifically includes: client C2 sends a request message for exiting the live broadcast room to the proxy client, and the proxy client marks the role of client C2 as the exit user after receiving it, and forwards it.
- the request message for exiting the live broadcast room is sent to the proxy server, and the proxy server refreshes the role of the client C2 as the exit user in the "user relationship table in the live broadcast room" after receiving it.
- the client C3 is still in the live room and obtains the live media stream, and the proxy server receives the third live media stream sent by the media server.
- the third live media stream is the media stream sent to the client C3.
- the role of the client C3 is changed from the backup primary user to the primary primary user, so the proxy server locally caches the third live media stream in units of GOPs.
- the proxy server Since the client C3 in the live room is still watching live content, the proxy server needs to switch the live media stream to the third live media stream, and align the third live media stream with the first live media stream.
- the proxy server sends the third live media stream to the proxy client.
- the proxy client After receiving the third live media stream, the proxy client caches and sends the third live media stream to the client C3, and then The proxy client adjusts the timestamp when sending the third live media stream, so that the third live media stream sent to the client C3 can be seamlessly connected to the previous media stream, so that the clients C1 and C2 are C3 has no impact, thus ensuring the smoothness of watching media content at the client C3 still in the live broadcast room.
- It also includes: when forwarding the response message of the client C2 to exit the live broadcast room, the proxy server and the proxy client delete the record about the client C2 in the "live room user relationship table" so as to update the client information in the live broadcast room in real time.
- Embodiment 1 and Embodiment 2 are for all clients that enter the live broadcast room through the same proxy client, the proxy server identifies the role of each client and distributes the live media stream.
- the proxy server identifies the role of each client and distributes the live media stream.
- multiple proxy clients access the same proxy server.
- the proxy server enters the live broadcast room through multiple proxy clients All the clients of, identify the user role uniformly. For example, in the case of three proxy clients accessing the same proxy server, for all clients in the live broadcast room, uniformly identify the master user and the servant user, and according to the identified role , To send the live media stream to the proxy client.
- the proxy server identifies the user role and sends the live media stream to each proxy client, and the process of each proxy client copying and distributing the live media stream to all the clients it accesses is the same as the foregoing first embodiment and embodiment. The two methods are the same, so I won't repeat them here.
- the video live broadcast bilateral proxy technology utilizes a proxy client and a proxy server, where the proxy server is used to identify the role of each client according to the live room request message, and only send a copy of the live media stream with the main user role
- the proxy client receives the live media stream of the main user and then copies and distributes it to all clients that it accesses.
- This method effectively reduces the traffic of sending media streams between the proxy server and the proxy client, and reduces The export bandwidth is saved, and the resource cost of the WAN network is saved.
- this method does not require the media server to configure a separate authentication to the client, and directly forwards it uniformly through the proxy client, so the operation and maintenance cost is further reduced.
- FIG. 9 is a schematic structural diagram of a media stream sending apparatus provided by an embodiment of this application.
- the apparatus may be the proxy server described in the foregoing embodiment, or may also be a proxy client.
- the device includes a receiving unit 901, a processing unit 902, and a sending unit 903, and may also include other functional modules or units, such as a storage unit.
- the device may be a server, configured to execute the media stream sending method described in the foregoing embodiment, for example, to provide live media streams for at least two clients that enter the live broadcast room through the same proxy client.
- the receiving unit 901 is configured to respectively receive a first live room request message and a second live room request message sent from the same proxy client for requesting to enter the live room, where the The first live broadcast room request message comes from the first client, and the second live broadcast room request message comes from the second client; the receiving unit 901 is further configured to respectively receive the media server sent to the first client through the proxy server The first live media stream and the second live media stream sent to the second client; the processing unit 902 is configured to determine the role of the first client according to the first live room request message, and according to the second The live broadcast room request message determines the role of the second client; the sending unit 903 is configured to, when it is determined that the role of the first client is the master user and the role of the second client is the servant user, only the second client A live media stream is sent to the first client and the second client.
- the processing unit 902 is further configured to request according to the first live room The identifier of the proxy client included in the message, and the identifier of the proxy client included in the second live room request message, it is determined that the first live room request message and the second live room request message are from the same agent Client.
- the processing unit 902 is specifically configured to determine whether there is a proxy client in the live broadcast room when the second live broadcast room request message is received.
- the role entering the live broadcast room is the client of the master user; if it exists, it is determined that the role of the second client is the servant user. Conversely, if the live broadcast room does not exist, it is determined that the role of the second client is the main user.
- the receiving unit 901 is further configured to receive the exit live room sent by the proxy client after sending the first live media stream to the proxy client Request message, the request message for exiting the live broadcast room is used to request the first client to exit the live broadcast room; the processing unit 902 is also used to set the second client as the new primary user The role of the second client is changed from the servant user to the master user, and the first live media stream sent to the second client is switched to the second live media stream.
- the processing unit 902 is further configured to identify according to the first live media stream and the second live media stream that they belong to the first live media stream and all The first I frame and the second I frame of the second live media stream, the first I frame and the second I frame are the same video frame; determined according to the first I frame and the second I frame The first switching frame and the second switching frame that are adjacent and belong to the first live media stream and the second live media stream respectively, and use the first switching frame and the second switching frame as the direction The last frame of the first live media stream sent by the second client and the first frame of the second live media stream sent to the first client; the sending unit 903 is further configured to determine After the first switching frame and the second switching frame, they are also used to forward the request message for exiting the live broadcast room of the first client to the media server.
- the processing unit 902 is specifically configured to determine whether to enter the live broadcast room through the proxy client when the second live broadcast room request message is received. Whether the number of clients in the role of the master user reaches a preset upper limit, the preset upper limit is greater than or equal to 2; if the preset upper limit is reached, it is determined that the role of the second client is a servant user.
- the processing unit 902 determines that the role of the second client is the backup primary user.
- the receiving unit 901 is further configured to receive A request message for exiting the live broadcast room from the first client;
- the processing unit 902 is further configured to change the role of the second client from the servant user when it is determined to use the second client as the new backup master user It is the backup main user;
- the storage unit is used to buffer the received second live media stream in a GOP unit.
- the storage unit also uses The received second live media stream is buffered in GOP units; the processing unit 902 is further configured to identify according to the first live media stream and the buffered second live media stream that they belong to the first live broadcast.
- the receiving unit 901 is further configured to receive a request message for exiting the live broadcast room from the first client; the processing unit 902 is further configured to: When the second client is the new main user, and, according to the first I frame and the second I frame, determine adjacent ones that belong to the first live media stream and the second live media stream respectively A first switching frame and a second switching frame; switching the first live media stream sent to the second client to the second live media stream according to the first switching frame and the second switching frame; wherein , The last frame of the first live media stream sent to the second client is the first switching frame, and the first frame of the second live media stream sent to the first client is The second switching frame.
- the storage unit is configured to cache the first live media stream and the second live media stream in units of GOPs.
- the receiving unit 901 is configured to respectively receive the first live room request message sent by the first client and the second live room request message sent by the second client; the sending unit 903 Is configured to send the first live room request message and the second live room request message to the media server through a proxy server; the receiving unit 901 is further configured to receive the first live media stream sent by the proxy server, the first The live media stream is a media stream sent by the media server to the first client through the proxy server.
- the role of the first client is the master user, and the role of the second client is the servant user; the sending unit 903 also uses Send the first live media stream to the first client and the second client.
- processing unit 902 is configured to add the identifier of the proxy client to the first live broadcast request message before sending the first live broadcast request message, and before sending the second live broadcast request message , Adding the identifier of the proxy client to the second live room request message.
- the processing unit 902 is further configured to mark the role of the first client as a work when the first live broadcast request message is received; In the case of receiving the second live broadcast room request message, mark the role of the second client as work; in the case of receiving the exit live room request message, mark the role of the first client For exit.
- the processing unit 902 is further configured to adjust the first live media stream before sending the first live media stream to the second client. So that the adjusted timestamp satisfies: the timestamp of the first frame of the first live media stream sent to the second client is 0, and all the timestamps sent to the second client The time stamps of adjacent frames of the first live media stream are continuous.
- the receiving unit 901 is further configured to receive the second live media stream sent by the proxy server
- the second live media stream is a media stream sent by the media server to a second client through the proxy client, and the second client is a client whose role is changed from a servant user to a master user; the sending unit 903 also Used to send the second live media stream to the second client.
- the processing unit 902 is further configured to adjust the second live media stream before sending the second live media stream to the second client.
- the time stamp of the stream so that the adjusted time stamp satisfies: the time stamp of the first frame of the second live media stream sent to the second client and the first frame sent to the second client
- the time stamp of the last frame of the live media stream is continuous.
- the present application also provides a network device, which may be the proxy server in the foregoing method embodiment, or the proxy client, or may also be the proxy server in the CDN system Other equipment or devices.
- the network device includes: a transceiver 10, a processor 20, and a memory 30.
- the network device may also include more or fewer components, or a combination of certain components, or a different component arrangement. This application does not Qualify.
- the transceiver 10 is used to receive and send request messages, response messages, live media streams, etc., and perform data transmission with other devices (clients, media servers, etc.) in the network. Further, the transceiver 10 may include components such as a receiver 1001, a transmitter 1002, and an antenna 1003, or may also include a transceiver module. Further, the transceiver module may include a wireless local area network (WLAN) module, Bluetooth Communication modules such as modules, baseband modules, and radio frequency (RF) circuits corresponding to the communication modules are used for wireless local area network communication, Bluetooth communication, infrared communication and/or cellular communication system communication, For example, wideband code division multiple access (WCDMA) and/or high-speed downlink packet access (HSDPA). The transceiver module is used to control the communication of each component in the network device, and can support direct memory access (direct memory access).
- WLAN wireless local area network
- Bluetooth Communication modules such as modules, baseband modules, and radio frequency (RF) circuits corresponding to the communication modules are
- the processor 20 is the control center of the network device, which uses various interfaces and lines to connect various parts of the entire device, and by running or executing software programs and/or units stored in the memory 30, and calling data stored in the memory 30, To perform various functions and various functions of network devices and/or process data.
- the processor 20 can be composed of an integrated circuit (Integrated Circuit, IC), for example, can be composed of a single packaged IC, or can be composed of multiple packaged ICs with the same function or different functions.
- IC integrated Circuit
- the processor may only include a central processing unit (CPU), or it may be a GPU, a digital signal processor (Digital Signal Processor, DSP), and a control chip (such as a baseband chip) in the transceiver. combination.
- CPU central processing unit
- DSP Digital Signal Processor
- control chip such as a baseband chip
- the memory 30 may include a volatile memory (volatile memory), such as random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), such as flash memory (flash memory), Hard disk (Hard Sisk Drive, HDD) or solid-state hard disk (Solid-State Drive, SSD); the storage may also include a combination of the above types of storage.
- volatile memory such as random access memory (Random Access Memory, RAM
- non-volatile memory such as flash memory (flash memory), Hard disk (Hard Sisk Drive, HDD) or solid-state hard disk (Solid-State Drive, SSD); the storage may also include a combination of the above types of storage.
- a program or code may be stored in the memory, and the processor 802 may implement the function of the communication device by executing the program or code.
- the functions of the receiving unit 901 and the sending unit 903 in the device embodiment shown in FIG. 9 may be implemented by the transceiver 10, or controlled by the processor 20.
- the transceiver 10 is implemented; the functions to be implemented by the processing unit 902 may be implemented by the processor 20, and the functions of the storage unit may be implemented by the memory 30.
- the functions of the receiving unit 901 and the sending unit 903 in the device embodiment shown in FIG. 9 may be implemented by the transceiver 10, or implemented by the transceiver 10 controlled by the processor 20;
- the functions to be implemented by the processing unit 902 may be implemented by the processor 20, and the functions of the storage unit may be implemented by the memory 30.
- the embodiment of the present application also provides a media stream sending system.
- the system includes the media stream sending device shown in FIG. 9 or the network device shown in FIG. 10 in the foregoing embodiment, and also includes multiple clients, RDC, EDC, and content source devices to implement the foregoing various embodiments.
- Media streaming method includes the media stream sending device shown in FIG. 9 or the network device shown in FIG. 10 in the foregoing embodiment, and also includes multiple clients, RDC, EDC, and content source devices to implement the foregoing various embodiments.
- Media streaming method includes the media stream sending device shown in FIG. 9 or the network device shown in FIG. 10 in the foregoing embodiment, and also includes multiple clients, RDC, EDC, and content source devices to implement the foregoing various embodiments.
- the media stream sending system is a live video system, such as a CDN system.
- the present application also provides a computer storage medium, wherein the computer storage medium may store a program, and the program may include some or all of the steps in each embodiment of the content sending method and content receiving method provided in the present application when the program is executed.
- the storage medium can be a magnetic disk, an optical disc, a read-only storage memory ROM, or a random storage memory RAM.
- all or part of it may be implemented by software, hardware, firmware or any combination thereof.
- software it can be implemented in the form of a computer program product in whole or in part.
- the computer program product includes one or more computer instructions. When the computer loads and executes the computer program, all or part of the processes or functions described in the foregoing embodiments of the present application are generated.
- the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
- the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
- the computer instructions may be transmitted from a network node, computer, server, or data center. Transmission to another site, computer or server via wired or wireless means.
- the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform.
- the technical solutions in the embodiments of the present invention can be embodied in the form of software products, which can be stored in a storage medium, such as ROM/RAM. , Magnetic disks, optical disks, etc., including a number of instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments of the present invention.
- plural means two or more than two.
- words such as “first” and “second” are used to distinguish the same items or similar items with substantially the same function and effect. Those skilled in the art can understand that words such as “first” and “second” do not limit the quantity and order of execution, and words such as “first” and “second” do not limit the difference.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Description
Claims (37)
- 一种媒体流发送方法,其特征在于,所述方法为进入直播间的客户端提供直播媒体流,所述方法包括:代理服务器分别接收同一代理客户端发送的用于请求进入直播间的第一直播间请求消息和第二直播间请求消息,其中所述第一直播间请求消息来自第一客户端,所述第二直播间请求消息来自第二客户端;所述代理服务器分别接收媒体服务器通过所述代理服务器向所述第一客户端发送的第一直播媒体流和向所述第二客户端发送的第二直播媒体流;所述代理服务器根据所述第一直播间请求消息确定所述第一客户端的角色,并根据所述第二直播间请求消息确定所述第二客户端的角色;所述代理服务器在确定所述第一客户端的角色为主用户、所述第二客户端的角色为仆用户的情况下,仅将所述第一直播媒体流发送给所述代理客户端,以使所述代理客户端将所述第一直播媒体流发送给所述第一客户端和所述第二客户端。
- 根据权利要求1所述的方法,其特征在于,所述第一直播间请求消息中包括代理客户端的标识,和,所述第二直播间请求消息中包括所述代理客户端的标识;所述方法还包括:所述代理服务器根据所述第一直播间请求消息包括的所述代理客户端的标识,和,所述第二直播间请求消息包括的所述代理客户端的标识,确定所述第一直播间请求消息和所述第二直播间请求消息来自同一代理客户端。
- 根据权利要求1或2所述的方法,其特征在于,所述代理服务器根据所述第二直播间请求消息确定所述第二客户端的角色,包括:所述代理服务器确定在接收到所述第二直播间请求消息时,所述直播间中是否存在通过所述代理客户端进入所述直播间的角色为主用户的客户端;如果存在,则确定所述第二客户端的角色是仆用户。
- 根据权利要求3所述的方法,其特征在于,所述代理服务器将所述第一直播媒体流发送给所述代理客户端之后,还包括:所述代理服务器接收代理客户端发送的退出直播间请求消息,所述退出直播间请求消息用于请求所述第一客户端退出所述直播间;所述代理服务器在确定将所述第二客户端作为新的主用户时,将所述第二客户端的角色从所述仆用户变更为主用户;所述代理服务器将向所述第二客户端发送的第一直播媒体流切换为所述第二直播媒体流。
- 根据权利要求4所述的方法,其特征在于,所述代理服务器向所述第二客户端发送的所述第一直播媒体流的最后一帧与向所述第二客户端发送的所述第二直播媒体流的第一帧为相邻帧;所述代理服务器将向所述第二客户端发送的第一直播媒体流切换为所述第二直播媒体流之前,还包括:所述代理服务器根据所述第一直播媒体流和所述第二直播媒体流识别分别属于所述第一直播媒体流和所述第二直播媒体流的第一I帧和第二I帧,所述第一I帧和所述第二I帧为相同视频帧;所述代理服务器根据所述第一I帧和所述第二I帧确定相邻的且分别属于所述第一直播 媒体流和所述第二直播媒体流的第一切换帧和第二切换帧,并将所述第一切换帧和所述第二切换帧分别作为向所述第二客户端发送的所述第一直播媒体流的最后一帧与向所述第一客户端发送的所述第二直播媒体流的第一帧;所述代理服务器在确定所述第一切换帧和所述第二切换帧之后还包括,所述代理服务器将来自所述第一客户端的退出直播间请求消息转发给所述媒体服务器。
- 根据权利要求1或2所述的方法,其特征在于,根据所述第二直播间请求消息确定第二客户端的角色,包括:所述代理服务器在接收到所述第二直播间请求消息时,判断通过所述代理客户端进入所述直播间的角色为主用户的客户端的数量是否达到预设上限,所述预设上限大于等于2;如果达到所述预设上限,则确定所述第二客户端的角色是仆用户。
- 根据权利要求6所述的方法,其特征在于,还包括:如果所述直播间中角色为主用户的客户端的数量不为0,且没有达到所述预设上限,则确定所述第二客户端的角色是备份主用户。
- 根据权利要求6所述的方法,其特征在于,在所述第一客户端是主要主用户,所述第二客户端是仆用户的情况下,还包括:所述代理服务器接收来自所述第一客户端的退出直播间请求消息;所述代理服务器在确定将所述第二客户端作为新的备份主用户时,将所述第二客户端的角色从所述仆用户变更为备份主用户;所述代理服务器以图像组GOP为单位缓存接收的所述第二直播媒体流。
- 根据权利要求7所述的方法,其特征在于,在所述第一客户端是主要主用户,所述第二客户端是备份主用户的情况下,还包括:所述代理服务器以GOP为单位缓存接收的所述第二直播媒体流;所述代理服务器根据所述第一直播媒体流和缓存的所述第二直播媒体流识别分别属于所述第一直播媒体流和所述第二直播媒体流的第一I帧和第二I帧,所述第一I帧和所述第二I帧为相同视频帧。
- 根据权利要求9所述的方法,其特征在于,还包括:所述代理服务器接收来自所述第一客户端的退出直播间请求消息;所述代理服务器在确定将所述第二客户端作为新的主要主用户时,将所述第二客户端的角色从所述备份主用户变更为主要主用户;所述代理服务器根据所述第一I帧和所述第二I帧确定相邻的且分别属于所述第一直播媒体流和所述第二直播媒体流的第一切换帧和第二切换帧;所述代理服务器根据所述第一切换帧和所述第二切换帧将向所述第二客户端发送的第一直播媒体流切换为所述第二直播媒体流,其中,所述代理服务器向所述第二客户端发送的所述第一直播媒体流的最后一帧为所述第一切换帧,向所述第一客户端发送的所述第二直播媒体流的第一帧为所述第二切换帧。
- 根据权利要求1-10任一项所述的方法,其特征在于,还包括:所述代理服务器以GOP为单位缓存所述第一直播媒体流。
- 一种媒体流发送方法,其特征在于,所述方法为进入直播间的客户端提供直播媒体流,所述方法包括:代理客户端分别接收第一客户端发送的用于请求进入直播间的第一直播间请求消息,和,第二客户端发送的用于请求进入所述直播间的第二直播间请求消息;所述代理客户端通过代理服务器向媒体服务器发送所述第一直播间请求消息和所述第二直播间请求消息;所述代理客户端接收所述代理服务器发送的第一直播媒体流,所述第一直播媒体流是所述媒体服务器通过所述代理服务器向所述第一客户端发送的媒体流,所述第一客户端的角色为主用户,所述第二客户端的角色为仆用户;所述代理客户端将所述第一直播媒体流发送给所述第一客户端和所述第二客户端。
- 根据权利要求12所述的方法,其特征在于,所述代理客户端通过代理服务器向媒体服务器发送所述第一直播间请求消息之前还包括:所述代理客户端将所述代理客户端的标识添加到所述第一直播间请求消息中;所述代理客户端通过代理服务器向媒体服务器发送所述第二直播间请求消息之前还包括:所述代理客户端将所述代理客户端的标识添加到所述第二直播间请求消息中。
- 根据权利要求12或13所述的方法,其特征在于,所述代理客户端接收所述代理服务器发送的第一直播媒体流之后,还包括:所述代理客户端以图像组GOP为单位缓存所述第一直播媒体流。
- 根据权利要求12-14任一项所述的方法,其特征在于,所述代理客户端将所述第一直播媒体流发送给所述第二客户端之前,还包括:所述代理客户端调整所述第一直播媒体流的时间戳,使得调整后的时间戳满足:所述代理客户端向所述第二客户端发送的所述第一直播媒体流的第一帧的时间戳为0,并且,向所述第二客户端发送的所述第一直播媒体流的相邻帧的时间戳连续。
- 根据权利要求12-15任一项所述的方法,其特征在于,在所述第一客户端请求退出直播间的情况下,还包括:所述代理客户端接收所述代理服务器发送的第二直播媒体流,所述第二直播媒体流是所述媒体服务器通过所述代理客户端发送给第二客户端的媒体流,所述第二客户端是角色从仆用户变更为主用户的客户端;所述代理客户端将所述第二直播媒体流发送给所述第二客户端。
- 根据权利要求16所述的方法,其特征在于,所述代理客户端将所述第二直播媒体流发送给所述第二客户端之前,还包括:所述代理客户端调整所述第二直播媒体流的时间戳,使得调整后的时间戳满足:所述代理客户端向所述第二客户端发送的所述第二直播媒体流的第一帧的时间戳与向所述第二客户端发送的所述第一直播媒体流的最后一帧的时间戳连续。
- 一种媒体流发送装置,其特征在于,所述装置包括:接收单元,用于分别接收来自同一代理客户端发送的用于请求进入直播间的第一直播间请求消息和第二直播间请求消息,其中所述第一直播间请求消息来自第一客户端,所述第二直播间请求消息来自第二客户端;所述接收单元,还用于分别接收媒体服务器通过代理服务器向所述第一客户端发送的第一直播媒体流和向所述第二客户端发送的第二直播媒体流;处理单元,用于根据所述第一直播间请求消息确定所述第一客户端的角色,并根据所述第二直播间请求消息确定所述第二客户端的角色;发送单元,用于在确定所述第一客户端的角色为主用户、所述第二客户端的角色为仆用户的情况下,仅将所述第一直播媒体流发送给所述代理客户端,以使所述代理客户端将所述第一直播媒体流发送给所述第一客户端和所述第二客户端。
- 根据权利要求18所述的装置,其特征在于,所述第一直播间请求消息中包括代理客户端的标识,和,所述第二直播间请求消息中包括所述代理客户端的标识;处理单元,还用于根据所述第一直播间请求消息包括的所述代理客户端的标识,和,所述第二直播间请求消息包括的所述代理客户端的标识,确定所述第一直播间请求消息和所述第二直播间请求消息来自同一代理客户端。
- 根据权利要求18或19所述的装置,其特征在于,所述处理单元,具体用于确定在接收到所述第二直播间请求消息时,所述直播间中是否存在通过所述代理客户端进入所述直播间的角色为主用户的客户端;如果存在,则确定所述第二客户端的角色是仆用户。
- 根据权利要求20所述的装置,其特征在于,所述接收单元,还用于将所述第一直播媒体流发送给所述代理客户端之后,接收代理客户端发送的退出直播间请求消息,所述退出直播间请求消息用于请求所述第一客户端退出所述直播间;所述处理单元,还用于在确定将所述第二客户端作为新的主用户时,将所述第二客户端的角色从所述仆用户变更为主用户;以及将向所述第二客户端发送的第一直播媒体流切换为所述第二直播媒体流。
- 根据权利要求21所述的装置,其特征在于,向所述第二客户端发送的所述第一直播媒体流的最后一帧与向所述第二客户端发送的所述第二直播媒体流的第一帧为相邻帧;所述处理单元,还用于根据所述第一直播媒体流和所述第二直播媒体流识别分别属于所述第一直播媒体流和所述第二直播媒体流的第一I帧和第二I帧,所述第一I帧和所述第二I帧为相同视频帧;根据所述第一I帧和所述第二I帧确定相邻的且分别属于所述第一直播媒体流和所述第二直播媒体流的第一切换帧和第二切换帧,并将所述第一切换帧和所述第二切换帧分别作为向所述第二客户端发送的所述第一直播媒体流的最后一帧与向所述第一客户端发送的所述第二直播媒体流的第一帧;所述发送单元,还用于在确定所述第一切换帧和所述第二切换帧之后,将来自所述第一客户端的退出直播间请求消息转发给所述媒体服务器。
- 根据权利要求18或19所述的装置,其特征在于,所述处理单元,具体用于在接收到所述第二直播间请求消息时,判断通过所述代理客户端进入所述直播间的角色为主用户的客户端的数量是否达到预设上限,所述预设上限大于等于2;如果达到所述预设上限,则确定所述第二客户端的角色是仆用户。
- 根据权利要求23所述的装置,其特征在于,所述处理单元,还用于在所述直播间中角色为主用户的客户端的数量不为0,且没有达到所述预设上限的情况下,确定所述第二客户端的角色是备份主用户。
- 根据权利要求23所述的装置,其特征在于,还包括存储单元,在所述第一客户端是主要主用户,所述第二客户端是仆用户的情况下,所述接收单元,还用于接收来自所述第一客户端的退出直播间请求消息;所述处理单元,还用于在确定将所述第二客户端作为新的备份主用户时,将所述第二客户端的角色从所述仆用户变更为备份主用户;所述存储单元,用于以图像组GOP为单位缓存接收的所述第二直播媒体流。
- 根据权利要求24所述的装置,其特征在于,还包括存储单元,在所述第一客户端是主要主用户,所述第二客户端是备份主用户的情况下,所述存储单元,用于以GOP为单位缓存接收的所述第二直播媒体流;所述处理单元,还用于根据所述第一直播媒体流和缓存的所述第二直播媒体流识别分别属于所述第一直播媒体流和所述第二直播媒体流的第一I帧和第二I帧,所述第一I帧和所述第二I帧为相同视频帧。
- 根据权利要求26所述的装置,其特征在于,所述接收单元,还用于接收来自所述第一客户端的退出直播间请求消息;所述处理单元,还用于在确定将所述第二客户端作为新的主要主用户时,将所述第二客户端的角色从所述备份主用户变更为主要主用户,以及,根据所述第一I帧和所述第二I帧确定相邻的且分别属于所述第一直播媒体流和所述第二直播媒体流的第一切换帧和第二切换帧;根据所述第一切换帧和所述第二切换帧将向所述第二客户端发送的第一直播媒体流切换为所述第二直播媒体流;其中,向所述第二客户端发送的所述第一直播媒体流的最后一帧为所述第一切换帧,向所述第一客户端发送的所述第二直播媒体流的第一帧为所述第二切换帧。
- 根据权利要求18-27任一项所述的装置,其特征在于,还包括:存储单元,用于以GOP为单位缓存所述第一直播媒体流。
- 一种媒体流发送装置,其特征在于,所述装置包括:接收单元,用于分别接收第一客户端发送的用于请求进入直播间的第一直播间请求消息,和,第二客户端发送的用于请求进入所述直播间的第二直播间请求消息;发送单元,用于通过代理服务器向媒体服务器发送所述第一直播间请求消息和所述第二直播间请求消息;所述接收单元,还用于接收所述代理服务器发送的第一直播媒体流,所述第一直播媒体流是所述媒体服务器通过所述代理服务器向所述第一客户端发送的媒体流,所述第一客户端的角色为主用户,所述第二客户端的角色为仆用户;所述发送单元,还用于将所述第一直播媒体流发送给所述第一客户端和所述第二客户端。
- 根据权利要求29所述的装置,其特征在于,还包括处理单元,所述处理单元,用于在发送所述第一直播间请求消息之前,将代理客户端的标识添加到所述第一直播间请求消息中,和,在发送所述第二直播间请求消息之前,将所述代理客户端的标识添加到所述第二直播间请求消息中。
- 根据权利要求29或30所述的装置,其特征在于,还包括存储单元,所述存储单元,用于以图像组GOP为单位缓存所述第一直播媒体流。
- 根据权利要求29-31任一项所述的装置,其特征在于,处理单元,用于将所述第一直播媒体流发送给所述第二客户端之前,调整所述第一直播媒体流的时间戳,使得调整后的时间戳满足:向所述第二客户端发送的所述第一直播媒体流的第一帧的时间戳为0,并且,向所述第二客户端发送的所述第一直播媒体流的相邻帧的时间戳连续。
- 根据权利要求29-32任一项所述的装置,其特征在于,在所述第一客户端请求退出直播间的情况下,所述接收单元,还用于接收所述代理服务器发送的第二直播媒体流,所述第二直播媒体流是所述媒体服务器通过所述代理客户端发送给第二客户端的媒体流,所述第二客户端是角色从仆用户变更为主用户的客户端;所述发送单元,还用于将所述第二直播媒体流发送给所述第二客户端。
- 根据权利要求33所述的装置,其特征在于,所述处理单元,还用于将所述第二直播媒体流发送给所述第二客户端之前,调整所述第二直播媒体流的时间戳,使得调整后的时间戳满足:向所述第二客户端发送的所述第二直播媒体流的第一帧的时间戳与向所述第二客户端发送的所述第一直播媒体流的最后一帧的时间戳连续。
- 一种媒体流发送系统,其特征在于,所述系统包括至少一个客户端、代理客户端、代理服务器和媒体服务器,其中每个所述客户端通过所述代理客户端接入直播间;所述代理客户端用于执行如权利要求12至17任一项所述媒体流发送方法;所述代理服务器用于执行如权利要求1至11任一项所述媒体流发送方法。
- 一种网络设备,包括处理器,所述处理器与存储器耦合,其特征在于,所述存储器,用于存储指令;所述处理器,用于执行所述存储器中的指令,使得所述网络设备执行如权利要求1至17中任一项所述的方法。
- 一种计算机可读存储介质,所述存储介质中存储有指令,其特征在于,当所述指令被运行时,实现如权利要求1至17中任一项所述的方法。
Priority Applications (5)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020217021677A KR102457526B1 (ko) | 2019-04-23 | 2020-04-23 | 미디어 스트림 송신 방법, 장치, 시스템, 및 디바이스 |
JP2021542510A JP7259056B2 (ja) | 2019-04-23 | 2020-04-23 | メディアストリーム送信方法、装置、システム、およびデバイス |
EP20796076.6A EP3890265B1 (en) | 2019-04-23 | 2020-04-23 | Media stream sending method, apparatus, device and system |
US17/369,580 US11330028B2 (en) | 2019-04-23 | 2021-07-07 | Media stream sending method, apparatus, system, and device |
US17/675,236 US11848973B2 (en) | 2019-04-23 | 2022-02-18 | Media stream sending method, apparatus, system and device |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910330890.5 | 2019-04-23 | ||
CN201910330890.5A CN111835697B (zh) | 2019-04-23 | 2019-04-23 | 一种媒体流发送方法、装置、设备和系统 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/369,580 Continuation US11330028B2 (en) | 2019-04-23 | 2021-07-07 | Media stream sending method, apparatus, system, and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020216277A1 true WO2020216277A1 (zh) | 2020-10-29 |
Family
ID=72912479
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/086335 WO2020216277A1 (zh) | 2019-04-23 | 2020-04-23 | 一种媒体流发送方法、装置、设备和系统 |
Country Status (6)
Country | Link |
---|---|
US (2) | US11330028B2 (zh) |
EP (1) | EP3890265B1 (zh) |
JP (1) | JP7259056B2 (zh) |
KR (1) | KR102457526B1 (zh) |
CN (1) | CN111835697B (zh) |
WO (1) | WO2020216277A1 (zh) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114760485B (zh) * | 2021-01-08 | 2023-09-26 | 深圳市酷看文化传播有限公司 | 视频轮播方法、系统及相关设备 |
CN113535063A (zh) * | 2021-08-12 | 2021-10-22 | 腾讯音乐娱乐科技(深圳)有限公司 | 直播页面切换方法、视频页面切换方法、电子设备及存储介质 |
US11824914B1 (en) * | 2022-11-15 | 2023-11-21 | Motorola Solutions, Inc. | System and method for streaming media to a public safety access point without incurring additional user costs |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105307010A (zh) * | 2015-11-14 | 2016-02-03 | 华中科技大学 | 一种云视频直播平台的视频上传系统及方法 |
CN105763832A (zh) * | 2014-12-16 | 2016-07-13 | 中国移动通信集团公司 | 一种视频互动、控制方法及装置 |
CN107332894A (zh) * | 2017-06-23 | 2017-11-07 | 广州市百果园信息技术有限公司 | 直播方法、装置及系统、服务器、存储介质 |
WO2018219048A1 (zh) * | 2017-05-31 | 2018-12-06 | 华为技术有限公司 | 一种直播方法、系统以及相关设备 |
CN109005204A (zh) * | 2017-06-07 | 2018-12-14 | 腾讯科技(深圳)有限公司 | 一种直播处理方法、装置及系统 |
Family Cites Families (29)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH1063598A (ja) * | 1996-08-22 | 1998-03-06 | Nippon Telegr & Teleph Corp <Ntt> | マルチキャスト通信方法及びマルチキャスト通信システムと、マルチキャスト通信用サーバ |
US7031348B1 (en) * | 1998-04-04 | 2006-04-18 | Optibase, Ltd. | Apparatus and method of splicing digital video streams |
US6966009B1 (en) * | 2001-08-28 | 2005-11-15 | Tellabs Operations, Inc. | System and method for aligning data in a network environment |
US6842825B2 (en) * | 2002-08-07 | 2005-01-11 | International Business Machines Corporation | Adjusting timestamps to preserve update timing information for cached data objects |
JP2006352648A (ja) * | 2005-06-17 | 2006-12-28 | Nippon Telegr & Teleph Corp <Ntt> | カメラ映像配信方法およびシステム |
CN100563235C (zh) * | 2006-01-09 | 2009-11-25 | 华为技术有限公司 | 互通功能网元、csi终端与ims终端互通系统及其方法 |
JP2008193500A (ja) * | 2007-02-06 | 2008-08-21 | Canon Inc | データ送信装置及びデータ中継装置 |
JP5353277B2 (ja) * | 2009-02-06 | 2013-11-27 | 日本電気株式会社 | ストリーム信号伝送装置及び伝送方法 |
US8516253B1 (en) * | 2010-01-18 | 2013-08-20 | Viasat, Inc. | Self-keyed protection of anticipatory content |
JP2013058817A (ja) * | 2011-09-06 | 2013-03-28 | Onkyo Corp | コンテンツ再生システム |
CN102780916B (zh) * | 2012-04-12 | 2015-03-18 | 天脉聚源(北京)传媒科技有限公司 | 一种视频直播流汇聚分发方法 |
CN104168300B (zh) * | 2013-05-17 | 2017-06-27 | 中国电信股份有限公司 | 内容加速方法与系统 |
US9674251B2 (en) * | 2013-06-17 | 2017-06-06 | Qualcomm Incorporated | Mediating content delivery via one or more services |
EP3031218B1 (en) * | 2013-08-09 | 2017-06-28 | Sonova AG | Hearing assistance system and method |
US10044827B1 (en) * | 2014-11-13 | 2018-08-07 | Amazon Technologies, Inc. | Trigger-based session service cache population |
CN106302566B (zh) * | 2015-05-12 | 2019-07-23 | 华为技术有限公司 | 直播媒体数据的方法、设备和系统 |
CN106502554B (zh) * | 2015-09-08 | 2021-09-17 | 腾讯科技(深圳)有限公司 | 一种显示控制方法及装置 |
CN105141971B (zh) * | 2015-09-16 | 2018-08-28 | 深圳市前海智媒网络科技有限公司 | 一种基于会话初始化协议实现直播的方法及系统 |
US20170134825A1 (en) * | 2015-11-09 | 2017-05-11 | Le Holdings (Beijing) Co., Ltd. | Method and device for processing panoramic live broadcast video resources |
CN105959772B (zh) * | 2015-12-22 | 2019-04-23 | 合一网络技术(北京)有限公司 | 流媒体与字幕即时同步显示、匹配处理方法、装置及系统 |
JP6394620B2 (ja) * | 2016-02-04 | 2018-09-26 | 日本電気株式会社 | サーバ管理システム、サーバ、サーバ管理方法およびサービスプロセッサ |
US20180012192A1 (en) * | 2016-07-08 | 2018-01-11 | Cisco Technology, Inc. | User experiences in personal meeting rooms |
CN107343220B (zh) * | 2016-08-19 | 2019-12-31 | 北京市商汤科技开发有限公司 | 数据处理方法、装置和终端设备 |
CN106507161B (zh) * | 2016-11-29 | 2019-11-15 | 腾讯科技(深圳)有限公司 | 视频直播方法及直播装置 |
US10687093B2 (en) * | 2016-12-30 | 2020-06-16 | Social Media Broadcaster, Inc. | Social-media-based TV show production, distribution, and broadcast system |
US10638192B2 (en) * | 2017-06-19 | 2020-04-28 | Wangsu Science & Technology Co., Ltd. | Live streaming quick start method and system |
CN107896337B (zh) * | 2017-11-30 | 2020-12-22 | 广州酷狗计算机科技有限公司 | 信息推广方法、装置及存储介质 |
CN109639635B (zh) * | 2018-11-05 | 2019-09-03 | 北京达佳互联信息技术有限公司 | Cdn代理拉流方法、服务器、cdn及客户端 |
CN109547812A (zh) * | 2019-01-22 | 2019-03-29 | 广州虎牙信息科技有限公司 | 一种直播方法、装置、移动终端与存储介质 |
-
2019
- 2019-04-23 CN CN201910330890.5A patent/CN111835697B/zh active Active
-
2020
- 2020-04-23 JP JP2021542510A patent/JP7259056B2/ja active Active
- 2020-04-23 KR KR1020217021677A patent/KR102457526B1/ko active IP Right Grant
- 2020-04-23 WO PCT/CN2020/086335 patent/WO2020216277A1/zh unknown
- 2020-04-23 EP EP20796076.6A patent/EP3890265B1/en active Active
-
2021
- 2021-07-07 US US17/369,580 patent/US11330028B2/en active Active
-
2022
- 2022-02-18 US US17/675,236 patent/US11848973B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105763832A (zh) * | 2014-12-16 | 2016-07-13 | 中国移动通信集团公司 | 一种视频互动、控制方法及装置 |
CN105307010A (zh) * | 2015-11-14 | 2016-02-03 | 华中科技大学 | 一种云视频直播平台的视频上传系统及方法 |
WO2018219048A1 (zh) * | 2017-05-31 | 2018-12-06 | 华为技术有限公司 | 一种直播方法、系统以及相关设备 |
CN109005204A (zh) * | 2017-06-07 | 2018-12-14 | 腾讯科技(深圳)有限公司 | 一种直播处理方法、装置及系统 |
CN107332894A (zh) * | 2017-06-23 | 2017-11-07 | 广州市百果园信息技术有限公司 | 直播方法、装置及系统、服务器、存储介质 |
Non-Patent Citations (1)
Title |
---|
See also references of EP3890265A4 * |
Also Published As
Publication number | Publication date |
---|---|
US11848973B2 (en) | 2023-12-19 |
KR20210100176A (ko) | 2021-08-13 |
CN111835697A (zh) | 2020-10-27 |
CN111835697B (zh) | 2021-10-01 |
EP3890265B1 (en) | 2023-04-26 |
EP3890265A4 (en) | 2022-04-20 |
US20210337001A1 (en) | 2021-10-28 |
JP7259056B2 (ja) | 2023-04-17 |
US11330028B2 (en) | 2022-05-10 |
EP3890265A1 (en) | 2021-10-06 |
KR102457526B1 (ko) | 2022-10-20 |
US20220174104A1 (en) | 2022-06-02 |
JP2022517854A (ja) | 2022-03-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020216279A1 (zh) | 一种媒体流发送方法、装置和设备 | |
WO2020216277A1 (zh) | 一种媒体流发送方法、装置、设备和系统 | |
US11095701B2 (en) | Method and apparatus for providing adaptive streaming service | |
US9769236B2 (en) | Combined broadcast and unicast delivery | |
JP5588517B2 (ja) | データセグメントのオプションのブロードキャスト配信によるストリーミング | |
WO2017096935A1 (zh) | 一种快速频道切换方法、服务器及iptv系统 | |
US11863841B2 (en) | Video playing control method and system | |
WO2017125017A1 (zh) | 缓存内容的调整方法、装置及系统 | |
US9813475B1 (en) | Delivering a video stream | |
WO2015042962A1 (en) | System and method of a link surfed http live streaming broadcasting system | |
US20220295127A1 (en) | Consolidating content streams to conserve bandwidth | |
CN103841468A (zh) | 实时流媒体数据传输方法 | |
WO2020135562A1 (zh) | 一种组播方法、装置、设备和计算机存储介质 | |
KR20110129064A (ko) | 콘텐트 가상 세그멘테이션 방법과, 이를 이용한 스트리밍 서비스 제공 방법 및 시스템 | |
JP2018098569A (ja) | データ配信システム、通信端末、及びプログラム | |
JP6009501B2 (ja) | データセグメントのオプションのブロードキャスト配信によるストリーミング |
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: 20796076 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2020796076 Country of ref document: EP Effective date: 20210629 |
|
ENP | Entry into the national phase |
Ref document number: 20217021677 Country of ref document: KR Kind code of ref document: A |
|
ENP | Entry into the national phase |
Ref document number: 2021542510 Country of ref document: JP Kind code of ref document: A |
|
NENP | Non-entry into the national phase |
Ref country code: DE |