WO2017071228A1 - 基于hls协议的直播方法、系统及客户端 - Google Patents

基于hls协议的直播方法、系统及客户端 Download PDF

Info

Publication number
WO2017071228A1
WO2017071228A1 PCT/CN2016/085110 CN2016085110W WO2017071228A1 WO 2017071228 A1 WO2017071228 A1 WO 2017071228A1 CN 2016085110 W CN2016085110 W CN 2016085110W WO 2017071228 A1 WO2017071228 A1 WO 2017071228A1
Authority
WO
WIPO (PCT)
Prior art keywords
slice
downloaded
subserver
timestamp information
pts
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2016/085110
Other languages
English (en)
French (fr)
Inventor
郑吉剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Le Holdings Beijing Co Ltd
Leshi Zhixin Electronic Technology Tianjin Co Ltd
Original Assignee
Le Holdings Beijing Co Ltd
Leshi Zhixin Electronic Technology Tianjin Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Le Holdings Beijing Co Ltd, Leshi Zhixin Electronic Technology Tianjin Co Ltd filed Critical Le Holdings Beijing Co Ltd
Priority to US15/120,244 priority Critical patent/US20180227648A1/en
Publication of WO2017071228A1 publication Critical patent/WO2017071228A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/61Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
    • H04L65/611Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio for multicast or broadcast
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/65Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/80Responding to QoS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/10Streamlined, light-weight or high-speed protocols, e.g. express transfer protocol [XTP] or byte stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/858Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/858Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot
    • H04N21/8586Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot by using a URL

Definitions

  • the invention relates to the field of network communication technologies, in particular to a live broadcast method, system and client based on the HLS protocol.
  • the Content Delivery Network is a new way of building networks. It relies on distributed edge servers deployed in the local area, through the load balancing, content distribution, scheduling and other functional modules of the central platform, enabling users to obtain the required content, reduce network congestion, and improve user access response speed and hit rate.
  • the basic idea of CDN is to avoid the bottlenecks and links on the Internet that may affect the speed and stability of data transmission, so that content transmission is faster and more stable.
  • the purpose is to enable users to obtain the required content in the vicinity, solve the congestion of the Internet network, and improve the response speed of users visiting the website.
  • the CDN adopts policies such as load balancing and local caching to make it easier for customers to obtain resources from the local server and avoid network congestion in the whole network.
  • CDN has a wide range of applications in video distribution and other fields.
  • the basic principle of CDN is to widely use various cache servers to distribute these cache servers to areas or networks where users are relatively concentrated. When users visit websites, they use global load technology to point users' access to the closest working cache. On the server, the cache server directly responds to user requests.
  • the key technologies of the CDN are mainly content storage and distribution technologies.
  • HLS Http live streaming protocol
  • http Hypertext Transfer Protocol
  • the HLS protocol divides large-capacity and continuous media data into segments and divides them into a large number of small files for delivery.
  • the file transferability of the web server, and the use of a constantly updated lightweight index file to control the download and playback of the divided small media files, can achieve live and on-demand streaming media.
  • the video data is processed and divided into video program slices TS (Transport) Stream transport stream file and media data index M3U8 file
  • M3U8 file refers to M3U file in UTF-8 encoding format, M3U file records an index plain text file.
  • the M3U8 file usually includes multiple Uniform Resource Locator URLs (Uniform Resource Locator).
  • URLs Uniform Resource Locator
  • CDN acceleration technology is widely used in live broadcast and on-demand video.
  • CDN and HLS protocol to realize live and on-demand video content is the most common video viewing mode.
  • the live broadcast program usually uses a redirection technology to hide a specific code stream URL address, and is implemented by a method in which the master server's Master URL address is matched with each of the distribution sub-servers' Sub-URL addresses, for example:
  • the user client first gets a Master URL.
  • the user client requests this Master URL from the primary server.
  • the primary server distributes a new Sub URL of the child server B to the user client according to the geographical situation of the user client, and records it as a URLb.
  • the user client obtains the live program M3U8 index list from the server through the URLb.
  • the client parses the M3U8 index list and downloads a specific program stream slice.
  • the M3U8 index list only contains 3 recent slices in the live broadcast situation, and the user client needs to periodically update the M3U8 list, so the client will return to step 2 to periodically update the M3U8 list and download new slices. Repeat steps 2-5 continuously.
  • the CDN will redirect the user's request to the new sub-server H through the balanced load to obtain a new URLb.
  • the CDN server cannot guarantee the consistency of the stream stream slice distribution of different sub-servers. Therefore, in live programs, program jumpback or program slice loss often occurs. As a result, the user cannot smoothly watch the live program, which reduces the user experience.
  • the purpose of the present invention is to propose a live broadcast method and system based on the HLS protocol. And the client, solves the problem that the program jumps back or the program slice is lost when the user watches the live program.
  • the present invention provides a live broadcast method based on the HLS protocol.
  • the method includes: downloading an M3U8 index list from a sub-server based on an HLS protocol live broadcast process, and downloading a slice of the program resource according to the M3U8 index list for playing. Wherein, when the primary server is to reassign another child server, download the M3U8 index list and the slice of the program resource from the newly allocated child server;
  • the PTS timestamp information in the slice downloaded from the new subserver is compared with the PTS timestamp information in the slice downloaded from the original subserver, and it is determined according to the comparison result that the currently downloaded program resource slice is played or not.
  • the determining, according to the comparison result, that the currently updated downloaded program resource slicing process comprises: if the PTS timestamp information in the slice downloaded from the new subserver is earlier than or equal to the original subserver
  • the PTS timestamp information in the downloaded slice determines that the newly downloaded slice already exists locally, and selects the PTS timestamp in the next newly downloaded slice to continue to perform comparison with the PTS timestamp in the slice downloaded from the original subserver.
  • the step of determining whether to play or not to play the currently downloaded program resource according to the comparison result includes: if the PTS timestamp information in the slice downloaded from the new subserver is later than the slice downloaded from the original subserver In the PTS timestamp information, the current newly downloaded program resource slice is played.
  • the process of comparing the PTS timestamp information in the slice downloaded from the new subserver with the PTS timestamp information in the slice downloaded from the original subserver includes: selecting the PTS of the slice with the smallest M3U8 index number from the newly acquired slice The timestamp information is compared with the PTS timestamp information of the slice with the largest M3U8 index number downloaded from the original subserver; if the PTS timestamp information in the slice downloaded from the new subserver is earlier than or equal to the original subserver The PTS timestamp information in the downloaded slice is sequentially selected according to the M3U8 index number in the order of small to large, and the PTS timestamp in the next newly downloaded slice is continuously executed and compared with the PTS timestamp in the slice downloaded from the original subserver. A step of.
  • the determining, if the PTS timestamp information in the slice downloaded from the new subserver is later than the PTS timestamp information in the slice downloaded from the original subserver further comprising: determining the new The PTS timestamp information in the slice downloaded by the subserver is larger than the original Whether the time interval of the PTS timestamp information in the slice downloaded by the sub-server exceeds the preset time threshold, and if so, the current newly downloaded program resource slice is not played, otherwise the slice corresponding to the PTS timestamp information is played.
  • the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver by a preset time threshold, include:
  • a live broadcast system based on the HLS protocol is also provided.
  • the system includes:
  • a sub-server for providing an M3U8 index list of live programs and a slice of program resources
  • a primary server configured to reassign a child server to the client
  • a client configured to download a slice of the M3U8 index list and the program resource from the newly allocated sub-server; parse the program resource slice downloaded from the new sub-server, obtain the PTS timestamp information; and download the slice from the new sub-server
  • the PTS timestamp information is compared with the PTS timestamp information in the slice downloaded from the original subserver, and it is determined according to the comparison result that the currently downloaded program resource slice is played or not.
  • the client is further configured to: after determining that the PTS timestamp information in the slice downloaded from the new subserver is earlier than or equal to the PTS timestamp information in the slice downloaded from the original subserver, Determining that the newly downloaded slice already exists locally, selecting a PTS timestamp in the next newly downloaded slice to continue performing the step of comparing with the PTS timestamp in the local slice;
  • And/or the client further configured to: determine that the PTS timestamp information in the slice downloaded from the new subserver is later than the PTS timestamp information in the slice downloaded from the original subserver After that, the currently downloaded program resource slice is played.
  • the client is further configured to select, from the slice downloaded by the new sub-server, the PTS timestamp information of the slice with the smallest M3U8 index number and the PTS timestamp information of the slice with the largest M3U8 index number downloaded from the original sub-server. If the PTS timestamp information in the slice downloaded from the new subserver is earlier than or equal to the PTS timestamp information in the slice downloaded from the original subserver, then the M3U8 index number is selected in order from small to large. The PTS timestamp in the next newly downloaded slice continues the process of comparing with the PTS timestamp in the slice downloaded from the original subserver.
  • the client is further configured to determine whether a time interval in which the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver exceeds a pre Set the time threshold, if yes, play the current newly downloaded program resource slice temporarily, otherwise play the slice corresponding to the PTS timestamp information.
  • the client is further configured to request, by the newly allocated sub-server, to download an M3U8 index list with a smaller M3U8 serial number and a slice of the program resource, and repeat the slice that the client downloads from the new sub-server.
  • the step of comparing the PTS timestamp information in the PTS timestamp information in the slice downloaded from the original subserver until the newly acquired PTS timestamp information is different from the PTS timestamp information in the slice downloaded from the original subserver The time interval does not exceed the preset time threshold, and the slice corresponding to the PTS timestamp information is played.
  • the client downloads the slice of the program resource from the sub-server
  • the M3U8 index list and the slice of the program resource are directly downloaded to the current sub-server next time; otherwise, the request to the main server is resumed. Assign another subserver.
  • a client based on the HLS protocol includes an address obtaining unit, a video requesting unit, a slice downloading unit, and a playing judging unit connected in sequence;
  • An address obtaining unit configured to obtain an address of the program video main server, and send a request for acquiring a program video to the main server according to the address of the main server;
  • a video requesting unit configured to send a program resource request to the sub-server according to an address of the sub-server and a HLS protocol allocated by the main server;
  • a slice downloading unit configured to download an M3U8 index list from the sub-server; wherein, when the main server reassigns another sub-server to the client, the slice download unit re-assigns the newly-assigned sub-service
  • the server downloads the M3U8 index list and the slice of the program resource; parses the downloaded program resource slice to obtain the PTS timestamp information;
  • a play judging unit configured to download a slice of the program resource according to the M3U8 index list for playing; wherein, when the program resource slice is downloaded from another sub-server that is re-allocated, the play judging unit: PTS in the slice downloaded from the new sub-server The timestamp information is compared with the PTS timestamp information in the slice downloaded from the original subserver, and it is determined according to the comparison result that the currently downloaded program resource slice is played or not.
  • the determining, by the play determining unit, determining whether to play or not playing the currently downloaded program resource slice according to the comparison result includes: if the PTS timestamp information in the slice downloaded from the new subserver is earlier than or equal to the The PTS timestamp information in the slice downloaded from the original subserver determines that the newly downloaded slice already exists locally, and selects the PTS timestamp in the next newly downloaded slice to continue to execute in the slice downloaded from the original subserver.
  • the process of comparing the PTS timestamp information in the slice downloaded from the new subserver with the PTS timestamp information in the slice downloaded from the original subserver includes: the client renews the new sub The PTS timestamp information of the slice with the smallest M3U8 index number selected by the server is compared with the PTS timestamp information of the slice with the largest M3U8 index number downloaded from the original subserver; if the slice is downloaded from the new subserver The PTS timestamp information is earlier than or equal to the PTS timestamp information in the slice downloaded from the original subserver, and the PTS timestamp in the next newly downloaded slice is sequentially selected according to the M3U8 index number from small to large.
  • the step of performing a comparison with the PTS timestamp in the local slice includes: the client renews the new sub The PTS timestamp information of the slice with the smallest M3U8 index number selected by the server is compared with the PTS timestamp information of the slice with the largest M3U8 index number downloaded from the original sub
  • the play determining unit determines that if the PTS timestamp information in the slice downloaded from the new subserver is later than the PTS timestamp information in the slice downloaded from the original subserver, the method further includes: determining the location Whether the time interval of the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver exceeds a preset time threshold, and if so, the current time is not played. Newly downloaded program resources cut Slice, otherwise play the slice corresponding to the PTS timestamp information.
  • the play determining unit determines that a time interval in which the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver exceeds a preset time threshold. After that, it also includes:
  • the client requests the newly allocated sub-server to download the M3U8 index list with smaller M3U8 serial number and the slice of the program resource, and repeats the PTS timestamp information in the slice downloaded by the client from the new sub-server from the original
  • the step of comparing the PTS timestamp information in the slice downloaded by the subserver until the time interval of the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver The preset corresponding time threshold is not exceeded, and the slice corresponding to the PTS timestamp information is played.
  • the download judging unit downloads the slice of the program resource from the sub-server, if the download process is normal, the M3U8 index list and the slice of the program resource are directly downloaded to the current sub-server next time; otherwise, the request is sent to the main server. Reassign another child server.
  • an apparatus including:
  • One or more processors are One or more processors;
  • a memory for storing operational instructions
  • the one or more processors are configured to retrieve an operational instruction from the memory and execute:
  • the PTS timestamp information in the slice downloaded from the new subserver is compared with the PTS timestamp information in the slice downloaded from the original subserver, and it is determined according to the comparison result that the currently downloaded program resource slice is played or not.
  • the processor is further configured to: determine, according to the comparison result, that the currently new downloaded program resource slice process is played or not: if the PTS timestamp information in the slice downloaded from the new subserver is early At or equal to the PTS in the slice downloaded from the original subserver Substamp information, determining that the newly downloaded slice already exists locally, selecting a PTS timestamp in the next newly downloaded slice to continue the step of comparing with the PTS timestamp in the slice downloaded from the original subserver; and/or
  • the determining, according to the comparison result, that the currently downloaded program resource slice process is played or not includes: if the PTS timestamp information in the slice downloaded from the new subserver is later than the PTS timestamp information in the slice downloaded from the original subserver , the current newly downloaded program resource slice is played.
  • the processor is further configured to: compare the PTS timestamp information in the slice downloaded from the new subserver with the PTS timestamp information in the slice downloaded from the original subserver, including: acquiring the slice newly Comparing the PTS timestamp information of the slice with the smallest M3U8 index number to the PTS timestamp information of the slice with the largest M3U8 index number downloaded from the original subserver; if the PTS timestamp information in the slice downloaded from the new subserver If the PTS timestamp information in the slice downloaded from the original subserver is earlier than or equal to the PTS timestamp in the next newly downloaded slice in the order of the M3U8 index number, the PTS timestamp in the next newly downloaded slice is sequentially executed and the original subroutine is executed. The step of comparing the PTS timestamps in the slice downloaded by the server.
  • the processor is further configured to: determine, if the PTS timestamp information in the slice downloaded from the new subserver is later than the PTS timestamp information in the slice downloaded from the original subserver Thereafter, the method further includes: determining whether a time interval in which the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver exceeds a preset time threshold, and if so, Then, the currently downloaded program resource slice is not played, otherwise the slice corresponding to the PTS timestamp information is played.
  • the processor is further configured to: if it is determined that the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver After the interval exceeds the preset time threshold, it also includes:
  • the processor is further configured to: download a slice of the program resource from the sub server each time Then, if the download process is normal, the M3U8 index list and the slice of the program resource are downloaded directly to the current sub-server next time; otherwise, the main server is requested to re-allocate another sub-server.
  • the HLS protocol-based live broadcast method, system, and client provided by the embodiment of the present invention actively forward to the client when the primary server redirects the client to another child server.
  • the newly allocated sub-server obtains the program slice for parsing, and obtains the PTS timestamp information therein, and compares it with the PTS timestamp information in the locally downloaded program resource slice, thereby determining whether the program slice is It has been played repeatedly. Therefore, in the prior art, the M3U8 index sequence number between different sub-servers is not comparable, so that the CDN server cannot guarantee the consistency of the code stream slice distribution of the different sub-servers, and avoids the program jumping back during the live broadcast process. The occurrence of the game optimizes the effect of watching live programs.
  • FIG. 1 is a schematic flowchart of a live broadcast method based on an HLS protocol according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a live broadcast method based on an HLS protocol according to an embodiment of the present invention
  • FIG. 3 is a timing diagram of a live broadcast method based on an HLS protocol according to another embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a live client based on an HLS protocol according to an embodiment of the present invention.
  • the client downloads to the subserver through the M3U8 index sequence table. Corresponding program slice.
  • the index numbers of the corresponding program slices in the M3U8 index list of the same live program stored by different sub-servers are different, there is no comparability, so when the main server redirects the client to a new sub-server, it tends to Causes the program slice to be downloaded repeatedly, or the slice is lost.
  • the present invention considers that although the program slice index numbers between different sub-servers are different, the content of the program slice is the same, and the PTS time stamp information in the program slice is comparable, so the idea of the present invention is During the process of redirecting the sub-server, the parsing of the first downloaded program slice in the new sub-server is added, and the parsed PTS timestamp information is compared with the timestamp information in the program slice originally downloaded by the client, thereby determining Whether the program slice is repeatedly downloaded, or the slice is lost.
  • FIG. 1 is a schematic flowchart of a live broadcast method based on an HLS protocol according to a first embodiment of the present invention, where the live broadcast method based on the HLS protocol includes:
  • Step 101 During the live broadcast of the client based on the HLS protocol, the client downloads the M3U8 index list from the sub-server, and downloads the slice of the program resource according to the M3U8 index list for playing.
  • Step 102 After the primary server reassigns another subserver to the client, the client downloads the M3U8 index list from the newly allocated subserver, and downloads a slice of the program resource according to the M3U8 index list.
  • Step 103 The client parses a program resource slice downloaded from a new sub-server to obtain PTS timestamp information.
  • the video data saved from the sub-server includes: a video program slice TS file and an M3U8 index list.
  • M3U8 index list Each time the M3U8 index list is downloaded, only the index numbers of the three video program slices are included, and the client further forwards the sub-index according to the index number.
  • the server downloads the corresponding video program slice.
  • Content data of the video program and PTS timestamp information of the program content are included in the video program slice.
  • the client can obtain the PTS timestamp information by parsing the slice of the video program.
  • the client does not directly play the downloaded program resource slice, but performs step 104.
  • Step 104 The client compares the newly acquired PTS timestamp information with PTS timestamp information in a locally downloaded program resource slice.
  • the client parses the PTS timestamp information in the newly acquired slice, and further parses the slice information downloaded from the original subserver to obtain the PTS timestamp information, and compares the two.
  • Step 105 The client determines, according to the comparison result, whether to play the currently downloaded program resource slice.
  • the comparison result in this step may have multiple situations, and different processing manners may be adopted according to different situations, as an embodiment: if the newly acquired PTS timestamp information is earlier than or equal to the PTS time in the local slice. Stamping the information, determining that the newly downloaded slice already exists locally, selecting a PTS timestamp in the next newly downloaded slice to continue performing the step of comparing with the PTS timestamp in the local slice;
  • the currently downloaded program resource slice is played.
  • the method further includes: determining the newly acquired Whether the time interval of the PTS timestamp information is different from the PTS timestamp information in the local slice exceeds a preset time threshold. If yes, the currently downloaded program resource slice is not played, and may be stored locally; otherwise, the slice corresponding to the PTS timestamp information is played.
  • the method further includes: the client requests the newly allocated sub-server to download the M3U8 index list with less M3U8 serial number and the slice of the program resource, and repeat that the client will obtain the new one.
  • the step of comparing the PTS timestamp information with the PTS timestamp information in the local slice downloaded from the original subserver until the newly acquired PTS timestamp information is different from the PTS timestamp information in the local slice The preset corresponding time threshold is not exceeded, and the slice corresponding to the PTS timestamp information is played.
  • the M3U8 index numbers of the slices are generally arranged in order from small to large, so the timestamps in the above embodiments are compared.
  • the process may take the following steps: the client compares the PTS timestamp information of the slice with the smallest M3U8 index number from the newly acquired slice with the PTS timestamp information of the slice with the largest local M3U8 index number; if the newly acquired PTS time If the stamp information is earlier than or equal to the PTS timestamp information in the local slice, the PTS timestamp in the next newly downloaded slice is sequentially selected according to the M3U8 index number from small to large to continue the PTS time in the local slice. The step of comparing the stamps.
  • the HLS protocol-based live broadcast party The law can take the following steps:
  • Step 201 During the live broadcast of the client based on the HLS protocol, the client downloads the M3U8 index list from the sub-server B, and downloads the slice of the program resource according to the M3U8 index list for playing.
  • the preset is exceeded.
  • the update time threshold such as 10s
  • the client download slice exceeds the preset download time threshold (for example, more than 20s)
  • the client determines that a network error has occurred and reports to the primary server.
  • the primary server uses the redirection technology to assign a new sub-server H closer to the client according to the location of the client.
  • Step 202 After the primary server reassigns the new sub-server H to the client, the client downloads the M3U8 index list from the sub-server H, and downloads the slice of the program resource according to the M3U8 index list.
  • Step 203 The client selects a slice (that is, the first slice) with the smallest M3U8 index number from the program resource slice downloaded from the sub-server H according to the M3U8 index list, and parses the PTS timestamp information of the slice.
  • the three slices downloaded from the sub-server H are 22.ts, 23.ts, 24.ts, and the minimum (ie, the first) slice 22.ts of the M3U8 index number is parsed, and the ES stream of video and audio is separated. Get the respective PTS timestamp information, for example 89.66s.
  • Step 204 The client compares the PTS timestamp information with the PTS timestamp information parsed in the local (ie, downloaded from the sub-server B) the largest M3U8 index number, if it is earlier than or equal to the local If the PTS timestamp in the slice is performed, go to step 205; otherwise, go to step 206.
  • the local slice with the largest M3U8 index number (that is, the last downloaded) is selected from the original sub-server B as 101.ts; the slice 101.ts is parsed, and the ES stream of video and audio is separated to obtain the respective PTS timestamps.
  • Information for example 110.33s; compare PTS timestamp 89.66s of slice 22.ts and PTS timestamp 110.33s of slice 101.ts, find PTS timestamp of slice 22.ts earlier than slice 101.ts PTS timestamp 110.33s If the currently downloaded slice has been played locally, step 205 is performed; if the time stamp of the newly downloaded slice is later than the local timestamp, the slice has not been played locally, and step 206 is performed.
  • Step 205 Select the next newly downloaded slice according to the order of the M3U8 index numbers from small to large.
  • the PTS timestamp information is parsed, and the process returns to step 204.
  • the second slice 23.ts newly downloaded from the sub-server H is parsed, and the process returns to step 204 to compare the timestamp information of the second slice with the timestamp information of the local slice.
  • Step 206 Determine whether the time interval of the PTS timestamp information is different from the PTS timestamp information in the local slice exceeds a preset time threshold, and if yes, play the current newly downloaded program resource slice temporarily, and execute Step 207; otherwise, the slice corresponding to the PTS timestamp information is played.
  • the length of the time threshold may be set according to the average playing time of each slice. For example, the average playing time of each slice is 8 s, and the time threshold may be set to 8 s.
  • the PTS timestamp information of the current newly downloaded slice 22.ts is 126.33s
  • the preset time threshold is 8s
  • the PTS timestamp information of the slice 22.ts is 126.33s than the local slice 101.ts. If the PTS timestamp information 110.33s exceeds 16s, then the threshold is obviously exceeded, and step 207 is performed.
  • Step 207 The client requests the newly allocated sub-server to download the M3U8 index list with smaller M3U8 serial number and the slice of the program resource, and returns to step 204 until the newly acquired PTS timestamp information is smaller than that in the local slice.
  • the time interval in which the PTS timestamp information differs does not exceed the preset time threshold, and the slice corresponding to the PTS timestamp information is played.
  • the client downloads the M3U8 index table with a smaller serial number of the M3U8 from the sub-server, for example, the index numbers are 19.ts, 20.ts, and 21.ts, respectively, and download the corresponding program resource slice 19.ts, 20 according to the download. .ts, 21.ts.
  • Parsing the PTS timestamp information of the first slice 19.ts is 102.33s, and comparing with the PTS timestamp information 110.33s of the local slice 101.ts, finding that it is earlier than the local slice, performing step 205; continuing to parse the next one
  • the PTS timestamp information of the slice 20.ts is 110.33 s.
  • the process returns to step 205; the PTS timestamp information of the third slice 21.ts is continuously analyzed. 118.33, which is exactly 8 seconds away from the PTS timestamp information 110.33s of the local slice 101.ts, does not exceed the preset 8s time threshold, so the third slice program is played.
  • the HLS protocol-based live broadcast method of the present invention can effectively avoid the phenomenon of users jumping back and dropping frames while watching live video, and thus can perform live broadcast smoothly.
  • the embodiment of the live broadcast method based on the HLS protocol may further include the following steps:
  • Step 301 The client obtains an address Master URL of the program video main server based on the HLS protocol.
  • Step 302 The client sends a request for acquiring a program video to the primary server according to the address of the primary server, the Master URL.
  • the request for obtaining the program video may include information such as an IP address of the client, a program video name, and the like.
  • Step 303 The primary server allocates a sub-server, such as sub-server B, according to the IP address of the client, and sends the sub-server address Sub url B to the client.
  • a sub-server such as sub-server B
  • the primary server allocates a subserver closest to the client based on the client's IP address.
  • Step 304 The client sends a program resource request to the sub-server B according to the received sub-server address and the HLS protocol.
  • Step 305 The sub-server B finds the M3U8 index list of the program resource and returns it to the client according to the received request.
  • Step 306 The client downloads the slice of the program resource from the sub-server B one by one according to the received M3U8 index list.
  • Step 307 If the data download of the live program is normal, the client periodically returns to step 304 to continue to obtain the M3U8 index list and the slice of the live program from the current sub-server B.
  • Step 308 If the client fails to download the live program from the current sub-server B due to network error, insufficient bandwidth, and decreased speed, the client sends a request for acquiring the program video to the main server according to the address of the main server. .
  • Step 309 The primary server allocates another closer sub-server H by using the redirection technology according to the IP address of the client, and sends the address of the sub-server to the client, and returns to step 304.
  • the M3U8 index list only contains 3 recent slices in the live broadcast situation, so the client can only periodically access the primary server, obtain the subserver address assigned by the primary server, and then download a new M3U8 index list from the subserver. And slicing of live shows.
  • the client does not need to access the primary server every time, but directly downloads a new M3U8 index list and a slice of the live program from the previously accessed sub-server, only between the currently connected sub-server.
  • the communication fails, the primary server is requested to allocate a new subserver. Pass Through this means, the original interaction process is greatly simplified, especially for the live broadcast program, the user experience is further improved, and the fluency in the live program process is further improved.
  • a live broadcast system based on an HLS protocol includes: a client, a primary service, and a sub-server;
  • a sub-server for providing an M3U8 index list of live programs and a slice of program resources
  • a primary server configured to reassign a child server to the client
  • a client configured to download a slice of the M3U8 index list and the program resource from the newly allocated sub-server; parse the program resource slice downloaded from the new sub-server, obtain PTS timestamp information; and obtain the newly acquired PTS timestamp The information is compared with the PTS timestamp information in the local slice downloaded from the original subserver, and it is determined whether to play the currently downloaded program resource slice according to the comparison result.
  • the client determines that the newly downloaded slice has been locally present, and selects a PTS timestamp in the next newly downloaded slice to continue the step of comparing with the PTS timestamp in the local slice. If the newly acquired PTS timestamp information is later than the PTS timestamp information in the local slice, the currently downloaded program resource slice is played.
  • the time interval of the newly acquired PTS timestamp information is different from the PTS timestamp information in the local slice exceeds a preset time threshold, and if so, the current newly downloaded program resource slice is not played. It can be stored locally first; otherwise, the slice corresponding to the PTS timestamp information is played.
  • the method further includes: the client requests the newly allocated sub-server to download the M3U8 index list with less M3U8 serial number and the slice of the program resource, and repeat that the client will obtain the new one.
  • the step of comparing the PTS timestamp information with the PTS timestamp information in the local slice downloaded from the original subserver until the newly acquired PTS timestamp information is different from the PTS timestamp information in the local slice The preset corresponding time threshold is not exceeded, and the slice corresponding to the PTS timestamp information is played.
  • the request for obtaining a program video may include an IP address of the client, a program video name, and the like.
  • the primary server allocates the request to a sub-server through a redirection technology according to the IP address of the client.
  • the primary server may allocate a sub-server closest to the client according to the IP address of the client by the primary server, and send the address of the sub-server to the client.
  • the client sends a program resource request to the sub-server based on the received sub-server address and the HLS protocol. Then, the sub-server searches for the slice list of the program resource according to the received request, and sends the updated M3U8 index list in the HLS protocol to the client for downloading. Finally, the client determines whether the program resource can be played normally. If it can be played normally, the request is cyclically sent to the sub-server and the M3U8 index list is updated and downloaded until the download of the entire video program is completed. If it does not play properly, another subserver is regained through the primary server. Preferably, after the client sends the program resource request to the sub-server, the client may determine whether the program resource request is successfully sent to the sub-server. If successful, the sub-server finds the slice list of the program resource according to the received request. If not successful, the client regains another child server through the primary server.
  • the embodiment of the present invention further provides a live client based on the HLS protocol, which is specifically configured to include an address obtaining unit 401, a video requesting unit 402, a slice downloading unit 403, and the like.
  • the playback determination unit 404 is specifically configured to include an address obtaining unit 401, a video requesting unit 402, a slice downloading unit 403, and the like.
  • the address obtaining unit 401 can obtain an address of the program video main server, and send a request for acquiring a program video to the main server according to the address of the main server.
  • the video requesting unit 402 may send a program resource request to the sub-server according to the address of the sub-server and the HLS protocol allocated by the main server.
  • the video requesting unit 402 can be used by the client to determine whether the program resource request is successfully sent to the sub-server. If successful, the video requesting unit 402 is connected to the slice downloading unit 403; if not, the video requesting unit 402 and the address obtaining The unit is connected to the 403, that is, the address of the different sub-server is obtained through the main server to obtain the program video.
  • the slice download unit 403 can receive and download the M3U8 index list in the HLS protocol after the subserver update. Thereafter, the play judging unit 404 judges whether the slice video in the downloaded M3U8 index list can be played normally, and if so, the play judging unit 404 is connected to the video request unit 402, that is, cyclically updates the M3U8 index list in the HLS protocol until the entire video is completed. The download of the program. If the playback cannot be performed normally, the play judging unit 404 is connected to the address obtaining unit 401, that is, the address of the different sub-server is obtained through the main server to obtain the program video.
  • the play determining unit 404 needs to acquire the PTS timestamp information of the slice in the M3U8 index list. Comparing the newly obtained PTS timestamp information with the PTS timestamp information in the locally downloaded program resource slice, and comparing the ratios The result is determined whether to play the currently downloaded program resource slice.
  • an apparatus comprising: one or more processors;
  • a memory for storing operational instructions
  • the one or more processors are configured to retrieve an operational instruction from the memory and execute:
  • the PTS timestamp information in the slice downloaded from the new subserver is compared with the PTS timestamp information in the slice downloaded from the original subserver, and it is determined according to the comparison result that the currently downloaded program resource slice is played or not.
  • the processor is further configured to: determine, according to the comparison result, that the playing or not playing the currently downloaded program resource slice process comprises: if the PTS timestamp information in the slice downloaded from the new subserver is early At or equal to the PTS timestamp information in the slice downloaded from the original subserver, it is determined that the newly downloaded slice already exists locally, and the PTS timestamp in the next newly downloaded slice is selected to continue to execute from the original subserver.
  • the processor is further configured to: compare the PTS timestamp information in the slice downloaded from the new subserver with the PTS timestamp information in the slice downloaded from the original subserver, including: acquiring the slice newly Comparing the PTS timestamp information of the slice with the smallest M3U8 index number to the PTS timestamp information of the slice with the largest M3U8 index number downloaded from the original subserver; if the PTS timestamp information in the slice downloaded from the new subserver If the PTS timestamp information in the slice downloaded from the original subserver is earlier than or equal to the M3U8 index number The steps of selecting the PTS timestamp in the next newly downloaded slice in order from the smallest to the largest to continue the comparison with the PTS timestamp in the slice downloaded from the original subserver.
  • the processor is further configured to: determine, if the PTS timestamp information in the slice downloaded from the new subserver is later than the PTS timestamp information in the slice downloaded from the original subserver Thereafter, the method further includes: determining whether a time interval in which the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver exceeds a preset time threshold, and if so, Then, the currently downloaded program resource slice is not played, otherwise the slice corresponding to the PTS timestamp information is played.
  • the processor is further configured to: if it is determined that the PTS timestamp information in the slice downloaded from the new subserver is different from the PTS timestamp information in the slice downloaded from the original subserver After the interval exceeds the preset time threshold, it also includes:
  • the processor is further configured to: after downloading the slice of the program resource from the sub-server, if the download process is normal, download the M3U8 index list and the slice of the program resource directly to the current sub-server next time; otherwise, Request to the primary server to reassign another child server.
  • the live broadcast method, system and live broadcast client based on the HLS protocol of the present invention creatively solve the problem of lost hops and repetitions, and save time consumption of network interaction; and make the live broadcast program more stable and smooth. Improve the live broadcast experience; Finally, the entire HLS protocol-based live broadcast method, system and live client are simple, compact and easy to implement.
  • the device described in the present disclosure may be various electronic terminal devices, such as a mobile phone, a personal digital assistant (PDA), a tablet computer (PAD), a smart TV, etc., and thus the scope of protection of the present disclosure should not be limited to a certain A specific type of device.
  • the client described in the present disclosure may be applied to any one of the above electronic terminal devices in the form of electronic hardware, computer software, or a combination of both.
  • the method according to the present disclosure may also be implemented as a computer program executed by a CPU, which may be stored in a computer readable storage medium.
  • the computer program is executed by the CPU.
  • the method steps and system units described above may also be implemented with a controller and a computer readable storage medium for storing a computer program that causes the controller to implement the steps or unit functions described above.
  • non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash.
  • ROM read only memory
  • PROM programmable ROM
  • EPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM
  • flash flash.
  • Volatile memory can include random access memory (RAM), which can act as external cache memory.
  • RAM can be obtained in a variety of forms, such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM) and direct Rambus RAM (DRRAM).
  • DRAM synchronous RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM Synchronous Link DRAM
  • DRRAM direct Rambus RAM
  • Storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
  • DSPs digital signal processors
  • ASIC dedicated An integrated circuit
  • FPGA field programmable gate array
  • a general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine.
  • the processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
  • the steps of a method or algorithm described in connection with the disclosure herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two.
  • Software modules can reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, and A memory, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
  • An exemplary storage medium is coupled to the processor, such that the processor can read information from or write information to the storage medium.
  • the storage medium can be integrated with a processor.
  • the processor and the storage medium can reside in an ASIC.
  • the ASIC can reside in the user terminal.
  • the processor and the storage medium may reside as discrete components in the user terminal.
  • the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted as one or more instructions or code on a computer readable medium.
  • Computer readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one location to another.
  • a storage medium may be any available media that can be accessed by a general purpose or special purpose computer.
  • the computer readable medium may comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage device, disk storage device or other magnetic storage device, or may be used to carry or store a form of instructions Or the required program code of the data structure and any other medium that can be accessed by a general purpose or special purpose computer or a general purpose or special purpose processor. Also, any connection is properly termed a computer-readable medium.
  • a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technology such as infrared, radio, and microwave is used to transmit software from a website, server, or other remote source
  • the coaxial line Cables, fiber optic cables, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are all included in the definition of the medium.
  • a magnetic disk and an optical disk include a compact disk (CD), a laser disk, an optical disk, a digital versatile disk (DVD), a floppy disk, a Blu-ray disk, in which a disk generally reproduces data magnetically, and the optical disk optically reproduces data using a laser. . Combinations of the above should also be included within the scope of computer readable media.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种基于HLS协议的直播方法、系统及客户端,在基于HLS协议直播过程从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放;其中,当主服务器为重新分配另一个子服务器后,从该新分配的子服务器下载M3U8索引列表和节目资源的切片;解析从新的子服务器中下载的节目资源切片,获取下载的切片中的PTS时间戳信息;将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。从而实现了用户在终端顺畅观看直播视频的体验。

Description

基于HLS协议的直播方法、系统及客户端
本申请基于申请号为2015107180743,申请日为2015年10月29日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本发明涉及网络通信技术领域,特别是指一种基于HLS协议的直播方法、系统及客户端。
背景技术
内容分发网络(CDN,Content Delivery Network)是一种新型网络构建方式。其依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。CDN的基本思路是尽可能避开互联网上有可能影响数据传输速度和稳定性的瓶颈和环节,使内容传输的更快、更稳定。其目的是使用户可就近取得所需内容,解决Internet网络拥挤的状况,提高用户访问网站的响应速度。CDN通过负载均衡、本地缓存等策略使得客户可以更方便的从本地服务器上获得资源,避免全网的网络拥堵,在视频分发等领域有很广泛的应用。CDN的基本原理是广泛采用各种缓存服务器,将这些缓存服务器分布到用户访问相对集中的地区或网络中,在用户访问网站时,利用全局负载技术将用户的访问指向距离最近的工作正常的缓存服务器上,由缓存服务器直接响应用户请求。CDN的关键技术主要有内容存储和分发技术。
HLS(Http live streaming)协议是苹果公司实现的基于超文本传输协议Http的流媒体传输协议,HLS协议将容量巨大、连续的媒体数据进行分段,分割为数量众多的小文件进行传递,迎合了网页服务器的文件传输性,并采用一个不断更新的轻量级索引文件来控制分割后小媒体文件的下载和播放,可以实现流媒体的直播和点播。
通过HLS协议,视频数据经处理后分为视频节目切片TS(Transport  Stream传输流)文件以及媒体数据索引M3U8文件(M3U8文件是指UTF-8编码格式的M3U文件,M3U文件是记录了一个索引纯文本文件。),并存在于云服务器上。M3U8文件中通常包括视频片段的多个统一资源定位符URL(Uniform Resource Locator统一资源定位符)。多媒体播放器获取M3U8文件后,进而按照其中的URL下载对应的视频片段并进行播放。也可以按照M3U8文件中的URL将视频片段下载并存储在本地,以供后续在本地进行播放。
目前,视频的直播和点播也广泛应用了CDN加速技术,在手机和电视业务中,CDN配合HLS协议来实现视频内容的直播和点播是最常见的视频观看方式。
现有技术在CDN配置下,直播节目通常会使用重定向的技术隐藏具体的码流URL地址,通过主服务器的Master URL地址与各个分发子服务器Sub URL地址配合的方法实现,例如:
1.用户客户端首先得到一个Master URL。
2.用户客户端向主服务器请求这个Master URL。
3.主服务器根据用户客户端的地域情况通过重定向技术向用户客户端分发一个子服务器B的新的Sub URL,记为URLb。
4.用户客户端通过URLb向服务器获取直播节目M3U8索引列表。
5.客户端解析M3U8索引列表并下载具体的节目码流切片。
6.根据HLS协议规定,M3U8索引列表在直播情况下仅包含3个最近的切片,用户客户端需要定时的去更新M3U8列表,因此客户端会返回步骤2定时更新M3U8列表并下载新的切片,以此不断重复步骤2-5。
7.在某一个时刻,子服务器B带宽不足的情况,CDN会通过均衡负载将用户的请求重定向到新的子服务器H,得到一个新的URLb。
然而,目前由于不同子服务器之间M3U8索引序号没有可比性,CDN服务器无法保证其不同的子服务器的码流切片分发一致性,因此直播节目中,往往会出现节目回跳或者节目切片丢失等情况,造成用户无法流畅观看直播节目,使得用户体验降低。
发明内容
有鉴于此,本发明的目的在于提出一种基于HLS协议的直播方法、系统 及客户端,解决了用户在观看直播节目时,出现的节目回跳或者节目切片丢失问题。
基于上述目的本发明提供了一种基于HLS协议的直播方法,作为一个实施例该方法包括:在基于HLS协议直播过程从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放;其中,当主服务器为重新分配另一个子服务器后,从该新分配的子服务器下载M3U8索引列表和节目资源的切片;
解析从新的子服务器中下载的节目资源切片,获取下载的切片中的PTS时间戳信息;
将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
可选地,所述根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
进一步地,将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:从新获取切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤。
进一步地,所述判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比从原先 子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
进一步地,所述如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
可选地,每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
在本发明的另一方面,还提供了一种基于HLS协议的直播系统,作为一个实施例该系统包括:
子服务器,用于提供直播节目的M3U8索引列表以及节目资源的切片;
主服务器,用于为所述客户端重新分配子服务器后;
客户端,用于从该新分配的子服务器下载M3U8索引列表和节目资源的切片;解析从新的子服务器中下载的节目资源切片,获取PTS时间戳信息;并将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
可选地,所述客户端,还用于在确定所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息后,判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤;
和/或所述客户端,还用于在确定所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息 后,播放当前新下载的节目资源切片。
进一步地,所述客户端还用于从新的子服务器下载的切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的过程。
进一步地,所述客户端,还用于判断所述从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
进一步地,所述客户端,还用于向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复所述客户端将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至新获取的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
可选地,所述客户端每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
此外,在本发明的第三个方面,还提供了一种基于HLS协议的客户端,作为一个实施例该客户端包括依次连接的地址获取单元、视频请求单元、切片下载单元以及播放判断单元;
地址获取单元,用于能够获得节目视频主服务器的地址,并且根据该主服务器的地址,向主服务器发送获取节目视频的请求;
视频请求单元,用于根据主服务器分配的子服务器的地址和HLS协议,向该子服务器发送节目资源请求;
切片下载单元,用于从子服务器下载M3U8索引列表;其中,当主服务器为所述客户端重新分配另一个子服务器后,切片下载单元从新分配的子服 务器下载M3U8索引列表和节目资源的切片;解析下载的节目资源切片,获取PTS时间戳信息;
播放判断单元,用于根据M3U8索引列表下载节目资源的切片进行播放;其中,当节目资源切片是从重新分配的另一个子服务器下载时,播放判断单元将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
可选地,所述的播放判断单元根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
进一步地,所述的播放判断单元将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:所述客户端从新的子服务器下载的切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤。
进一步地,所述播放判断单元判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放当前新下载的节目资源切 片,否则播放该PTS时间戳信息所对应的切片。
进一步地,所述播放判断单元如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
客户端向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复所述客户端将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
可选地,所述播放判断单元每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
本发明实施例的又一方面,还提供了一种装置,包括:
一个或多个处理器;以及
用于存储操作指令的存储器;
所述一个或多个处理器被配置为从所述存储器中获取操作指令并执行:
在基于HLS协议直播过程从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放;其中,当主服务器为重新分配另一个子服务器后,从该新分配的子服务器下载M3U8索引列表和节目资源的切片;
解析从新的子服务器中下载的节目资源切片,获取下载的切片中的PTS时间戳信息;
将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
可选地,所述处理器还用于执行:所述根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时 间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
可选地,所述处理器还用于执行:将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:从新获取切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤。
可选地,所述处理器还用于执行:所述判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
可选地,所述处理器还用于执行:所述如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
可选地,所述处理器还用于执行:每次从子服务器下载节目资源的切片 后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
从上面所述可以看出,本发明实施例提供的基于HLS协议的直播方法、系统及客户端,在主服务器为客户端重定向到另一个子服务器的过程中,由该客户端主动对从该新分配的子服务器中获取节目切片进行解析,并获取其中的PTS时间戳信息,将其与本地原先已下载的节目资源切片中的PTS时间戳信息进行比较,借此判断出该节目切片是否被重复播放过。从而解决了现有技术中由于不同子服务器之间M3U8索引序号没有可比性,使得CDN服务器无法保证其不同的子服务器的码流切片分发一致性的问题,避免了直播过程中节目回跳等情况的发生,优化了用户观看直播节目的效果。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本发明。
附图说明
为了更清楚地说明本公开的实施例,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例中基于HLS协议的直播方法的流程示意图;
图2为本发明一可参考实施例中基于HLS协议的直播方法的流程示意图;
图3为本发明另一实施例中基于HLS协议的直播方法的时序示意图;
图4为本发明实施例基于HLS协议的直播客户端的结构示意图。
通过上述附图,已示出本公开明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本公开构思的范围,而是通过参考特定实施例为本领域技术人员说明本公开的概念。
具体实施方式
为使本发明的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本发明进一步详细说明。
根据现有HLS协议,客户端是通过M3U8索引序列表到子服务器中下载 对应的节目切片。但是,由于不同子服务器所存储的同一直播节目M3U8索引列表中的对应节目切片的索引序号不同,不具有可比性,因此当主服务器将客户端重定向到一个新的子服务器的过程中,往往会导致节目切片重复下载,或者切片丢失等情况。为了解决这一问题,本发明中考虑到虽然不同子服务器之间的节目切片索引序号不同,但是节目切片的内容相同,节目切片中的PTS时间戳信息具有可比性,因此本发明的思路是在重定向子服务器的过程中,增加对新的子服务器中首次下载节目切片的解析,并将解析出的PTS时间戳信息与客户端本地原先下载的节目切片中的时间戳信息进行比较,从而确定节目切片是否被重复下载,或者切片丢失等情况。
参阅图1所示,为本发明第一实施例中基于HLS协议的直播方法的流程示意图,所述基于HLS协议的直播方法包括:
步骤101,在客户端基于HLS协议直播过程中,所述客户端从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放。
步骤102,当主服务器为所述客户端重新分配另一个子服务器后,该客户端从该新分配的子服务器下载M3U8索引列表,并根据该M3U8索引列表下载节目资源的切片。
步骤103,所述客户端解析从新的子服务器中下载的节目资源切片,获取PTS时间戳信息。
根据HLS协议,从子服务器中保存的视频数据中包括:视频节目切片TS文件以及M3U8索引列表,每次下载M3U8索引列表仅包含三个视频节目切片的索引号,客户端根据索引号再向子服务器下载对应的视频节目切片。在视频节目切片中包含视频节目的内容数据以及该节目内容的PTS时间戳信息。客户端通过解析视频节目的切片可以获取到PTS时间戳信息。
此时,所述客户端并不直接播放下载的节目资源切片,而是执行步骤104。
步骤104,所述客户端将新获取的所述PTS时间戳信息与本地原先已下载的节目资源切片中的PTS时间戳信息进行比较。
具体地,所述客户端解析新获取的切片中的PTS时间戳信息,此外对本地从原先的子服务器中下载的切片信息也解析获得PTS时间戳信息,将二者进行比较。
步骤105,客户端根据比较结果确定是否播放当前新下载的节目资源切片。
本步骤中的比较结果会有多种情况,根据不同的情况可采取不同的处理方式,作为一个实施例:如果所述新获取的PTS时间戳信息早于或等于所述本地切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤;
可选地,如果所述新获取的PTS时间戳信息晚于所述本地切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
此外,为了防止丢帧或跳帧的情况发生,还可以在判定出所述新获取的PTS时间戳信息晚于所述本地切片中的PTS时间戳信息后,进一步包括:判断所述新获取的PTS时间戳信息比所述本地切片中的PTS时间戳信息相差的时间间隔,是否超出预设的时间阈值。如果是,则暂不播放播放当前新下载的节目资源切片,可以先存储在本地;否则播放该PTS时间戳信息所对应的切片。
如果超出了预设的时间阈值,还可以进一步包括:客户端向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复所述客户端将新获取的所述PTS时间戳信息与从原先子服务器下载的本地切片中的PTS时间戳信息进行比较的步骤,直至新获取的PTS时间戳信息比所述本地切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
作为一个较佳的实施方式,为了提高上面各实施例中时间戳比较的效率,考虑到切片的M3U8索引号一般是按照从小到大的顺序依次编排的,因此上面各实施例中的时间戳比较过程可采取如下步骤:所述客户端从新获取切片中选择M3U8索引号最小的切片的PTS时间戳信息与本地M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述新获取的PTS时间戳信息早于或等于所述本地切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤。
作为一个可参考的实施例,参阅图2所示,所述基于HLS协议的直播方 法具体可采用如下步骤:
步骤201,在客户端基于HLS协议直播过程中,所述客户端从子服务器B下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放。
当由于网络错误、带宽不足以及速度下降等原因使得不能够从当前下载的子服务器正常下载的所述节目资源切片播放所述的节目时,例如:客户端更新M3U8索引列表时超过了预先设定的更新时间阈值(比如10s),或者客户端下载切片超过预设的下载时间阈值(比如超过20s),则客户端判断发生了网络错误,向主服务器报告。则主服务器用重定向技术根据该客户端所处位置为其分配一个离该客户端较近的新子服务器H。
步骤202,主服务器为所述客户端重新分配新子服务器H后,该客户端从子服务器H下载M3U8索引列表,并根据该M3U8索引列表下载节目资源的切片。
步骤203,所述客户端根据M3U8索引列表从子服务器H中下载的节目资源切片中选择M3U8索引号最小的切片(也就是第一个切片)进行解析,获取该切片的PTS时间戳信息。
例如:从子服务器H中下载的三个切片为22.ts、23.ts、24.ts,解析M3U8索引号最小的(即第一个)切片22.ts,分离出视频和音频的ES流,获得各自的PTS时间戳信息,例如89.66s。
步骤204,所述客户端将所述PTS时间戳信息与本地中(即从子服务器B中下载的)M3U8索引号最大的切片中解析的PTS时间戳信息进行比较,如果早于或者等于该本地切片中的PTS时间戳,则执行步骤205;否则,执行步骤206。
例如:从原来的子服务器B中选择M3U8索引号最大的(即最后下载的)本地切片为101.ts;解析该切片101.ts,分离出视频和音频的ES流,获得各自的PTS时间戳信息,例如110.33s;比较切片22.ts的PTS时间戳89.66s和切片101.ts的PTS时间戳110.33s,发现切片22.ts的PTS时间戳早于切片101.ts的PTS时间戳110.33s,说明当前下载的切片在本地已播放过,执行步骤205;如果新下载切片的时间戳晚于本地时间戳则说明该切片还未在本地播放过,执行步骤206。
步骤205,根据M3U8索引号从小到大的顺序选择下一个新下载的切片 解析出PTS时间戳信息,返回步骤204。
例如:对从子服务器H新下载的第二个切片23.ts进行解析,返回步骤204,用该第二个切片的时间戳信息与本地切片的时间戳信息进行比较。
通过本步骤,可避免视频节目的切片被重复播放而引起的回跳现象。
步骤206,判断所述PTS时间戳信息比所述本地切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,执行步骤207;否则播放该PTS时间戳信息所对应的切片。
其中,所述时间阈值的长度可以根据每个切片平均播放时间长度来设定,比如每个切片的平均播放时间为8s,则所述时间阈值可以设定为8s。
例如:假设解析出当前新下载切片22.ts的PTS时间戳信息为126.33s,而预先设定的时间阈值为8s,则切片22.ts的PTS时间戳信息为126.33s比本地切片101.ts的PTS时间戳信息110.33s超出了16s,则显然已超过阈值,则执行步骤207。
步骤207,客户端向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并返回步骤204,直至新获取的PTS时间戳信息比所述本地切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
例如:客户端从子服务器下载M3U8序列号更小的M3U8索引表,比如索引号分别为19.ts、20.ts、21.ts,并据此下载所对应的节目资源切片19.ts、20.ts、21.ts。解析第一个切片19.ts的PTS时间戳信息为102.33s,通过与本地切片101.ts的PTS时间戳信息110.33s的比较,发现早于本地切片,则执行步骤205;继续解析出下一个切片20.ts的PTS时间戳信息为110.33s,通过比较发现,当前切片时间戳信息与本地切片的相等,则继续返回执行步骤205;继续解析第三个切片21.ts的PTS时间戳信息为118.33,恰好与本地切片101.ts的PTS时间戳信息110.33s相差8s,未超出预设的8s时间阈值,因此播放该第三切片节目。
根据上面的实施例可以看出,本发明所述的基于HLS协议的直播方法能够有效地避免,用户在观看直播视频时回跳、丢帧的现象,进而可以很流畅的进行直播。
参阅图3所示,所述基于HLS协议的直播方法的实施例还可以是包括如下步骤:
步骤301,客户端基于HLS协议获得节目视频主服务器的地址Master URL。
步骤302,客户端根据该主服务器的地址Master URL,向主服务器发送获取节目视频的请求。
其中,所述获取节目视频的请求中可以包括该客户端的IP地址、节目视频名称等信息。
步骤303,主服务器根据该客户端的IP地址分配一个子服务器,例如子服务器B,并将该子服务器的地址Sub url B发送给所述的客户端。
较佳地,主服务器根据该客户端的IP地址分配一个距离该客户端最近的子服务器。
步骤304,该客户端根据接收的子服务器地址和HLS协议,向该子服务器B发送节目资源请求。
步骤305,子服务器B根据接收的该请求查找到所述节目资源的M3U8索引列表返回给客户端。
步骤306,客户端根据接收的M3U8索引列表逐个从子服务器B下载所述节目资源的切片。
步骤307,直播节目的数据下载正常的情况下,客户端定时返回步骤304,继续从当前的子服务器B获取直播节目的M3U8索引列表以及切片。
步骤308,如果由于网络错误、带宽不足以及速度下降等原因使得客户端不能够正常从当前子服务器B下载直播节目,则客户端根据所述主服务器的地址,向主服务器发送获取节目视频的请求。
步骤309,主服务器根据该客户端的IP地址通过重定向技术分配另外一个较近子服务器H,并将该子服务器的地址发送给客户端,返回步骤304。
根据HLS协议规定,M3U8索引列表在直播情况下仅仅包含3个最近的切片,因此客户端只能定时访问主服务器,获取主服务器分配的子服务器地址,再从该子服务器下载新的M3U8索引列表以及直播节目的切片。而在本实施例中,客户端无需每次都要访问主服务器,而是直接从之前访问的子服务器中下载新的M3U8索引列表以及直播节目的切片,只有在与当前连接的子服务器之间的通信发生故障时,才向主服务器请求分配新的子服务器。通 过这一手段,使原有的交互过程大为简化,尤其对于直播节目而言,使用户的体验度得到进一步提升,进一步提高了直播节目过程中的流畅度。
在本发明实施例的另一方面,还提供了一种基于HLS协议的直播系统,作为一个实施例该系统包括:客户端、主服务和子服务器;
子服务器,用于提供直播节目的M3U8索引列表以及节目资源的切片;
主服务器,用于为所述客户端重新分配子服务器后;
客户端,用于从该新分配的子服务器下载M3U8索引列表和节目资源的切片;解析从新的子服务器中下载的节目资源切片,获取PTS时间戳信息;并将新获取的所述PTS时间戳信息与从原先子服务器下载的本地切片中的PTS时间戳信息进行比较,根据比较结果确定是否播放当前新下载的节目资源切片。
较佳地,客户端用于判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤。如果所述新获取的PTS时间戳信息晚于所述本地切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
优选地,判断新获取的PTS时间戳信息比所述本地切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,可以先存储在本地;否则播放该PTS时间戳信息所对应的切片。
如果超出了预设的时间阈值,还可以进一步包括:客户端向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复所述客户端将新获取的所述PTS时间戳信息与从原先子服务器下载的本地切片中的PTS时间戳信息进行比较的步骤,直至新获取的PTS时间戳信息比所述本地切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
作为实施例,所述获取节目视频的请求中可以包括该客户端的IP地址、节目视频名称等等。较佳地,主服务器根据客户端的IP地址,将所述的请求通过重定向技术分配一个子服务器。优选地,可以通过主服务器根据该客户端的IP地址,分配一个距离该客户端最近的子服务器,并将该子服务器的地址发送给所述的客户端。
作为另一实施例,客户端根据接收的子服务器地址和HLS协议,向该子服务器发送节目资源请求。之后,子服务器根据接收的该请求查找到所述节目资源的切片列表,发送更新后的HLS协议中M3U8索引列表给该客户端进行下载。最后,客户端判断是否能正常的播放所述的节目资源,若能正常播放则向子服务器循环发送请求并更新下载M3U8索引列表,直至完成整个所述视频节目的下载。若不能正常播放,则通过主服务器重新获得另一个子服务器。较佳地,客户端向该子服务器发送节目资源请求之后,客户端可以判断向该子服务器发送节目资源请求是否成功,若成功则子服务器根据接收的该请求查找到所述节目资源的切片列表;若不成功则客户端通过主服务器重新获得另一个子服务器。
作为本发明的另一个实施例,本发明实施例还设计了一种基于HLS协议的直播客户端,其具体的结构为包括依次连接的地址获取单元401、视频请求单元402、切片下载单元403以及播放判断单元404。
其中,所述的地址获取单元401能够获得节目视频主服务器的地址,并且根据该主服务器的地址,向主服务器发送获取节目视频的请求。所述的视频请求单元402可以根据主服务器分配的子服务器的地址和HLS协议,向该子服务器发送节目资源请求。较佳地,视频请求单元402可以用于客户端判断向该子服务器发送节目资源请求是否成功,若成功则视频请求单元402与切片下载单元403连接;若不成功则视频请求单元402与地址获取单元连接403,即重新通过主服务器获得不同子服务器的地址进行节目视频的获取。
所述的切片下载单元403可以接收并下载子服务器更新后的HLS协议中M3U8索引列表。之后,播放判断单元404判断下载的M3U8索引列表中切片视频是否能够正常播放,若能则播放判断单元404与视频请求单元402连接,即循环更新HLS协议中的M3U8索引列表直至完成整个所述视频节目的下载。若不能正常播放则播放判断单元404与地址获取单元401连接,即重新通过主服务器获得不同子服务器的地址进行节目视频的获取。
还有,当切片下载单元403是根据新分配的子服务器发送的M3U8索引列表进行解析、下载节目资源的切片时,所述的播放判断单元404需要获取M3U8索引列表中切片的PTS时间戳信息,将新获取的所述PTS时间戳信息与本地原先已下载的节目资源切片中的PTS时间戳信息进行比较,并根据比 较结果确定是否播放当前新下载的节目资源切片。
本发明实施例的又一方面,还提供了一种装置,所述装置的一个实施例,包括:一个或多个处理器;以及
用于存储操作指令的存储器;
所述一个或多个处理器被配置为从所述存储器中获取操作指令并执行:
在基于HLS协议直播过程从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放;其中,当主服务器为重新分配另一个子服务器后,从该新分配的子服务器下载M3U8索引列表和节目资源的切片;
解析从新的子服务器中下载的节目资源切片,获取下载的切片中的PTS时间戳信息;
将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
较佳的,所述处理器还用于执行:所述根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
较佳的,所述处理器还用于执行:将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:从新获取切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号 由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤。
较佳的,所述处理器还用于执行:所述判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
较佳的,所述处理器还用于执行:所述如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
较佳的,所述处理器还用于执行:每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
综上所述,本发明提供的基于HLS协议的直播方法、系统及直播客户端,创造性地解决了丢失跳段和重复的情况,同时节省了网络交互的时间消耗;使得直播节目更加稳定流畅,提高直播体验效果;最后,整个所述的基于HLS协议的直播方法、系统及直播客户端简便、紧凑,易于实现。
此外,典型地,本公开所述的装置可为各种电子终端设备,例如手机、个人数字助理(PDA)、平板电脑(PAD)、智能电视等,因此本公开的保护范围不应限定为某种特定类型的装置。本公开所述的客户端可以以电子硬件、计算机软件或两者的组合的形式应用于上述任意一种电子终端设备中。
此外,根据本公开的方法还可以被实现为由CPU执行的计算机程序,该计算机程序可以存储在计算机可读存储介质中。在该计算机程序被CPU执 行时,执行本公开的方法中限定的上述功能。
此外,上述方法步骤以及系统单元也可以利用控制器以及用于存储使得控制器实现上述步骤或单元功能的计算机程序的计算机可读存储介质实现。
此外,应该明白的是,本文所述的计算机可读存储介质(例如,存储器)可以是易失性存储器或非易失性存储器,或者可以包括易失性存储器和非易失性存储器两者。作为例子而非限制性的,非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦写可编程ROM(EEPROM)或快闪存储器。易失性存储器可以包括随机存取存储器(RAM),该RAM可以充当外部高速缓存存储器。作为例子而非限制性的,RAM可以以多种形式获得,比如同步RAM(DRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据速率SDRAM(DDR SDRAM)、增强SDRAM(ESDRAM)、同步链路DRAM(SLDRAM)以及直接RambusRAM(DRRAM)。所公开的方面的存储设备意在包括但不限于这些和其它合适类型的存储器。
本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。为了清楚地说明硬件和软件的这种可互换性,已经就各种示意性组件、方块、模块、电路和步骤的功能对其进行了一般性的描述。这种功能是被实现为软件还是被实现为硬件取决于具体应用以及施加给整个系统的设计约束。本领域技术人员可以针对每种具体应用以各种方式来实现所述的功能,但是这种实现决定不应被解释为导致脱离本公开的范围。
结合这里的公开所描述的各种示例性逻辑块、模块和电路可以利用被设计成用于执行这里所述功能的下列部件来实现或执行:通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或其它可编程逻辑器件、分立门或晶体管逻辑、分立的硬件组件或者这些部件的任何组合。通用处理器可以是微处理器,但是可替换地,处理器可以是任何传统处理器、控制器、微控制器或状态机。处理器也可以被实现为计算设备的组合,例如,DSP和微处理器的组合、多个微处理器、一个或多个微处理器结合DSP核、或任何其它这种配置。
结合这里的公开所描述的方法或算法的步骤可以直接包含在硬件中、由处理器执行的软件模块中或这两者的组合中。软件模块可以驻留在RAM存储器、快闪存储器、ROM存储器、EPROM存储器、EEPROM存储器、寄 存器、硬盘、可移动盘、CD-ROM、或本领域已知的任何其它形式的存储介质中。示例性的存储介质被耦合到处理器,使得处理器能够从该存储介质中读取信息或向该存储介质写入信息。在一个替换方案中,所述存储介质可以与处理器集成在一起。处理器和存储介质可以驻留在ASIC中。ASIC可以驻留在用户终端中。在一个替换方案中,处理器和存储介质可以作为分立组件驻留在用户终端中。
在一个或多个示例性设计中,所述功能可以在硬件、软件、固件或其任意组合中实现。如果在软件中实现,则可以将所述功能作为一个或多个指令或代码存储在计算机可读介质上或通过计算机可读介质来传送。计算机可读介质包括计算机存储介质和通信介质,该通信介质包括有助于将计算机程序从一个位置传送到另一个位置的任何介质。存储介质可以是能够被通用或专用计算机访问的任何可用介质。作为例子而非限制性的,该计算机可读介质可以包括RAM、ROM、EEPROM、CD-ROM或其它光盘存储设备、磁盘存储设备或其它磁性存储设备,或者是可以用于携带或存储形式为指令或数据结构的所需程序代码并且能够被通用或专用计算机或者通用或专用处理器访问的任何其它介质。此外,任何连接都可以适当地称为计算机可读介质。例如,如果使用同轴线缆、光纤线缆、双绞线、数字用户线路(DSL)或诸如红外线、无线电和微波的无线技术来从网站、服务器或其它远程源发送软件,则上述同轴线缆、光纤线缆、双绞线、DSL或诸如红外先、无线电和微波的无线技术均包括在介质的定义。如这里所使用的,磁盘和光盘包括压缩盘(CD)、激光盘、光盘、数字多功能盘(DVD)、软盘、蓝光盘,其中磁盘通常磁性地再现数据,而光盘利用激光光学地再现数据。上述内容的组合也应当包括在计算机可读介质的范围内。
公开的示例性实施例,但是应当注公开的示例性实施例,但是应当注意,在不背离权利要求限定的本公开的范围的前提下,可以进行多种改变和修改。根据这里描述的公开实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。此外,尽管本公开的元素可以以个体形式描述或要求,但是也可以设想多个,除非明确限制为单数。
应当理解的是,在本文中使用的,除非上下文清楚地支持例外情况,单数形式“一个”(“a”、“an”、“the”)旨在也包括复数形式。还应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任 意和所有可能组合。
上述本公开实施例序号仅仅为了描述,不代表实施例的优劣。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
所属领域的普通技术人员应当理解:以上所述仅为本发明的具体实施例而已,并不用于限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (24)

  1. 一种基于HLS协议的直播方法,包括步骤:
    在基于HLS协议直播过程从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放;其中,当主服务器为重新分配另一个子服务器后,从该新分配的子服务器下载M3U8索引列表和节目资源的切片;
    解析从新的子服务器中下载的节目资源切片,获取下载的切片中的PTS时间戳信息;
    将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
  2. 根据权利要求1所述的方法,其中,所述根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
  3. 根据权利要求2所述的方法,其中,将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:从新获取切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤。
  4. 根据权利要求2或3所述的方法,其中,所述判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切 片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
  5. 根据权利要求4所述的方法,其中,所述如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
    向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
  6. 根据权利要求1所述的方法,其中,每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
  7. 一种基于HLS协议的直播系统,包括:
    子服务器,用于提供直播节目的M3U8索引列表以及节目资源的切片;
    主服务器,用于为所述客户端重新分配子服务器后;
    客户端,用于从该新分配的子服务器下载M3U8索引列表和节目资源的切片;解析从新的子服务器中下载的节目资源切片,获取PTS时间戳信息;并将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
  8. 根据权利要求7所述的系统,其中,所述客户端,还用于在确定所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息后,判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤;
    和/或所述客户端,还用于在确定所述从新的子服务器下载的切片中的 PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息后,播放当前新下载的节目资源切片。
  9. 根据权利要求8所述的系统,其中,所述客户端还用于从新的子服务器下载的切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的过程。
  10. 根据权利要求8或9所述的系统,其中,所述客户端,还用于判断所述从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
  11. 根据权利要求10所述的系统,其中,所述客户端,还用于向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复所述客户端将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至新获取的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
  12. 根据权利要求7所述的系统,其中,所述客户端每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
  13. 一种基于HLS协议的客户端,包括依次连接的地址获取单元、视频请求单元、切片下载单元以及播放判断单元;
    地址获取单元,用于能够获得节目视频主服务器的地址,并且根据该主服务器的地址,向主服务器发送获取节目视频的请求;
    视频请求单元,用于根据主服务器分配的子服务器的地址和HLS协议,向该子服务器发送节目资源请求;
    切片下载单元,用于从子服务器下载M3U8索引列表;其中,当主服务器为所述客户端重新分配另一个子服务器后,切片下载单元从新分配的子服务器下载M3U8索引列表和节目资源的切片;解析下载的节目资源切片,获取PTS时间戳信息;
    播放判断单元,用于根据M3U8索引列表下载节目资源的切片进行播放;其中,当节目资源切片是从重新分配的另一个子服务器下载时,播放判断单元将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当前新下载的节目资源切片。
  14. 根据权利要求13所述的客户端,其中,所述的播放判断单元根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
  15. 根据权利要求14所述的客户端,其中,所述的播放判断单元将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:所述客户端从新的子服务器下载的切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与本地切片中的PTS时间戳比较的步骤。
  16. 根据权利要求14或15所述的客户端,其中,所述播放判断单元判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原 先子服务器下载的切片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
  17. 根据权利要求16所述的客户端,其中,所述播放判断单元如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
    客户端向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复所述客户端将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
  18. 根据权利要求13所述的客户端,其中,所述播放判断单元每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
  19. 一种装置,包括:一个或多个处理器;以及
    用于存储操作指令的存储器;
    所述一个或多个处理器被配置为从所述存储器中获取操作指令并执行:
    在基于HLS协议直播过程从子服务器下载M3U8索引列表,并根据M3U8索引列表下载节目资源的切片进行播放;其中,当主服务器为重新分配另一个子服务器后,从该新分配的子服务器下载M3U8索引列表和节目资源的切片;
    解析从新的子服务器中下载的节目资源切片,获取下载的切片中的PTS时间戳信息;
    将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较,根据比较结果确定播放或不播放当 前新下载的节目资源切片。
  20. 根据权利要求19所述的装置,其中,所述处理器还用于执行:所述根据比较结果确定播放或不播放当前新下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则判定该新下载的切片已经在本地存在,选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤;和/或所述根据比较结果确定播放或不播放当前下载的节目资源切片过程包括:如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于从原先子服务器下载的切片中的PTS时间戳信息,则播放当前新下载的节目资源切片。
  21. 根据权利要求20所述的装置,其中,所述处理器还用于执行:将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的过程包括:从新获取切片中选择M3U8索引号最小的切片的PTS时间戳信息与从原先子服务器下载的M3U8索引号最大的切片的PTS时间戳信息进行比较;如果所述从新的子服务器下载的切片中的PTS时间戳信息早于或等于所述从原先子服务器下载的切片中的PTS时间戳信息,则按照M3U8索引号由小到大的顺序依次选择下一个新下载的切片中的PTS时间戳继续执行与从原先子服务器下载的切片中的PTS时间戳比较的步骤。
  22. 根据权利要求20或21所述的装置,其中,所述处理器还用于执行:所述判定出如果所述从新的子服务器下载的切片中的PTS时间戳信息晚于所述从原先子服务器下载的切片中的PTS时间戳信息后,进一步包括:判断所述从新的子服务器下载的切片中的PTS时间戳信息比从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔是否超出预设的时间阈值,如果是,则暂不播放播放当前新下载的节目资源切片,否则播放该PTS时间戳信息所对应的切片。
  23. 根据权利要求22所述的装置,其中,所述处理器还用于执行:所述如果判定出从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔超出预设的时间阈值后,还包括:
    向所述新分配的子服务器请求下载M3U8序列号更小的M3U8索引列表和节目资源的切片,并重复将从新的子服务器下载的切片中的PTS时间戳信息与从原先子服务器下载的切片中的PTS时间戳信息进行比较的步骤,直至从新的子服务器下载的切片中的PTS时间戳信息比所述从原先子服务器下载的切片中的PTS时间戳信息相差的时间间隔未超出预设的时间阈值,播放该PTS时间戳信息所对应的切片。
  24. 根据权利要求22所述的装置,其中,所述处理器还用于执行:每次从子服务器下载节目资源的切片后,如果下载过程正常,则下一次直接向当前子服务器下载M3U8索引列表以及节目资源的切片;否则,向主服务器请求重新分配另一个子服务器。
PCT/CN2016/085110 2015-10-29 2016-06-07 基于hls协议的直播方法、系统及客户端 Ceased WO2017071228A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/120,244 US20180227648A1 (en) 2015-10-29 2016-06-07 Method for live broadcast based on hls protocol and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510718074.3 2015-10-29
CN201510718074.3A CN105657578B (zh) 2015-10-29 2015-10-29 基于hls协议的直播方法、系统及客户端

Publications (1)

Publication Number Publication Date
WO2017071228A1 true WO2017071228A1 (zh) 2017-05-04

Family

ID=56481812

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/085110 Ceased WO2017071228A1 (zh) 2015-10-29 2016-06-07 基于hls协议的直播方法、系统及客户端

Country Status (3)

Country Link
US (1) US20180227648A1 (zh)
CN (1) CN105657578B (zh)
WO (1) WO2017071228A1 (zh)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10070344B1 (en) 2017-07-25 2018-09-04 At&T Intellectual Property I, L.P. Method and system for managing utilization of slices in a virtual network function environment
US10149193B2 (en) 2016-06-15 2018-12-04 At&T Intellectual Property I, L.P. Method and apparatus for dynamically managing network resources
US10257668B2 (en) 2017-05-09 2019-04-09 At&T Intellectual Property I, L.P. Dynamic network slice-switching and handover system and method
US10382903B2 (en) 2017-05-09 2019-08-13 At&T Intellectual Property I, L.P. Multi-slicing orchestration system and method for service and/or content delivery
US10505870B2 (en) 2016-11-07 2019-12-10 At&T Intellectual Property I, L.P. Method and apparatus for a responsive software defined network
US10516996B2 (en) 2017-12-18 2019-12-24 At&T Intellectual Property I, L.P. Method and apparatus for dynamic instantiation of virtual service slices for autonomous machines
US10673751B2 (en) 2017-04-27 2020-06-02 At&T Intellectual Property I, L.P. Method and apparatus for enhancing services in a software defined network
US10749796B2 (en) 2017-04-27 2020-08-18 At&T Intellectual Property I, L.P. Method and apparatus for selecting processing paths in a software defined network
US10819606B2 (en) 2017-04-27 2020-10-27 At&T Intellectual Property I, L.P. Method and apparatus for selecting processing paths in a converged network
CN111866603A (zh) * 2020-07-21 2020-10-30 广州市保伦电子有限公司 一种基于srs的视频文件生产方法、后台服务器和系统
CN112312162A (zh) * 2020-10-16 2021-02-02 安擎(天津)计算机有限公司 一种传输视频流的视频服务器
CN114666319A (zh) * 2022-03-02 2022-06-24 北京百度网讯科技有限公司 数据下载方法、装置、电子设备和可读存储介质

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10785116B1 (en) * 2017-01-12 2020-09-22 Electronic Arts Inc. Computer architecture for asset management and delivery
CN106998478B (zh) * 2017-03-15 2020-12-11 海信视像科技股份有限公司 一种用于智能电视当前播放列表的偏移校正方法和装置
CN106993236B (zh) * 2017-04-01 2019-07-23 青岛海信电器股份有限公司 一种视频播放方法及终端
CN110120930A (zh) * 2018-02-06 2019-08-13 阿里巴巴集团控股有限公司 获取传输文件的方法、系统及多媒体设备
CN108259805B (zh) * 2018-03-30 2020-11-10 深圳市华宝电子科技有限公司 多路视频解码的方法、播放的方法、装置、行车记录仪
CN111338917B (zh) * 2018-12-19 2023-03-28 贵州白山云科技股份有限公司 一种确定服务器服务能力的动态控制方法及装置
CN109729387B (zh) * 2019-01-07 2021-05-14 烽火通信科技股份有限公司 基于hls协议的网络直播在故障恢复后的播放方法及系统
CN112911315B (zh) * 2019-11-19 2024-07-19 南京中兴新软件有限责任公司 一种流媒体直播录制方法、网络设备及存储介质
CN111327920A (zh) * 2020-03-24 2020-06-23 上海万面智能科技有限公司 基于直播的信息交互方法、装置、电子设备及可读存储介质
CN112104885B (zh) * 2020-09-09 2022-06-24 海看网络科技(山东)股份有限公司 一种直播中加快m3u8起始播放速度的系统及方法
RU2759595C1 (ru) * 2020-09-28 2021-11-15 Общество С Ограниченной Ответственностью "Джи-Кор Рус" Система отказоустойчивого транскодирования и выдачи прямых потоков в формате hls
CN114630143B (zh) * 2020-12-10 2024-03-22 浙江宇视科技有限公司 视频流存储方法、装置、电子设备和存储介质
CN112752111B (zh) * 2020-12-24 2023-05-16 广州博冠信息科技有限公司 直播流处理方法及装置、计算机可读存储介质、电子设备
CN115396420B (zh) * 2021-05-25 2025-08-29 北京金山云网络技术有限公司 对等网络中的数据交互方法、装置和电子设备
CN114157643B (zh) * 2021-12-20 2023-01-13 海看网络科技(山东)股份有限公司 基于转码器hls协议固定码率参数的方法
CN118760631B (zh) * 2024-09-09 2024-12-27 江西求是高等研究院 一种cdn缓存替换方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291599A (zh) * 2011-05-07 2011-12-21 董友球 网络视频播放方法及网络视频播放装置
US20140059244A1 (en) * 2012-08-24 2014-02-27 General Instrument Corporation Method and apparatus for streaming multimedia data with access point positioning information
CN103648019A (zh) * 2013-11-29 2014-03-19 乐视致新电子科技(天津)有限公司 一种基于hls协议的视频下载方法及其装置
CN103648011A (zh) * 2013-11-29 2014-03-19 乐视致新电子科技(天津)有限公司 一种基于hls协议的音视频同步装置和方法
CN104363472A (zh) * 2014-10-20 2015-02-18 中兴通讯股份有限公司 基于hls的能力控制方法及服务系统和slb服务器

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022123A1 (en) * 2005-07-20 2007-01-25 Marndi Raj N Methods and devices for use in transferring an electronic file
CN102487458A (zh) * 2010-12-02 2012-06-06 中兴通讯股份有限公司 Ts文件的播放处理方法及装置
US9257148B2 (en) * 2013-03-15 2016-02-09 JBF Interlude 2009 LTD System and method for synchronization of selectably presentable media streams
CN104410902B (zh) * 2014-12-04 2017-12-15 华为技术有限公司 一种直播节目的播放方法及终端、索引文件的生成方法及设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102291599A (zh) * 2011-05-07 2011-12-21 董友球 网络视频播放方法及网络视频播放装置
US20140059244A1 (en) * 2012-08-24 2014-02-27 General Instrument Corporation Method and apparatus for streaming multimedia data with access point positioning information
CN103648019A (zh) * 2013-11-29 2014-03-19 乐视致新电子科技(天津)有限公司 一种基于hls协议的视频下载方法及其装置
CN103648011A (zh) * 2013-11-29 2014-03-19 乐视致新电子科技(天津)有限公司 一种基于hls协议的音视频同步装置和方法
CN104363472A (zh) * 2014-10-20 2015-02-18 中兴通讯股份有限公司 基于hls的能力控制方法及服务系统和slb服务器

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10149193B2 (en) 2016-06-15 2018-12-04 At&T Intellectual Property I, L.P. Method and apparatus for dynamically managing network resources
US10505870B2 (en) 2016-11-07 2019-12-10 At&T Intellectual Property I, L.P. Method and apparatus for a responsive software defined network
US10673751B2 (en) 2017-04-27 2020-06-02 At&T Intellectual Property I, L.P. Method and apparatus for enhancing services in a software defined network
US11405310B2 (en) 2017-04-27 2022-08-02 At&T Intellectual Property I, L.P. Method and apparatus for selecting processing paths in a software defined network
US11146486B2 (en) 2017-04-27 2021-10-12 At&T Intellectual Property I, L.P. Method and apparatus for enhancing services in a software defined network
US10819606B2 (en) 2017-04-27 2020-10-27 At&T Intellectual Property I, L.P. Method and apparatus for selecting processing paths in a converged network
US10749796B2 (en) 2017-04-27 2020-08-18 At&T Intellectual Property I, L.P. Method and apparatus for selecting processing paths in a software defined network
US10952037B2 (en) 2017-05-09 2021-03-16 At&T Intellectual Property I, L.P. Multi-slicing orchestration system and method for service and/or content delivery
US10945103B2 (en) 2017-05-09 2021-03-09 At&T Intellectual Property I, L.P. Dynamic network slice-switching and handover system and method
US10602320B2 (en) 2017-05-09 2020-03-24 At&T Intellectual Property I, L.P. Multi-slicing orchestration system and method for service and/or content delivery
US10555134B2 (en) 2017-05-09 2020-02-04 At&T Intellectual Property I, L.P. Dynamic network slice-switching and handover system and method
US10257668B2 (en) 2017-05-09 2019-04-09 At&T Intellectual Property I, L.P. Dynamic network slice-switching and handover system and method
US10382903B2 (en) 2017-05-09 2019-08-13 At&T Intellectual Property I, L.P. Multi-slicing orchestration system and method for service and/or content delivery
US11115867B2 (en) 2017-07-25 2021-09-07 At&T Intellectual Property I, L.P. Method and system for managing utilization of slices in a virtual network function environment
US10070344B1 (en) 2017-07-25 2018-09-04 At&T Intellectual Property I, L.P. Method and system for managing utilization of slices in a virtual network function environment
US10631208B2 (en) 2017-07-25 2020-04-21 At&T Intellectual Property I, L.P. Method and system for managing utilization of slices in a virtual network function environment
US11032703B2 (en) 2017-12-18 2021-06-08 At&T Intellectual Property I, L.P. Method and apparatus for dynamic instantiation of virtual service slices for autonomous machines
US10516996B2 (en) 2017-12-18 2019-12-24 At&T Intellectual Property I, L.P. Method and apparatus for dynamic instantiation of virtual service slices for autonomous machines
CN111866603A (zh) * 2020-07-21 2020-10-30 广州市保伦电子有限公司 一种基于srs的视频文件生产方法、后台服务器和系统
CN112312162A (zh) * 2020-10-16 2021-02-02 安擎(天津)计算机有限公司 一种传输视频流的视频服务器
CN114666319A (zh) * 2022-03-02 2022-06-24 北京百度网讯科技有限公司 数据下载方法、装置、电子设备和可读存储介质
CN114666319B (zh) * 2022-03-02 2024-03-22 北京百度网讯科技有限公司 数据下载方法、装置、电子设备和可读存储介质

Also Published As

Publication number Publication date
US20180227648A1 (en) 2018-08-09
CN105657578A (zh) 2016-06-08
CN105657578B (zh) 2018-06-29

Similar Documents

Publication Publication Date Title
WO2017071228A1 (zh) 基于hls协议的直播方法、系统及客户端
US9167311B2 (en) Variant playlist optimization
TWI580237B (zh) 單一播放適應性位元率串流
US8516144B2 (en) Startup bitrate in adaptive bitrate streaming
US10397289B2 (en) HTTP live streaming (HLS) video client synchronization
US10225319B2 (en) System and method of a link surfed http live streaming broadcasting system
US20160149978A1 (en) Streaming of segmented content
CN104581374B (zh) 一种获取切片文件和生成子m3u8文件的方法、节点及服务器
US20150200992A1 (en) Method for downloading, at a client terminal, an upcoming sequence of segments of a multimedia content, and corresponding terminal
WO2017096830A1 (zh) 用于cdn平台的内容分发方法及调度代理服务器
US9356985B2 (en) Streaming video to cellular phones
WO2019128800A1 (zh) 一种内容服务的实现方法、装置及内容分发网络节点
US20120221681A1 (en) Method, apparatus and system for hierarchically requesting contents in a http streaming system
JP6338709B2 (ja) ストリーミング装置とその方法、これを用いたストリーミングサービスシステム及びコンピュータ読み取り可能な記録媒体(Streaming apparatus and method thereof,streaming service system using the streaming apparatus and computer readable recording medium)
CN108810052A (zh) 直播服务器的选择方法及装置
US20160381127A1 (en) Systems and methods for dynamic networked peer-to-peer content distribution
KR102457526B1 (ko) 미디어 스트림 송신 방법, 장치, 시스템, 및 디바이스
US20160036883A1 (en) Systems and methods for selective transport accelerator operation
CN106105145B (zh) 用于操作沿客户端终端和至少一个服务器之间的传输路径布置的缓存器的方法、及相应的缓存器
WO2016074149A1 (en) Expedited media content delivery
van der Hooft et al. Performance characterization of low-latency adaptive streaming from video portals
van der Hooft et al. An HTTP/2 push-based framework for low-latency adaptive streaming through user profiling
CN105933796A (zh) 基于http实时流的多媒体内容的提供方法及装置、终端设备
Episkopos Peer-to-Peer video content delivery optimization service in a distributed network
JP7128967B2 (ja) マルチメディアストリーミングコンテンツを提供する方法、装置、及びコンピュータプログラム

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 15120244

Country of ref document: US

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

Ref document number: 16858671

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16858671

Country of ref document: EP

Kind code of ref document: A1