WO2016101240A1 - 媒体数据播放的方法及终端 - Google Patents

媒体数据播放的方法及终端 Download PDF

Info

Publication number
WO2016101240A1
WO2016101240A1 PCT/CN2014/095063 CN2014095063W WO2016101240A1 WO 2016101240 A1 WO2016101240 A1 WO 2016101240A1 CN 2014095063 W CN2014095063 W CN 2014095063W WO 2016101240 A1 WO2016101240 A1 WO 2016101240A1
Authority
WO
WIPO (PCT)
Prior art keywords
code rate
media data
rate
buffer
client
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/CN2014/095063
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.)
Shenzhen TCL Digital Technology Co Ltd
Original Assignee
Shenzhen TCL Digital Technology 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 Shenzhen TCL Digital Technology Co Ltd filed Critical Shenzhen TCL Digital Technology Co Ltd
Publication of WO2016101240A1 publication Critical patent/WO2016101240A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/437Interfacing the upstream path of the transmission network, e.g. for transmitting client requests to a VOD server
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk

Definitions

  • the present invention relates to the field of media playback technologies, and in particular, to a method and a terminal for playing media data.
  • the terminal's playback system supports high and low bit rate switching.
  • a chat system with video, audio and subtitles can directly discard the video part and even remove the video and audio parts in the case of insufficient bandwidth. Leave the display of subtitles.
  • the speed of restarting playback after switching the code rate is slow.
  • a playback source with video, audio and subtitles due to insufficient bandwidth, the amount of data acquired from the server per unit time will be reduced, the playback system retrieves the source from the server, and then removes the video portion, according to the existing If the cache policy is used to start playback, it will take a long time to cache the original amount of data. After the code rate is switched, the playback speed is slower.
  • the main object of the present invention is to provide a method and a terminal for playing media data, aiming at solving the technical problem that the speed of restarting playback after switching the code rate is slow.
  • the present invention provides a method for playing media data, and the method for playing media data includes the following steps:
  • the media data buffered by the client is cleared and a request for acquiring new media data is sent to the server;
  • the buffered new media data is sent to the player for playback.
  • the step of obtaining the current code rate, and calculating the current data volume buffer rate Rs and the average code rate buffer time ratio Rt according to the code rate includes:
  • Calculating a current data volume buffer ratio Rs according to the code rate and the set buffer data maximum value Ms calculating an average code rate buffer time ratio Rt according to the code rate and the set cache maximum time Mt, wherein The S is the current buffered data amount, Ms is the set cache data amount maximum value, T is the cache data average code rate time, and Mt is the set cache maximum time.
  • the receiving and buffering the new media data sent by the server determining whether the new media data buffered by the client reaches a preset value according to the current data volume buffer rate Rs and the average code rate buffer time ratio Rt.
  • the steps include:
  • the receiving and buffering the new media data sent by the server determining whether the new media data buffered by the client reaches a preset value according to the current data volume buffer rate Rs and the average code rate buffer time ratio Rt.
  • the steps include:
  • the step of clearing the media data buffered by the client and sending the request for acquiring new media data to the server further includes:
  • the client detects whether the bandwidth changes or detects whether the rate switching instruction sent by the player is received.
  • the player is a gstreamer player.
  • the present invention further provides a terminal, where the terminal includes:
  • the clearing module is configured to: when the client of the terminal detects that the code rate switching is required, clear the media data buffered by the client and send a request for acquiring new media data to the server;
  • a calculation module configured to obtain a current code rate, and calculate a current data volume buffer rate Rs and an average code rate buffer time ratio Rt according to the code rate;
  • a judging module configured to receive and cache new media data sent by the server, and determine, according to the current data volume caching rate Rs and the average bit rate buffering time ratio Rt, whether the new media data buffered by the client reaches a preset value.
  • the sending module is configured to send the buffered new media data to the player for playing if the current data volume buffer rate Rs reaches 1 or the average time rate buffer time ratio Rt reaches 1.
  • the calculation module comprises:
  • a first obtaining unit configured to acquire a current code rate, a set cache data amount maximum value Ms, and a set cache maximum time Mt;
  • a calculating unit configured to calculate a current data volume buffer rate Rs according to the code rate and the set buffer data maximum value Ms: and calculate an average bit rate buffer time ratio according to the code rate and the set cache maximum time Mt Rt:, wherein S is the current buffered data amount, Ms is the set cache data amount maximum value, T is the cache data average code rate time, and Mt is the set cache maximum time.
  • the determining module comprises:
  • a comparing unit configured to compare the current data volume buffer rate Rs and the average code rate buffer time ratio Rt, and obtain a larger one of the current data volume buffer rate Rs and the average code rate buffer time ratio Rt;
  • a second acquiring unit configured to: when the value of the larger one reaches 1, acquire a time value corresponding to the value of the larger one reaching 1;
  • the determining unit is configured to determine whether the time of the new media data cached by the client reaches the time value, to determine whether the new media data buffered by the client reaches a preset value.
  • the determining module comprises:
  • a comparing unit configured to compare the current data volume buffer rate Rs and the average code rate buffer time ratio Rt, and obtain a larger one of the current data volume buffer rate Rs and the average code rate buffer time ratio Rt;
  • a second acquiring unit configured to: when the value of the larger one reaches 1, acquire a time value corresponding to the value of the larger one reaching 1;
  • the determining unit is configured to determine whether the time of the new media data cached by the client reaches the time value, to determine whether the new media data buffered by the client reaches a preset value.
  • the terminal further includes:
  • the detecting module is configured to: during the playing of the media data by the player, the client detects whether the bandwidth changes or detects whether the code rate switching instruction sent by the player is received.
  • the player is a gstreamer player.
  • the method and terminal for playing media data of the present invention when the client detects that a code rate switching is required, confirms whether the high code rate is switched to a low code rate or a low code rate to a high code rate, and then according to the current
  • the code rate calculates the current data volume buffer rate Rs and the average code rate buffer time ratio Rt, that is, whether the amount of new media data buffered by the client reaches a preset value by using the buffer amount or the buffer time, as long as one of them reaches the preset value. If the value is set, the client is considered to be cached and the player can restart the playback.
  • the present invention is based on the cache amount or cache time of the client, and can be quickly restarted regardless of insufficient bandwidth or insufficient playback performance of the terminal. To make the playback better.
  • FIG. 1 is a schematic flowchart of a first embodiment of a method for playing media data according to the present invention
  • FIG. 2 is a schematic diagram of a refinement process of step S102 in FIG. 1;
  • step S103 in FIG. 1 is a schematic diagram showing the refinement process of step S103 in FIG. 1;
  • FIG. 4 is a schematic flowchart diagram of a second embodiment of a method for playing media data according to the present invention.
  • FIG. 5 is a schematic diagram of functional modules of a first embodiment of a terminal according to the present invention.
  • FIG. 6 is a schematic diagram of a refinement function module of the calculation module in FIG. 5;
  • FIG. 7 is a schematic diagram of a refinement function module of the judging module in FIG. 5;
  • FIG. 8 is a schematic diagram of functional modules of a second embodiment of a terminal according to the present invention.
  • the present invention provides a method for playing media data.
  • the method for playing media data includes:
  • Step S101 when the client of the terminal detects that the code rate switching needs to be performed, clearing the media data buffered by the client and sending a request for acquiring new media data to the server;
  • the terminal may be a television, a computer, a tablet computer, a mobile phone, or the like.
  • the client of the terminal acquires media data from the server and caches the data, and then sends the cached media data to the player for playing.
  • the client responds to the user's operation, creates a play instance and requests media data from the server, and the server responds to the client request to media data in the elementary stream (Elementary Streams, ES) is sent to the client, and the elementary stream may contain one or more of video, audio, subtitles, and the like.
  • the elementary stream may contain one or more of video, audio, subtitles, and the like.
  • the client when the client detects that code rate switching is required, for example, when the current bandwidth is insufficient or the playback performance of the terminal is insufficient, rate switching is required.
  • the client empties the media data currently cached by itself to re-receive the media data sent by the server.
  • the client when detecting whether the rate switching needs to be performed, the client can detect whether to switch from a high code rate to a low code rate or a low code rate to a high code rate. A request to obtain corresponding media data is then sent to the server.
  • Step S102 obtaining a current code rate, and calculating a current data volume buffer rate Rs and an average code rate buffer time ratio Rt according to the code rate;
  • the current data buffer rate Rs refers to the ratio of the currently buffered data amount S to the set cache data amount maximum value Ms:
  • the current network speed is faster, the larger the current cached data amount S is, the larger the current data buffer rate Rs is, and the currently buffered data amount S is proportional to the current code rate, and therefore, according to the current The code rate is calculated to obtain the current buffered data amount S.
  • the average bit rate buffer time ratio Rt refers to the ratio of the buffer data average code rate time T to the set cache maximum time Mt:
  • the buffer data average code rate time T is inversely proportional to the current code rate, that is, the buffer data average code rate time T is smaller, and thus the average bit rate is The smaller the cache time ratio Rt.
  • the buffering strategy of this embodiment is based on the ratio of the current data volume buffer rate Rs and the average code rate buffer time ratio Rt.
  • Step S103 receiving and buffering new media data sent by the server, and determining, according to the current data volume buffer rate Rs and the average code rate buffer time ratio Rt, whether the new media data buffered by the client reaches a preset value;
  • the client receives the new media data sent by the server and caches it, and the client caches the new media data in a specific sample format, and each sample is independent, including descriptions of the new media data and the new media data. Dts, duration and other information.
  • the client receives the new media data sent by the server, and then determines the new media cached by the client according to the current data volume buffer rate Rs and the average code rate buffer time ratio Rt calculated above. Whether the data reaches the preset value.
  • Step S104 If the current data volume buffer rate Rs reaches 1 or the average code rate buffer time ratio Rt reaches 1, the buffered new media data is sent to the player for playing.
  • the player is preferably a gstreamer player
  • the gstreamer is a multimedia framework library for creating streaming media applications, which can provide functions for constructing various media function components, including simple audio playback, audio and video.
  • the gstreamer is a multimedia framework library for creating streaming media applications, which can provide functions for constructing various media function components, including simple audio playback, audio and video.
  • you can also create many multimedia applications such as video editors, streaming media and media players.
  • one of the current data volume buffer rate Rs or the average code rate buffer time ratio Rt reaches 100% first, then the client cache is completed, and the client sends the play information to the player to notify the player to restart. Play, the player creates a pipe and starts playback, and requests new media data from the client.
  • media data of different sources is divided.
  • the player requests media data from the client in a special request format, and the request format specification section contains the media data that needs to be requested and the number of media data requested. Regardless of whether it is a client or a player, media data of different sources are independently requested and independently stored, so that media data of different sources can be processed separately.
  • the player side saves the media data of different sources in different queues in a specific format, and sequentially obtains media data from the data queues in order according to the order of the media data requests, keeps the data synchronized and does not cause a certain way. The accumulation of media data.
  • the acknowledgment is whether the high code rate is switched to the low code rate or the low code rate is switched to the high code rate, and then according to the current code rate.
  • Calculating the current data volume buffer rate Rs and the average bit rate buffer time ratio Rt that is, whether the amount of new media data buffered by the client reaches a preset value by using the buffer amount or the buffer time, as long as one of them reaches the preset value
  • the player can restart the playback.
  • the cache policy is used according to the cache amount or the cache time of the client. Whether the bandwidth is insufficient or the playback performance of the terminal is insufficient, the playback can be restarted quickly. Make the playback better.
  • the foregoing step S102 includes:
  • Step S1021 acquiring the current code rate, the set cache data amount maximum value Ms, and the set cache maximum time Mt;
  • Step S1022 Calculate a current data volume buffer rate Rs according to the code rate and the set cache data amount maximum value Ms: and calculate an average code rate buffer time ratio Rt according to the code rate and the set cache maximum time Mt: .
  • the current data buffer rate Rs:;S is the current buffered data amount
  • Ms is the set cache data amount maximum, wherein the currently buffered data amount S is the current code rate A and the buffer time x.
  • Product of: S A*x.
  • the set cache maximum time Mt is the cache data average code rate time, and Mt is the set cache maximum time.
  • the average code rate A is the average of the code rate per unit time and the old average code rate v, wherein the code rate per unit time refers to the ratio of the received media data to the reception time in the set unit time:
  • the old average code rate v refers to the average code rate value calculated in the previous period of time. This period is set to N.
  • the average code rate A formula is:
  • the foregoing step S103 includes:
  • Step S1031 comparing the current data volume buffer rate Rs and the average code rate buffer time ratio Rt, and obtaining the larger of the current data volume buffer rate Rs and the average code rate buffer time ratio Rt;
  • Step S1032 when the value of the larger one reaches 1, obtaining a time value corresponding to the value of the larger one reaching 1;
  • Step S1033 Determine whether the time of the new media data buffered by the client reaches the time value, to determine whether the new media data buffered by the client reaches a preset value.
  • a buffer time x is preset, and then the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are calculated, when the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are two ratios.
  • one of the first reaches 100%, it is considered that the new media data cached by the client reaches the condition for restarting playback.
  • the maximum amount of cached data set by the client is 2M, and the cache time is x (the client clears the cache and sends a request for obtaining new media data to the server for the cache time).
  • the current code rate is 1.5M (for the convenience of calculation, assuming that the code rate does not fluctuate)
  • the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are respectively in the buffer time x after the code rate is switched.
  • the current data volume buffer rate Rs will be the first to be cached up to 100% before the rate change, and the time when the current data volume buffer rate Rs reaches 100% is the time of the new media data cached by the client. At this time, the playback is restarted, and the playback can be started quickly after the bit rate is switched;
  • the buffer time ratio Rt at the average bit rate first reaches 100%, and the time when the buffer time ratio Rt reaches 100% at the average code rate is the time of the new media data buffered by the client, when the time is reached. , restart playback, you can quickly start playback after the bit rate is switched.
  • the method includes:
  • Step S100 During the playing of the media data by the player, the client detects whether the bandwidth changes or detects whether the code rate switching instruction sent by the player is received.
  • the playback performance of the terminal is sufficient, and the client detects whether the bandwidth changes, that is, whether the bandwidth is changed from large to small or from small to large.
  • the client initiates the code. Rate switching.
  • the client clears the cache and requests new media data from the server, while sending a pause play command to the player.
  • the performance of the CPU may be sufficient but the performance of the decoder is insufficient, resulting in a high-rate video cannot be played.
  • the player Sending a code rate switching instruction to notify the client that the playback performance of the player is insufficient.
  • the client determines that the code rate switching is because the code rate is too high but the playback performance of the terminal is insufficient, causing the playback to fail, and then The client initiates the entire bit rate switch.
  • the terminal considering that there are many cases where rate switching occurs, it is impossible for the terminal to define a caching policy for each case, which will become complicated.
  • the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are the basis of the client cache policy, and the problem can be solved simply and reasonably.
  • the present invention further provides a terminal.
  • the terminal includes:
  • the clearing module 101 is configured to: when the client of the terminal detects that the code rate switching is required, clear the media data buffered by the client and send a request for acquiring new media data to the server;
  • the terminal may be a television, a computer, a tablet computer, a mobile phone, or the like.
  • the client of the terminal acquires media data from the server and caches the data, and then sends the cached media data to the player for playing.
  • the client responds to the user's operation, creates a play instance and requests media data from the server, and the server responds to the client request to media data in the elementary stream (Elementary Streams, ES) is sent to the client, and the elementary stream may contain one or more of video, audio, subtitles, and the like.
  • the elementary stream may contain one or more of video, audio, subtitles, and the like.
  • the client when the client detects that code rate switching is required, for example, when the current bandwidth is insufficient or the playback performance of the terminal is insufficient, rate switching is required.
  • the client empties the media data currently cached by itself to re-receive the media data sent by the server.
  • the client when detecting whether the rate switching needs to be performed, the client can detect whether to switch from a high code rate to a low code rate or a low code rate to a high code rate. A request to obtain corresponding media data is then sent to the server.
  • the calculating module 102 is configured to obtain a current code rate, and calculate a current data volume buffer rate Rs and an average code rate buffer time ratio Rt according to the code rate;
  • the current data buffer rate Rs refers to the ratio of the currently buffered data amount S to the set cache data amount maximum value Ms:
  • the current network speed is faster, the larger the current cached data amount S is, the larger the current data buffer rate Rs is, and the currently buffered data amount S is proportional to the current code rate, and therefore, according to the current The code rate is calculated to obtain the current buffered data amount S.
  • the average bit rate buffer time ratio Rt refers to the ratio of the buffer data average code rate time T to the set cache maximum time Mt:
  • the buffer data average code rate time T is inversely proportional to the current code rate, that is, the buffer data average code rate time T is smaller, and thus the average bit rate is The smaller the cache time ratio Rt.
  • the buffering strategy of this embodiment is based on the ratio of the current data volume buffer rate Rs and the average code rate buffer time ratio Rt.
  • the judging module 103 is configured to receive and cache new media data sent by the server, and determine, according to the current data volume caching rate Rs and the average bit rate buffering time ratio Rt, whether the new media data cached by the client reaches a preset. value;
  • the client receives the new media data sent by the server and caches it, and the client caches the new media data in a specific sample format, and each sample is independent, including descriptions of the new media data and the new media data. Dts, duration and other information.
  • the client receives the new media data sent by the server, and then determines the new media cached by the client according to the current data volume buffer rate Rs and the average code rate buffer time ratio Rt calculated above. Whether the data reaches the preset value.
  • the sending module 104 is configured to send the buffered new media data to the player for playing if the current data volume buffer rate Rs reaches 1 or the average time rate buffer time ratio Rt reaches 1.
  • the player is preferably a gstreamer player
  • the gstreamer is a multimedia framework library for creating streaming media applications, which can provide functions for constructing various media function components, including simple audio playback, audio and video.
  • the gstreamer is a multimedia framework library for creating streaming media applications, which can provide functions for constructing various media function components, including simple audio playback, audio and video.
  • you can also create many multimedia applications such as video editors, streaming media and media players.
  • one of the current data volume buffer rate Rs or the average code rate buffer time ratio Rt reaches 100% first, then the client cache is completed, and the client sends the play information to the player to notify the player to restart. Play, the player creates a pipe and starts playback, and requests new media data from the client.
  • media data of different sources is divided.
  • the player requests media data from the client in a special request format, and the request format specification section contains the media data that needs to be requested and the number of media data requested. Regardless of whether it is a client or a player, media data of different sources are independently requested and independently stored, so that media data of different sources can be processed separately.
  • the player side saves the media data of different sources in different queues in a specific format, and sequentially obtains media data from the data queues in order according to the order of the media data requests, keeps the data synchronized and does not cause a certain way. The accumulation of media data.
  • the computing module 102 includes:
  • the first obtaining unit 1021 is configured to acquire a current code rate, a set cache data amount maximum value Ms, and a set cache maximum time Mt;
  • the calculating unit 1022 is configured to calculate a current data volume buffer rate Rs according to the code rate and the set buffer data maximum value Ms, and calculate an average bit rate buffer time according to the code rate and the set cache maximum time Mt. Ratio Rt:.
  • the current data buffer rate Rs:;S is the current buffered data amount
  • Ms is the set cache data amount maximum, wherein the currently buffered data amount S is the current code rate A and the buffer time x.
  • Product of: S A*x.
  • the set cache maximum time Mt is the cache data average code rate time, and Mt is the set cache maximum time.
  • the average code rate A is the average of the code rate per unit time and the old average code rate v, wherein the code rate per unit time refers to the ratio of the received media data to the reception time in the set unit time:
  • the old average code rate v refers to the average code rate value calculated in the previous period of time. This period is set to N.
  • the average code rate A formula is:
  • the determining module 103 includes:
  • the comparing unit 1031 is configured to compare the current data volume buffer rate Rs and the average code rate buffer time ratio Rt, and obtain the larger of the current data volume buffer rate Rs and the average code rate buffer time ratio Rt. ;
  • the second obtaining unit 1032 is configured to: when the value of the larger one reaches 1, acquire a time value corresponding to the value of the larger one reaching 1;
  • the determining unit 1033 is configured to determine whether the time of the new media data buffered by the client reaches the time value, to determine whether the new media data buffered by the client reaches a preset value.
  • a buffer time x is preset, and then the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are calculated, when the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are two ratios.
  • one of the first reaches 100%, it is considered that the new media data cached by the client reaches the condition for restarting playback.
  • the maximum amount of cached data set by the client is 2M, and the cache time is x (the client clears the cache and sends a request for obtaining new media data to the server for the cache time).
  • the current code rate is 1.5M (for the convenience of calculation, assuming that the code rate does not fluctuate)
  • the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are respectively in the buffer time x after the code rate is switched.
  • the current data volume buffer rate Rs will be the first to be cached up to 100% before the rate change, and the time when the current data volume buffer rate Rs reaches 100% is the time of the new media data cached by the client. At this time, the playback is restarted, and the playback can be started quickly after the bit rate is switched;
  • the buffer time ratio Rt at the average bit rate first reaches 100%, and the time when the buffer time ratio Rt reaches 100% at the average code rate is the time of the new media data buffered by the client, when the time is reached. , restart playback, you can quickly start playback after the bit rate is switched.
  • the terminal further includes:
  • the detecting module 100 is configured to: during the playing of the media data by the player, the client detects whether the bandwidth changes or detects whether the code rate switching instruction sent by the player is received.
  • the playback performance of the terminal is sufficient, and the client detects whether the bandwidth changes, that is, whether the bandwidth is changed from large to small or from small to large.
  • the client initiates the code. Rate switching.
  • the client clears the cache and requests new media data from the server, while sending a pause play command to the player.
  • the performance of the CPU may be sufficient but the performance of the decoder is insufficient, resulting in a high-rate video cannot be played.
  • the player Sending a code rate switching instruction to notify the client that the playback performance of the player is insufficient.
  • the client determines that the code rate switching is because the code rate is too high but the playback performance of the terminal is insufficient, causing the playback to fail, and then The client initiates the entire bit rate switch.
  • the terminal considering that there are many cases where rate switching occurs, it is impossible for the terminal to define a caching policy for each case, which will become complicated.
  • the current data volume buffer rate Rs and the average code rate buffer time ratio Rt are the basis of the client cache policy, and the problem can be solved simply and reasonably.

Landscapes

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

Abstract

本发明公开了一种媒体数据播放的方法及终端,所述媒体数据播放的方法包括以下步骤:当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。本发明能够在码率切换时快速重新启动播放。

Description

媒体数据播放的方法及终端
技术领域
本发明涉及媒体播放技术领域,尤其涉及一种媒体数据播放的方法及终端。
背景技术
目前,终端的播放系统支持进行高低码率的切换,例如,一个同时带视频、音频和字幕的聊天系统,在带宽不足的情况下,可直接舍弃视频部分,甚至同时去掉视频和音频部分,只留下字幕的显示。
当进行码率切换时,不论是舍弃部分的资源或者切换播放源,都可能导致另一个问题:切换码率后重新启动播放的速度变慢。例如,一个带视频、音频和字幕的播放源,由于带宽不足,则此时单位时间内从服务器获取的数据量就会减少,播放系统从服务器获取播放源,然后去掉视频部分,按照现有的缓存策略来启动播放,则要缓存原来预定的数据量就需要等待较长的时间,导致码率切换后,重新启动播放的速度较慢。另外,即使在相同的网络环境下,不同的终端的CPU或者解码器等的性能存在差异,特别是终端上述的这些性能较差时,根据带宽来确定播放系统的码率,同样也会导致重新启动播放的速度较慢的问题。
上述内容仅用于辅助理解本发明的技术方案,并不代表承认上述内容是现有技术。
发明内容
本发明的主要目的在于提供一种媒体数据播放的方法及终端,旨在解决切换码率后重新启动播放的速度变慢的技术问题。
为实现上述目的,本发明提供一种媒体数据播放的方法,所述媒体数据播放的方法包括以下步骤:
当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;
获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;
接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;
若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。
优选地,所述获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt的步骤包括:
获取当前的码率、设定的缓存数据量最大值Ms及设定的缓存最大时间Mt;
根据所述码率及设定的缓存数据量最大值Ms计算当前数据量缓存率Rs:,根据所述码率及设定的缓存最大时间Mt计算平均码率下缓存时间比率Rt:,其中,所述S为当前缓存的数据量,Ms为设定的缓存数据量最大值,T为缓存数据平均码率时间,Mt为设定的缓存最大时间。
优选地,所述接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值的步骤包括:
比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
优选地,所述接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值的步骤包括:
比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
优选地,所述当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求的步骤之前还包括:
在所述播放器播放媒体数据的过程中,客户端检测带宽是否发生变化或者检测是否接收到所述播放器发送的码率切换指令。
优选地,所述播放器为gstreamer播放器。
此外,为实现上述目的,本发明还提供一种终端,所述终端包括:
清空模块,用于当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;
计算模块,用于获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;
判断模块,用于接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;
发送模块,用于若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。
优选地,所述计算模块包括:
第一获取单元,用于获取当前的码率、设定的缓存数据量最大值Ms及设定的缓存最大时间Mt;
计算单元,用于根据所述码率及设定的缓存数据量最大值Ms计算当前数据量缓存率Rs:,根据所述码率及设定的缓存最大时间Mt计算平均码率下缓存时间比率Rt:,其中,所述S为当前缓存的数据量,Ms为设定的缓存数据量最大值,T为缓存数据平均码率时间,Mt为设定的缓存最大时间。
优选地,所述判断模块包括:
比较单元,用于比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
第二获取单元,用于当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
判断单元,用于判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
优选地,所述判断模块包括:
比较单元,用于比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
第二获取单元,用于当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
判断单元,用于判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
优选地,所述终端还包括:
检测模块,用于在所述播放器播放媒体数据的过程中,客户端检测带宽是否发生变化或者检测是否接收到所述播放器发送的码率切换指令。
优选地,所述播放器为gstreamer播放器。
本发明一种媒体数据播放的方法及终端,当客户端检测到需要进行码率切换时,确认是由高码率切换为低码率还是由低码率切换为高码率,然后根据当前的码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt,即以缓存量或缓存时间来对客户端缓存的新媒体数据的量是否达到预设值进行判断,只要其中一个达到预设值,则认为客户端缓存完成,播放器可以重新启动播放,本发明根据客户端的缓存量或缓存时间为缓存策略的依据,无论是带宽不足或终端的播放性能不足,均能够快速重新启动播放,使播放的效果更佳。
附图说明
图1为本发明媒体数据播放的方法第一实施例的流程示意图;
图2为图1中步骤S102的细化流程示意图;
图3为图1中步骤S103的细化流程示意图;
图4为本发明媒体数据播放的方法第二实施例的流程示意图;
图5为本发明终端第一实施例的功能模块示意图;
图6为图5中计算模块的细化功能模块示意图;
图7为图5中判断模块的细化功能模块示意图;
图8为本发明终端第二实施例的功能模块示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明提供一种媒体数据播放的方法,参照图1,在一实施例中,该媒体数据播放的方法包括:
步骤S101,当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;
本实施例中,终端可以是电视、电脑、平板电脑或者手机等等。
本实施例中,终端的客户端从服务器上获取媒体数据并进行缓存,然后将缓存的媒体数据发送给播放器进行播放。
本实施例中,客户端响应用户的操作,创建播放实例并向服务器请求媒体数据,服务器端响应客户端的请求,将媒体数据以基本码流(Elementary Streams,ES)的形式发送给客户端,基本码流可能包含视频、音频、字幕等的其中一个或多个。
本实施例中,当客户端检测到需要进行码率切换时,例如,当前的带宽不足或者终端的播放性能不足时,需要进行码率切换。客户端将自身当前缓存的媒体数据清空,以重新接收服务器发送的媒体数据。
本实施例中,客户端在检测是否需要进行码率切换时,能够检测到是由高码率切换为低码率还是由低码率切换为高码率。然后向服务器发送获取对应的媒体数据的请求。
步骤S102,获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;
本实施例中,当前数据缓存量率Rs是指当前缓存的数据量S和设定的缓存数据量最大值Ms的比值:
如果当前的网速越快,累积的当前缓存的数据量S越大,当前数据缓存量率Rs就越大,而当前缓存的数据量S与当前的码率成正比关系,因此,可以根据当前的码率计算得到当前缓存的数据量S。
本实施例中,平均码率下缓存时间比率Rt是指缓存数据平均码率时间T和设定的缓存最大时间Mt的比值:
如果当前的网速越快,累积一定的缓存数据量越快,而缓存数据平均码率时间T与当前的码率成反比关系,即缓存数据平均码率时间T越小,从而平均码率下缓存时间比率Rt越小。
本实施例的缓存策略以当前数据量缓存率Rs及平均码率下缓存时间比率Rt这两个比值为依据。
步骤S103,接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;
本实施例中,客户端接收服务器端的发送的新媒体数据并进行缓存,客户端以特定的样本形式缓存新媒体数据,每个样本都是独立的,包括新媒体数据及新媒体数据的说明如dts、duration等信息。
本实施例中,在当前的码率下,客户端接收服务器发送的新媒体数据,然后根据上述计算得到的当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断客户端缓存的新媒体数据是否达到预设值。
本实施例中,如果当前数据量缓存率Rs达到100%或者平均码率下缓存时间比率Rt达到100%均认为客户端缓存的新媒体数据已经达到预设值,可以重新启动播放。
步骤S104,若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。
本实施例中,播放器优选地为gstreamer播放器,gstreamer是一个用于创建流媒体应用程序的多媒体框架库,其可以提供构建各种媒体功能组件的功能,包括简单的音频回放、音频和视频播放、录音、流媒体和音频编辑等,还可以创建诸如视频编辑器、流媒体广播和媒体播放器等等的很多多媒体应用等。
本实施例中,当前数据量缓存率Rs或平均码率下缓存时间比率Rt两者中的一个先达到100%,则客户端缓存完成,客户端发送播放信息给播放器,通知播放器重新启动播放,播放器创建管道并开始启动播放,并从客户端请求新媒体数据。
本实施例中,对不同源的媒体数据进行划分。播放器以特殊的请求格式向客户端请求媒体数据,请求格式说明部分包含需要请求哪一路媒体数据及请求的媒体数据的个数。无论是客户端还是播放器,对不同源的媒体数据都是独立请求和独立保存的,这样就可以做到对不同源的媒体数据有分别的进行处理。播放器端将不同源的媒体数据以特定的格式保存在不同的队列中,按媒体数据请求的先后顺序,从这些数据队列中有序获取媒体数据进行播放,保持数据的同步并且不造成某一路媒体数据的堆积。
与现有技术相比,本实施例当客户端检测到需要进行码率切换时,确认是由高码率切换为低码率还是由低码率切换为高码率,然后根据当前的码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt,即以缓存量或缓存时间来对客户端缓存的新媒体数据的量是否达到预设值进行判断,只要其中一个达到预设值,则认为客户端缓存完成,播放器可以重新启动播放,本实施例根据客户端的缓存量或缓存时间为缓存策略的依据,无论是带宽不足或终端的播放性能不足,均能够快速重新启动播放,使播放的效果更佳。
在一优选的实施例中,如图2所示,在上述图1的实施例的基础上,上述步骤S102包括:
步骤S1021,获取当前的码率、设定的缓存数据量最大值Ms及设定的缓存最大时间Mt;
步骤S1022,根据所述码率及设定的缓存数据量最大值Ms计算当前数据量缓存率Rs:,根据所述码率及设定的缓存最大时间Mt计算平均码率下缓存时间比率Rt:。
本实施例中,当前数据缓存量率Rs:;S为当前缓存的数据量,Ms为设定的缓存数据量最大值,其中,当前缓存的数据量S为当前的码率A与缓存时间x的乘积:S=A*x。
本实施例中,设定的缓存最大时间Mt:;T为缓存数据平均码率时间,Mt为设定的缓存最大时间。
优选地,缓存数据平均码率时间T是当前缓存的数据量S和平均码率A的比值:T=S/A。
其中,平均码率A是单位时间的码率与旧平均码率v的均值,其中单位时间的码率是指设定的单位时间内接收媒体数据与接收时间的比值:。
旧平均码率v是指之前的一段时间计算的平均码率值,这一段时间定为N个,当缓存时间超过N个时的平均码率A公式为:
在一优选的实施例中,如图3所示,在上述图1的实施例的基础上,上述步骤S103包括:
步骤S1031,比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
步骤S1032,当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
步骤S1033,判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
本实施例中,预设一缓存时间x,然后计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt,当当前数据量缓存率Rs及平均码率下缓存时间比率Rt这两个比值中的一个先达到100%时,则认为客户端缓存的新媒体数据达到重新启动播放的条件。
例如,假设是一个音视频混合播放的场景,客户端设定的缓存数据量最大值Ms为2M,缓存时间为x(以客户端清空缓存并向服务器发送获取新媒体数据的请求为缓存时间的起点),当前的码率为1.5M(为计算方便,假设码率没有波动),则码率发生切换后的缓存时间x内当前数据量缓存率Rs及平均码率下缓存时间比率Rt分别为:
此时如果当前的码率降为0.2M(假设码率没有波动),此时两者为:
以上数据可以看出,码率变化前当前数据量缓存率Rs会率先缓存达到100%,则以当前数据量缓存率Rs达到100%时的时间为客户端缓存的新媒体数据的时间,当达到该时间时,重新启动播放,可以在码率切换后快速启动播放;
码率下降后平均码率下缓存时间比率Rt则首先达到100%,则以平均码率下缓存时间比率Rt达到100%时的时间为客户端缓存的新媒体数据的时间,当达到该时间时,重新启动播放,可以在码率切换后快速启动播放。
在一优选的实施例中,如图4所示,在上述图1的实施例的基础上,在上述步骤S101之前包括:
步骤S100,在所述播放器播放媒体数据的过程中,客户端检测带宽是否发生变化或者检测是否接收到所述播放器发送的码率切换指令。
本实施例中,对于终端的播放性能足够,由客户端检测带宽是否发生变化,即带宽由大变小还是由小变大,对于带宽发生变化而进行码率切换的情况,由客户端发起码率切换。在码率切换时,客户端清空缓存并向服务器请求新媒体数据,同时向播放器发送暂停播放指令。
当网络的带宽充足,但是终端的播放性能不足时,例如手机客户端,可能cpu的性能足够但是解码器的性能不足,导致的高码率的视频无法播放时,对于这种情况,由播放器发送码率切换指令,通知客户端播放器的播放性能不足,客户端收到码率切换指令后,判断码率切换是因为码率过高但是终端的播放性能不足而导致播放失败,然后还是由客户端发起整个码率切换。
本实施例中,考虑到发生码率切换的情况较多,终端不可能为每一种情况均定义一种缓存策略,这样将变得复杂。本实施例以当前数据量缓存率Rs及平均码率下缓存时间比率Rt为客户端缓存策略的依据,能够简单并合理地解决该问题。
本发明还提供一种终端,如图5所示,在一实施例中,终端包括:
清空模块101,用于当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;
本实施例中,终端可以是电视、电脑、平板电脑或者手机等等。
本实施例中,终端的客户端从服务器上获取媒体数据并进行缓存,然后将缓存的媒体数据发送给播放器进行播放。
本实施例中,客户端响应用户的操作,创建播放实例并向服务器请求媒体数据,服务器端响应客户端的请求,将媒体数据以基本码流(Elementary Streams,ES)的形式发送给客户端,基本码流可能包含视频、音频、字幕等的其中一个或多个。
本实施例中,当客户端检测到需要进行码率切换时,例如,当前的带宽不足或者终端的播放性能不足时,需要进行码率切换。客户端将自身当前缓存的媒体数据清空,以重新接收服务器发送的媒体数据。
本实施例中,客户端在检测是否需要进行码率切换时,能够检测到是由高码率切换为低码率还是由低码率切换为高码率。然后向服务器发送获取对应的媒体数据的请求。
计算模块102,用于获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;
本实施例中,当前数据缓存量率Rs是指当前缓存的数据量S和设定的缓存数据量最大值Ms的比值:
如果当前的网速越快,累积的当前缓存的数据量S越大,当前数据缓存量率Rs就越大,而当前缓存的数据量S与当前的码率成正比关系,因此,可以根据当前的码率计算得到当前缓存的数据量S。
本实施例中,平均码率下缓存时间比率Rt是指缓存数据平均码率时间T和设定的缓存最大时间Mt的比值:
如果当前的网速越快,累积一定的缓存数据量越快,而缓存数据平均码率时间T与当前的码率成反比关系,即缓存数据平均码率时间T越小,从而平均码率下缓存时间比率Rt越小。
本实施例的缓存策略以当前数据量缓存率Rs及平均码率下缓存时间比率Rt这两个比值为依据。
判断模块103,用于接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;
本实施例中,客户端接收服务器端的发送的新媒体数据并进行缓存,客户端以特定的样本形式缓存新媒体数据,每个样本都是独立的,包括新媒体数据及新媒体数据的说明如dts、duration等信息。
本实施例中,在当前的码率下,客户端接收服务器发送的新媒体数据,然后根据上述计算得到的当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断客户端缓存的新媒体数据是否达到预设值。
本实施例中,如果当前数据量缓存率Rs达到100%或者平均码率下缓存时间比率Rt达到100%均认为客户端缓存的新媒体数据已经达到预设值,可以重新启动播放。
发送模块104,用于若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。
本实施例中,播放器优选地为gstreamer播放器,gstreamer是一个用于创建流媒体应用程序的多媒体框架库,其可以提供构建各种媒体功能组件的功能,包括简单的音频回放、音频和视频播放、录音、流媒体和音频编辑等,还可以创建诸如视频编辑器、流媒体广播和媒体播放器等等的很多多媒体应用等。
本实施例中,当前数据量缓存率Rs或平均码率下缓存时间比率Rt两者中的一个先达到100%,则客户端缓存完成,客户端发送播放信息给播放器,通知播放器重新启动播放,播放器创建管道并开始启动播放,并从客户端请求新媒体数据。
本实施例中,对不同源的媒体数据进行划分。播放器以特殊的请求格式向客户端请求媒体数据,请求格式说明部分包含需要请求哪一路媒体数据及请求的媒体数据的个数。无论是客户端还是播放器,对不同源的媒体数据都是独立请求和独立保存的,这样就可以做到对不同源的媒体数据有分别的进行处理。播放器端将不同源的媒体数据以特定的格式保存在不同的队列中,按媒体数据请求的先后顺序,从这些数据队列中有序获取媒体数据进行播放,保持数据的同步并且不造成某一路媒体数据的堆积。
在一优选的实施例中,如图6所示,在上述图5的实施例的基础上,所述计算模块102包括:
第一获取单元1021,用于获取当前的码率、设定的缓存数据量最大值Ms及设定的缓存最大时间Mt;
计算单元1022,用于根据所述码率及设定的缓存数据量最大值Ms计算当前数据量缓存率Rs:,根据所述码率及设定的缓存最大时间Mt计算平均码率下缓存时间比率Rt:。
本实施例中,当前数据缓存量率Rs:;S为当前缓存的数据量,Ms为设定的缓存数据量最大值,其中,当前缓存的数据量S为当前的码率A与缓存时间x的乘积:S=A*x。
本实施例中,设定的缓存最大时间Mt:;T为缓存数据平均码率时间,Mt为设定的缓存最大时间。
优选地,缓存数据平均码率时间T是当前缓存的数据量S和平均码率A的比值:T=S/A。
其中,平均码率A是单位时间的码率与旧平均码率v的均值,其中单位时间的码率是指设定的单位时间内接收媒体数据与接收时间的比值:。
旧平均码率v是指之前的一段时间计算的平均码率值,这一段时间定为N个,当缓存时间超过N个时的平均码率A公式为:
在一优选的实施例中,如图7所示,在上述图5的实施例的基础上,所述判断模块103包括:
比较单元1031,用于比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
第二获取单元1032,用于当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
判断单元1033,用于判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
本实施例中,预设一缓存时间x,然后计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt,当当前数据量缓存率Rs及平均码率下缓存时间比率Rt这两个比值中的一个先达到100%时,则认为客户端缓存的新媒体数据达到重新启动播放的条件。
例如,假设是一个音视频混合播放的场景,客户端设定的缓存数据量最大值Ms为2M,缓存时间为x(以客户端清空缓存并向服务器发送获取新媒体数据的请求为缓存时间的起点),当前的码率为1.5M(为计算方便,假设码率没有波动),则码率发生切换后的缓存时间x内当前数据量缓存率Rs及平均码率下缓存时间比率Rt分别为:
此时如果当前的码率降为0.2M(假设码率没有波动),此时两者为:
以上数据可以看出,码率变化前当前数据量缓存率Rs会率先缓存达到100%,则以当前数据量缓存率Rs达到100%时的时间为客户端缓存的新媒体数据的时间,当达到该时间时,重新启动播放,可以在码率切换后快速启动播放;
码率下降后平均码率下缓存时间比率Rt则首先达到100%,则以平均码率下缓存时间比率Rt达到100%时的时间为客户端缓存的新媒体数据的时间,当达到该时间时,重新启动播放,可以在码率切换后快速启动播放。
在一优选的实施例中,如图8所示,在上述图5的实施例的基础上,所述终端还包括:
检测模块100,用于在所述播放器播放媒体数据的过程中,客户端检测带宽是否发生变化或者检测是否接收到所述播放器发送的码率切换指令。
本实施例中,对于终端的播放性能足够,由客户端检测带宽是否发生变化,即带宽由大变小还是由小变大,对于带宽发生变化而进行码率切换的情况,由客户端发起码率切换。在码率切换时,客户端清空缓存并向服务器请求新媒体数据,同时向播放器发送暂停播放指令。
当网络的带宽充足,但是终端的播放性能不足时,例如手机客户端,可能cpu的性能足够但是解码器的性能不足,导致的高码率的视频无法播放时,对于这种情况,由播放器发送码率切换指令,通知客户端播放器的播放性能不足,客户端收到码率切换指令后,判断码率切换是因为码率过高但是终端的播放性能不足而导致播放失败,然后还是由客户端发起整个码率切换。
本实施例中,考虑到发生码率切换的情况较多,终端不可能为每一种情况均定义一种缓存策略,这样将变得复杂。本实施例以当前数据量缓存率Rs及平均码率下缓存时间比率Rt为客户端缓存策略的依据,能够简单并合理地解决该问题。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (12)

  1. 一种媒体数据播放的方法,其特征在于,所述媒体数据播放的方法包括以下步骤:
    当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;
    获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;
    接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;
    若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。
  2. 如权利要求1所述的媒体数据播放的方法,其特征在于,所述获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt的步骤包括:
    获取当前的码率、设定的缓存数据量最大值Ms及设定的缓存最大时间Mt;
    根据所述码率及设定的缓存数据量最大值Ms计算当前数据量缓存率Rs:,根据所述码率及设定的缓存最大时间Mt计算平均码率下缓存时间比率Rt:,其中,所述S为当前缓存的数据量,Ms为设定的缓存数据量最大值,T为缓存数据平均码率时间,Mt为设定的缓存最大时间。
  3. 如权利要求1所述的媒体数据播放的方法,其特征在于,所述接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值的步骤包括:
    比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
    当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
    判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
  4. 如权利要求2所述的媒体数据播放的方法,其特征在于,所述接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值的步骤包括:
    比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
    当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
    判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
  5. 如权利要求1所述的媒体数据播放的方法,其特征在于,所述当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求的步骤之前还包括:
    在所述播放器播放媒体数据的过程中,客户端检测带宽是否发生变化或者检测是否接收到所述播放器发送的码率切换指令。
  6. 如权利要求1所述的媒体数据播放的方法,其特征在于,所述播放器为gstreamer播放器。
  7. 一种终端,其特征在于,所述终端包括:
    清空模块,用于当终端的客户端检测到需要进行码率切换时,清空所述客户端缓存的媒体数据并向服务器发送获取新媒体数据的请求;
    计算模块,用于获取当前的码率,根据所述码率计算当前数据量缓存率Rs及平均码率下缓存时间比率Rt;
    判断模块,用于接收并缓存所述服务器发送的新媒体数据,根据所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt判断所述客户端缓存的新媒体数据是否达到预设值;
    发送模块,用于若当前数据量缓存率Rs达到1或者平均码率下缓存时间比率Rt达到1,则将所缓存的新媒体数据发送至所述播放器进行播放。
  8. 如权利要求6所述的终端,其特征在于,所述计算模块包括:
    第一获取单元,用于获取当前的码率、设定的缓存数据量最大值Ms及设定的缓存最大时间Mt;
    计算单元,用于根据所述码率及设定的缓存数据量最大值Ms计算当前数据量缓存率Rs:,根据所述码率及设定的缓存最大时间Mt计算平均码率下缓存时间比率Rt:,其中,所述S为当前缓存的数据量,Ms为设定的缓存数据量最大值,T为缓存数据平均码率时间,Mt为设定的缓存最大时间。
  9. 如权利要求6所述的终端,其特征在于,所述判断模块包括:
    比较单元,用于比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
    第二获取单元,用于当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
    判断单元,用于判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
  10. 如权利要求7所述的终端,其特征在于,所述判断模块包括:
    比较单元,用于比较所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt的大小,获取所述当前数据量缓存率Rs及平均码率下缓存时间比率Rt中的较大者;
    第二获取单元,用于当所述较大者的值到达1时,获取所述较大者的值到达1对应的时间值;
    判断单元,用于判断所述客户端缓存的新媒体数据的时间是否达到所述时间值,以判断所述客户端缓存的新媒体数据是否达到预设值。
  11. 如权利要求7所述的终端,其特征在于,所述终端还包括:
    检测模块,用于在所述播放器播放媒体数据的过程中,客户端检测带宽是否发生变化或者检测是否接收到所述播放器发送的码率切换指令。
  12. 如权利要求7所述的终端,其特征在于,所述播放器为gstreamer播放器。
PCT/CN2014/095063 2014-12-23 2014-12-26 媒体数据播放的方法及终端 Ceased WO2016101240A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410812144.7A CN105791987B (zh) 2014-12-23 2014-12-23 媒体数据播放的方法及终端
CN201410812144.7 2014-12-23

Publications (1)

Publication Number Publication Date
WO2016101240A1 true WO2016101240A1 (zh) 2016-06-30

Family

ID=56148969

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/095063 Ceased WO2016101240A1 (zh) 2014-12-23 2014-12-26 媒体数据播放的方法及终端

Country Status (2)

Country Link
CN (1) CN105791987B (zh)
WO (1) WO2016101240A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110460875A (zh) * 2019-08-05 2019-11-15 北京达佳互联信息技术有限公司 一种视频码率的切换方法、装置、电子设备及存储介质
CN114640886A (zh) * 2022-02-28 2022-06-17 深圳市宏电技术股份有限公司 自适应带宽的音视频传输方法、装置、计算机设备及介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111479171B (zh) 2019-01-23 2022-05-20 上海哔哩哔哩科技有限公司 Web播放不同视频源间的伪无缝切换方法、装置及介质
CN109547846B (zh) * 2019-01-31 2021-08-24 海信视像科技股份有限公司 一种hls码流切换方法、装置以及设备
CN112702620A (zh) * 2020-12-29 2021-04-23 四川长虹电器股份有限公司 一种基于gstreamer的播放器实现多屏同步播放的方法
CN115209199A (zh) * 2022-06-10 2022-10-18 视联动力信息技术股份有限公司 一种媒体数据的处理方法、装置、终端设备和存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101242359A (zh) * 2008-02-27 2008-08-13 华为技术有限公司 动态码率分配方法、分组域流媒体服务器
US20120179833A1 (en) * 2010-06-02 2012-07-12 Onmobile Global Limited Method and apparatus for adapting media
CN103442293A (zh) * 2013-08-30 2013-12-11 武汉眸博科技有限公司 网络多媒体文件快速启动播放方法及系统

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8566879B2 (en) * 2004-09-28 2013-10-22 Sony Corporation Method and apparatus for navigating video content
CN102110459B (zh) * 2009-12-24 2013-01-16 Tcl集团股份有限公司 一种播放终端及其多媒体文件的播放方法和装置
CN104038846B (zh) * 2013-03-05 2018-03-09 华为技术有限公司 缓存状态估计方法及设备
CN103260053B (zh) * 2013-04-15 2016-12-28 威盛电子股份有限公司 动态调整多媒体数据码率的系统、媒体播放装置及方法
CN103841456A (zh) * 2013-12-10 2014-06-04 珠海全志科技股份有限公司 一种网络播放数据缓冲方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101242359A (zh) * 2008-02-27 2008-08-13 华为技术有限公司 动态码率分配方法、分组域流媒体服务器
US20120179833A1 (en) * 2010-06-02 2012-07-12 Onmobile Global Limited Method and apparatus for adapting media
CN103442293A (zh) * 2013-08-30 2013-12-11 武汉眸博科技有限公司 网络多媒体文件快速启动播放方法及系统

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110460875A (zh) * 2019-08-05 2019-11-15 北京达佳互联信息技术有限公司 一种视频码率的切换方法、装置、电子设备及存储介质
CN114640886A (zh) * 2022-02-28 2022-06-17 深圳市宏电技术股份有限公司 自适应带宽的音视频传输方法、装置、计算机设备及介质
CN114640886B (zh) * 2022-02-28 2023-09-15 深圳市宏电技术股份有限公司 自适应带宽的音视频传输方法、装置、计算机设备及介质

Also Published As

Publication number Publication date
CN105791987B (zh) 2018-11-02
CN105791987A (zh) 2016-07-20

Similar Documents

Publication Publication Date Title
WO2019114269A1 (zh) 一种节目续播方法、电视设备及计算机可读存储介质
WO2017107378A1 (zh) 基于hls流媒体的视频数据加速下载方法及装置
WO2017113614A1 (zh) 视频播放过程中插播广告的方法及装置
WO2018166224A1 (zh) 全景视频的目标追踪显示方法、装置及存储介质
WO2018032680A1 (zh) 音视频播放方法及系统
WO2017107388A1 (zh) Hdmi版本切换方法及显示设备
WO2018223607A1 (zh) 电视终端及hdr图像转为sdr的方法和计算机可读存储介质
WO2014187158A1 (zh) 终端数据云分享的控制方法、服务器及终端
WO2017045441A1 (zh) 基于智能电视的音频播放方法及装置
WO2016052973A1 (ko) 다수 개의 무선 억세스 인터페이스들을 지원하는 이동 통신 시스템에서 스트리밍 서비스 데이터 수신 장치 및 방법
WO2016101305A1 (zh) 视频文件处理方法及显示装置
WO2018233221A1 (zh) 多窗口声音输出方法、电视机以及计算机可读存储介质
WO2017020649A1 (zh) 音视频播放控制方法及装置
WO2017084302A1 (zh) 显示终端开机播放视频的方法及显示终端
WO2018000856A1 (zh) 一种实现SDN Overlay网络报文转发的方法、终端、设备及计算机可读存储介质
WO2018032679A1 (zh) 电视定时开关机的设置方法和装置
WO2017088427A1 (zh) 音频输出控制方法及装置
WO2018036057A1 (zh) 软件后台自适应升级方法及装置
WO2017024876A1 (zh) 电视节目播放方法及装置
WO2018090461A1 (zh) 多声道无线音箱之间数据同步的方法及系统
WO2017032122A1 (zh) 数字电视机检测方法及装置
WO2017185480A1 (zh) 多屏互动连接方法、装置及系统
WO2018018680A1 (zh) 应用提示信息显示方法及装置
WO2017084297A1 (zh) 多媒体文件的播放方法及系统
WO2017113596A1 (zh) 单独听控制方法及系统、移动终端及智能电视

Legal Events

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

Ref document number: 14908808

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 06/11/2017)

122 Ep: pct application non-entry in european phase

Ref document number: 14908808

Country of ref document: EP

Kind code of ref document: A1