WO2021218479A1 - 流量整形方法、装置与电子设备 - Google Patents

流量整形方法、装置与电子设备 Download PDF

Info

Publication number
WO2021218479A1
WO2021218479A1 PCT/CN2021/081668 CN2021081668W WO2021218479A1 WO 2021218479 A1 WO2021218479 A1 WO 2021218479A1 CN 2021081668 W CN2021081668 W CN 2021081668W WO 2021218479 A1 WO2021218479 A1 WO 2021218479A1
Authority
WO
WIPO (PCT)
Prior art keywords
media stream
target media
transmission rate
acceptable
delay
Prior art date
Application number
PCT/CN2021/081668
Other languages
English (en)
French (fr)
Inventor
居然
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021218479A1 publication Critical patent/WO2021218479A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/127Prioritisation of hardware or computational resources

Definitions

  • This application relates to the field of communication technology, and in particular to a traffic shaping method, device, and electronic equipment.
  • VBR Variable Bit Rate
  • VBR encoding technology determines the encoding bit rate used according to the complexity of the image or sound. Take video transmission as an example. When the image is not complex, use a relatively low bit rate to encode; when the image is complex or the content changes greatly Next, use a larger code rate to encode, that is, the code rate of the VBR encoding technology can vary with the complexity of the image, so its coding efficiency is higher and the video quality can be guaranteed. According to the coding principle of the above-mentioned VBR coding technology, it can be known that VBR coding technology has the characteristics of large code rate changes. In practical applications, its peak code rate can reach or even far exceed dozens of times the average rate. Therefore, VBR coding technology is adopted. The media data traffic for encoding fluctuates greatly.
  • the fluctuation of media traffic will reduce the resource utilization of the network, and easily cause problems such as network congestion and delay, which will result in lower network transmission performance and affect the effect of media playback.
  • the present application provides a traffic shaping method, device, and electronic equipment, which are used to improve network transmission performance and media playback effects.
  • an embodiment of the present application provides a traffic shaping method, including:
  • the acceptable delay is the media playback delay of the target media stream acceptable to the client
  • the target media stream is encoded with a variable bit rate
  • the code stream information of the target media stream includes the target The size and playback duration of each fragment contained in the media stream.
  • the VBR media stream By using the VBR media stream to transmit at a constant transmission rate, the data flow can be smoothly transmitted, and the network transmission performance can be effectively improved. At the same time, the media quality and coding efficiency can be effectively improved compared to the method of generating media data with a constant bit rate.
  • the constant transmission rate it is determined according to the acceptable delay of the client and the stream information of the target media stream. This can improve the accuracy of traffic shaping, reduce the stall phenomenon of the client, and improve the media playback effect.
  • the acceptable delay is sent by the client.
  • the acceptable time delay is preset or determined according to the advertising playing duration of the target media stream.
  • the method further includes: sending the acceptable delay to the client to instruct the client to play the next media of the target media stream.
  • the client In the case of streaming, request the next media stream according to the acceptable delay. In this way, the client can more accurately determine the time to transmit the next media stream, reducing the impact of media transmission too early and too late on the media playback effect.
  • the method further includes: if the network bandwidth information satisfies a preset condition, increasing the constant transmission rate. This can improve the utilization of network resources.
  • the target media stream has a corresponding original media stream, the original media stream is encoded with a constant bit rate, and the acceptable delay is preset;
  • the determining a constant transmission rate according to the acceptable time delay and the code stream information of the target media stream includes:
  • the original media stream is converted into a first media stream that uses variable bit rate encoding; and the first transmission rate is determined according to the bit stream information of the first media stream and the acceptable time delay.
  • the first media stream is determined to be the target media stream, and the first transmission rate is determined to be the Constant transmission rate; if the difference between the preset guaranteed transmission rate minus the first transmission rate is greater than the rate threshold, adjust the variable rate coding parameters, and return to execute the conversion of the original media stream to use variable codes Rate encoding of the first media stream.
  • CBR-encoded media can be converted into VBR-encoded media, which can effectively improve media quality, thereby improving media playback effects, and can maintain the constant flow characteristics of CBR and improve network transmission performance.
  • the code stream information of the target media stream is determined by using a time series analysis method. This can expand the scope of application of traffic shaping.
  • the method before the transmitting the target media stream according to the constant transmission rate, the method further includes: negotiating with the client to determine the size of the media buffer of the client, To instruct the client to allocate a buffer for caching the target media stream according to the size of the media buffer, where the size of the media buffer is greater than or equal to the size of the segment with the largest amount of data in the target media stream.
  • the accuracy of traffic shaping can be further improved, the jam phenomenon of the client can be reduced, and the media playback effect can be improved.
  • the size of the media buffer is sent by the client, and the resolution of the target media stream is determined according to the size of the media buffer.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is ts The size of the media data from t to t.
  • an embodiment of the present application provides a traffic shaping method, including:
  • the target media stream is transmitted, and the acceptable delay is a media playback delay of the target media stream acceptable to the client.
  • the VBR media stream By using the VBR media stream to transmit at a constant transmission rate, the data flow can be smoothly transmitted, and the network transmission performance can be effectively improved. At the same time, the media quality and coding efficiency can be effectively improved compared to the method of generating media data with a constant bit rate.
  • the media quality and coding efficiency can be effectively improved compared to the method of generating media data with a constant bit rate.
  • the determining the constant transmission rate corresponding to the target media stream to be played includes: determining the constant transmission rate corresponding to the target media stream to be played according to network bandwidth information. In this way, the accuracy of the determined constant transmission rate can be improved, thereby improving the utilization of network resources.
  • the transmitting the target media stream according to the acceptable delay and the constant transmission rate includes: if the acceptable delay meets a preset requirement, then Use the constant transmission rate to transmit the target media stream; if the acceptable time delay does not meet the preset requirements, adjust the resolution of the target media stream to determine based on the adjusted code stream information of the target media stream The acceptable delay meets the preset requirement; and the adjusted target media stream is transmitted using the constant transmission rate. In this way, the accuracy of traffic shaping can be improved, and the media playback effect of the client can be improved.
  • the method before the adjusting the resolution of the target media stream if the acceptable delay does not meet a preset requirement, the method further includes:
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is ts The size of the media data from t to t.
  • an embodiment of the present application provides a traffic shaping method, including:
  • the target media stream is transmitted at the constant transmission rate.
  • the target media stream is encoded with a variable bit rate; the acceptable delay is the media playback delay of the target media stream acceptable to the client, and the code stream information of the target media stream includes the target The size and playback duration of each fragment contained in the media stream.
  • the VBR media stream By using the VBR media stream to transmit at a constant transmission rate, the data flow can be smoothly transmitted, and the network transmission performance can be effectively improved. At the same time, the media quality and coding efficiency can be effectively improved compared to the method of generating media data with a constant bit rate.
  • the constant transmission rate it is determined according to the acceptable delay of the client and the stream information of the target media stream. This can improve the accuracy of traffic shaping, reduce the stall phenomenon of the client, and improve the media playback effect.
  • the transmitting the target media stream according to the constant transmission rate includes: sending a data transmission request to the media sending end, and the data transmission request is used to request transmission
  • the data transmission request carries the constant transmission rate; then, the target media stream sent by the media sending end according to the constant transmission rate is received.
  • the method further includes: in the case where the duration from the end time of the playback of the target media stream is greater than or equal to the acceptable time delay, sending to the media sending end Request the next media stream.
  • the client can more accurately determine the time to transmit the next media stream, reducing the impact of media transmission too early and too late on the media playback effect.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is ts The size of the media data from t to t.
  • an embodiment of the present application provides a traffic shaping device, including: a parameter determination module and a transmission module, wherein:
  • the parameter determination module is configured to determine the acceptable delay corresponding to the target media stream to be played, and determine a constant transmission rate according to the acceptable delay and the code stream information of the target media stream, wherein the available
  • the acceptance delay is the media playback delay of the target media stream acceptable to the client, the target media stream is encoded with a variable bit rate, and the code stream information of the target media stream includes the various information contained in the target media stream.
  • the transmission module is configured to transmit the target media stream according to the constant transmission rate.
  • the acceptable delay is sent by the client.
  • the acceptable time delay is preset or determined according to the advertising playback duration of the target media stream.
  • the transmission module is further configured to: send the acceptable delay to the client to instruct the client to play the target media stream when the target media stream needs to be played. In the case of a media stream, the next media stream is requested according to the acceptable delay.
  • the parameter determination module is further configured to: after the constant transmission rate is determined according to the acceptable delay and the code stream information of the target media stream, the Before transmitting the target media stream according to the constant transmission rate, if the network bandwidth information meets a preset condition, increase the constant transmission rate.
  • the target media stream has a corresponding original media stream, the original media stream is encoded with a constant bit rate, and the acceptable delay is preset;
  • the parameter determination module is specifically used for:
  • the first media stream is determined to be the target media stream, and the first transmission rate is determined to be the Constant transmission rate;
  • variable rate coding parameters are adjusted, and the original media stream is converted back to the first transmission rate using variable rate encoding.
  • the code stream information of the target media stream is determined by using a time series analysis method.
  • the parameter determination module is further configured to: before the transmission module transmits the target media stream according to the constant transmission rate, negotiate with the client to determine the client's The media buffer size is used to instruct the client to allocate a buffer for buffering the target media stream according to the media buffer size, and the media buffer size is greater than or equal to the size of the segment with the largest amount of data in the target media stream.
  • the size of the media buffer is sent by the client, and the resolution of the target media stream is determined according to the size of the media buffer.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is ts The size of the media data from t to t.
  • an embodiment of the present application provides a traffic shaping device, including: a parameter determination module and a transmission module, wherein:
  • the parameter determination module is configured to: determine the constant transmission rate corresponding to the target media stream to be played; and determine the acceptable delay according to the constant transmission rate and the code stream information of the target media stream, and the acceptable delay The media playback delay of the target media stream acceptable to the client;
  • the transmission module is configured to transmit the target media stream according to the acceptable time delay and the constant transmission rate.
  • the parameter determination module is specifically configured to:
  • the transmission module is specifically configured to: use the constant transmission rate to transmit the target media stream when the acceptable delay meets a preset requirement; In the case that the acceptable delay does not meet a preset requirement, adjusting the resolution of the target media stream so that the acceptable delay determined based on the adjusted code stream information of the target media stream meets the preset requirement; And use the constant transmission rate to transmit the adjusted target media stream. In this way, the accuracy of traffic shaping can be improved, and the media playback effect of the client can be improved.
  • the transmission module is further configured to: before adjusting the resolution of the target media stream, send the acceptable delay to the client; and receive the client Confirmation information sent by the terminal, where the confirmation information is used to indicate whether the acceptable delay meets a preset requirement.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is ts The size of the media data from t to t.
  • an embodiment of the present application provides a traffic shaping device, including:
  • the acquiring module is used to acquire the code stream information of the target media stream to be played from the media sending end, where the target media stream is encoded with a variable code rate;
  • the determining module is configured to determine a constant transmission rate according to the predetermined acceptable delay corresponding to the target media stream and the code stream information of the target media stream, wherein the acceptable delay is acceptable to the client Media playback delay of the target media stream, where the code stream information of the target media stream includes the size and playback duration of each segment included in the target media stream;
  • the transmission module is configured to transmit the target media stream according to the constant transmission rate.
  • the transmission module is specifically configured to:
  • the acquisition module is further configured to: in the case where the duration from the end time of the playback of the target media stream is greater than or equal to the acceptable time delay, send a message to the media The sender requests to obtain the next media stream.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is ts The size of the media data from t to t.
  • an embodiment of the present application provides an electronic device, including: a memory and a processor, the memory is used to store a computer program; the processor is used to execute the above-mentioned first, second, or third aspect when the computer program is invoked The method described.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method described in the first aspect, the second aspect, or the third aspect.
  • embodiments of the present application provide a computer program product, which when the computer program product runs on an electronic device, causes the electronic device to execute the method described in the first, second, or third aspect above.
  • an embodiment of the present application provides a chip system, including a processor, the processor is coupled with a memory, and the processor executes a computer program stored in the memory to implement the first aspect, the second aspect, or the first aspect described above.
  • the chip system may be a single chip or a chip module composed of multiple chips.
  • FIG. 1 is a schematic diagram of an application scenario provided by an embodiment of the application
  • FIG. 2 is a schematic flowchart of a traffic shaping method provided by an embodiment of this application.
  • FIG. 3 is a schematic diagram of media stream conversion provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of a process for determining a constant transmission rate according to an embodiment of the application
  • FIG. 5 is a schematic diagram of another application scenario provided by an embodiment of the application.
  • FIG. 6 is a schematic structural diagram of a traffic shaping device provided by an embodiment of this application.
  • FIG. 7 is a schematic structural diagram of another traffic shaping device provided by an embodiment of this application.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • VBR coding technology is generally used to ensure media quality and coding efficiency.
  • bit rate of the VBR coding technology can vary with the complexity of the image, that is, the bit rate of the coding technology changes greatly, which will cause the media data flow to have the characteristics of large fluctuations.
  • the fluctuation of media traffic will reduce the resource utilization of the network, and easily cause problems such as network congestion and delay, which will result in low network transmission performance and affect the media playback effect.
  • the industry’s solutions to the above-mentioned problems mainly include two types: one is to generate media data with a constant bit rate by changing the encoding technology, such as using a constant bit rate (Constant Bit Rate, CBR) and constrained variable bit rate (Constraint Variable Bit). Rate, CVBR) or average bit rate (Average Bit Rate, ABR) and other encoding technologies; the other is to adjust the transmission rate of VBR media streams through traffic shaping technology to reduce media flow fluctuations, thereby improving network transmission performance and media playback Effect.
  • CBR Constant Bit Rate
  • CVBR constrained variable bit rate
  • ABR Average Bit Rate
  • CBR is encoded in a constant bit rate mode.
  • the media quality will be reduced. That is, CBR encoding technology is sacrificed.
  • Media quality is used to ensure the stability of media flow, and the coding efficiency of this coding technology is low.
  • CVBR generally allows users to enter the maximum bit rate and minimum bit rate. When the media content changes small, the bit rate is stable at the minimum bit rate. When the media content changes greatly, the bit rate is greater than the minimum bit rate and does not exceed the maximum bit rate.
  • the technology still has the problem of bit rate fluctuations, that is, there is a certain media flow fluctuation problem, and a certain amount of media quality is also sacrificed.
  • ABR reaches the set bit rate within a certain time range, but the peak value of the local bit rate can exceed the set bit rate, that is, the average bit rate is constant.
  • This coding technique only limits the average bit rate, but does not eliminate the bit rate. Volatility, so there are also certain media flow fluctuations.
  • the related technologies include buffered sending method, Transmission Control Protocol (TCP) Pacing congestion control method, and Committed Access Rate (CAR), etc.
  • the buffered sending method is to transfer media data Put it in the buffer or queue, and then send the buffered data evenly according to a specific algorithm (such as leaky bucket algorithm);
  • TCP Pacing congestion control method is similar to the buffer sending method, which is to send the media in a TCP window
  • the data is sent at a certain rate;
  • CAR is to limit the flow cannot exceed the set threshold. When the set threshold is exceeded, the cache can be slowed down.
  • These current traffic shaping technologies generally only perform flow control based on the size of the data flow, and their control accuracy is limited, and it is relatively easy to cause media jams on the client side and affect the media playback effect.
  • the embodiments of the present application provide a traffic shaping method, which smoothly transmits data traffic by transmitting the VBR media stream at a constant transmission rate, improves network transmission performance, and guarantees media quality; and when performing traffic shaping, Comprehensive consideration of factors such as the stream information of the media data and the acceptable delay of the client to improve the accuracy of traffic shaping, alleviate the stall phenomenon of the client, and improve the media playback effect.
  • Fig. 1 is a schematic diagram of an application scenario provided by an embodiment of the application.
  • the devices involved in the application scenario may include: a server 100 and a client 200, and the server 100 and the client 200 directly pass through the network Perform data transfer.
  • Both the server 100 and the client 200 may be electronic devices such as servers, desktop computers, notebook computers, palmtop computers, mobile phones, or smart TVs that have functions such as computing and storage.
  • the network for communication between the server 100 and the client 200 may include Ethernet, wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), and/or mobile communication networks, etc. .
  • WLAN wireless local area networks
  • Wi-Fi wireless fidelity
  • the server 100 can provide on-demand and live broadcast services.
  • the user can request the server 100 through the client 200 to obtain media data for playback.
  • the media acquisition request can carry the media identifier of the target media stream to be played, the playback start and end time, and Media resolution and other information; the target media stream may be a video stream or an audio stream.
  • a video stream is used as an example for exemplification in the embodiments of the present application.
  • the server 100 and the client 200 can perform traffic shaping on the target media stream according to the code stream information of the target media stream, so as to smoothly transmit data traffic and improve network transmission performance And media playback effects.
  • the specific traffic shaping method adopted can be seen in FIG. 2.
  • FIG. 2 is a schematic flowchart of a traffic shaping method provided by an embodiment of the application. As shown in FIG. 2, the method may include the following steps:
  • the server negotiates with the client to determine a constant transmission rate and an acceptable delay.
  • the server can negotiate with the client to determine parameters such as the constant transmission rate and the acceptable delay of the client, where the acceptable delay is the target media stream acceptable to the client Media playback delay, constant transmission rate and acceptable delay are mutually constrained, and one parameter can be used to determine the other parameter.
  • the acceptable delay is the target media stream acceptable to the client Media playback delay
  • constant transmission rate and acceptable delay are mutually constrained
  • one parameter can be used to determine the other parameter.
  • it can be determined according to the code stream information of the target media stream and the following constraints:
  • c is the constant transmission rate
  • d is the acceptable delay of the client
  • t s is the playback start time of the target media stream
  • t e is the playback end time of the target media stream
  • S(t) is the range from t s to t The size of the media data between.
  • the stream information of the video stream (that is, the target media stream) can be obtained according to the video storage information on the server.
  • each video file is stored on the server, and the user can select the video they want to watch through the portal provided by the server to download and play; the video file stored on the server can be divided into multiple parts in advance using the fragmentation technology.
  • Each segment can be transmitted, decoded and played separately, so that the video can be played while downloading.
  • the storage format of the slices in the video file can be the TS format in the HTTP Live Streaming (HTTP Live Streaming, HLS) protocol, or it can be Dynamic Adaptive Streaming over HTTP, MPEG-DASH over HTTP.
  • the m4s or mp4 format in the standard may also be other formats, which is not particularly limited in this embodiment.
  • Each segment includes at least one frame of video data, and each segment has code stream information such as a corresponding data size and playback duration.
  • the code stream information of the target media stream includes the code stream information of each segment contained in the target media stream.
  • the stream information of the target media stream can be estimated using a time series analysis method.
  • any relevant time series analysis algorithm can be used. It is not particularly limited.
  • the process of determining the constant transmission rate and the acceptable delay can be executed on the server side or on the client side.
  • the server side can use but not limited to the following two methods to determine the constant Transmission rate and acceptable delay:
  • the first type first determine the acceptable delay corresponding to the target media stream, and then determine the constant transmission rate corresponding to the target media stream according to the acceptable delay and the code stream information of the target media stream.
  • the acceptable delay may be sent by the client, and the acceptable delay may be specifically carried in the media acquisition request, of course, it can also be carried in other messages, which is not particularly limited in this embodiment.
  • the acceptable delay can also be determined by the server alone, where the server can preset the acceptable delay based on experience values or the basic configuration information of most clients at present. In the case of advertising, the server may also determine the acceptable delay according to the advertising playing duration of the target media stream. For example, the acceptable delay may be set to a value not higher than the advertising playing duration.
  • the server After the server determines the acceptable delay, it can calculate the constant transmission rate for transmitting the target media stream according to the acceptable delay, the code stream information of the target media stream, and the constraint conditions in formula (1).
  • the amount of media data S(t) between the playback end time t and the playback start time t s of the target media stream can be calculated, Then determine the constant transmission rate corresponding to each fragment: S(t)/(t-t s +d), and determine the maximum value of the constant transmission rate corresponding to each fragment as the constant transmission rate corresponding to the target media stream .
  • Figure 3 is a schematic diagram of media stream conversion provided by an embodiment of the application.
  • the constant transmission rate corresponding to each fragment is: 2KB/s, 2.5KB/s, 4KB/s and 4KB/s, the maximum of which is 4KB/s, the constant transmission rate corresponding to the target media stream can be regarded as 4KB/s.
  • the four fragments that originally required 4s to be transmitted can be transmitted at a constant transmission rate of 4KB/s within 6s, that is, it can be considered that the VBR code stream (that is, the target media stream) is converted into a constant code stream.
  • the server starts to transmit the first 4KB data of fragment 0 at the 0th second; the last 2KB data of fragment 0 and the first 2KB data of fragment 1 are transmitted at the 1st second; at the second second Start transmitting the last 2KB data of fragment 1 and the first 2KB data of fragment 2; transmit the remaining 8KB data of fragment 2 during the 3rd to 5th seconds; start transmitting the 4KB data of fragment 3 in the 5th second.
  • the server can also adjust the determined constant transmission rate when the network bandwidth resources are relatively idle to speed up the transmission speed and improve the utilization of network resources, that is, if the network bandwidth information meets the preset conditions , You can increase the constant transmission rate.
  • the second type first determine the constant transmission rate corresponding to the target media stream, and then determine the acceptable delay corresponding to the target media stream according to the constant transmission rate and the code stream information of the target media stream.
  • the server can preset a constant transmission rate based on empirical values, or determine the constant transmission rate corresponding to the target media stream based on network bandwidth information. For example, when the guaranteed network bandwidth is not less than 100M, it can directly The sending rate is determined to be a value not higher than 100Mb/s.
  • the server After the server determines the constant transmission rate, it can calculate the acceptable delay for transmitting the target media stream according to the constant transmission rate, the code stream information of the target media stream, and the constraint conditions in formula (1).
  • the amount of media data S(t) between the playback end time t and the playback start time t s of the target media stream can be calculated, Then determine the acceptable delay corresponding to each segment: S(t)/c-(t-t s ), and determine the maximum value of the acceptable delay corresponding to each segment as the acceptable delay corresponding to the target media stream. Accept the delay.
  • the acceptable delays corresponding to each fragment are: 0.5s, 0.5s, 2s, and 2s, and the maximum value is 2s, and the acceptable delay corresponding to the target media stream can be regarded as 2s.
  • the server After the server determines the acceptable delay, it can determine whether the acceptable delay meets the preset requirements. If it does, it can directly use the determined constant transmission rate to transmit the target media stream; if it does not, it can adjust the resolution of the target media stream. , Make the acceptable delay determined based on the code stream information of the adjusted target media stream meet the preset requirements, and then transmit the adjusted target media stream to reduce the stall phenomenon of the client and improve the media playback effect.
  • the server can judge whether the acceptable delay meets the preset requirements according to the preset delay threshold, for example, judge whether the acceptable delay is greater than the delay threshold, and if it is greater than the delay threshold, it is considered that the acceptable delay does not meet the preset requirements Otherwise, it can be considered that the acceptable delay meets the preset requirements.
  • the server can also send the acceptable delay to the client, and determine whether the acceptable delay meets the preset requirements according to the confirmation information fed back by the client. That is, the client can determine whether the acceptable delay meets the preset requirements according to the preset delay threshold. If it is satisfied, the client can feed back to the server confirmation information indicating that the acceptable delay meets the preset requirements. If it is not satisfied, the client can feed back confirmation information to the server to indicate that the acceptable delay does not meet the preset requirements.
  • the server can reduce the acceptable delay by reducing the resolution of the target media stream.
  • the resolution of the target media stream can be reduced from 1080p to 720p.
  • the acceptance delay does not meet the preset requirements, and the resolution can be reduced again.
  • the original resolution of the target media stream may be requested by the client or predetermined by the server.
  • the server may also adjust the constant transmission rate appropriately, or may not perform processing, which is not particularly limited in this embodiment.
  • the server can send the acceptable delay to the client, so that if the client needs to play the next media stream of the target media stream, it can request the next one in advance according to the acceptable delay.
  • Media stream (for detailed description, please refer to the following steps) to reduce network delay and improve video playback effect.
  • the process of determining the constant transmission rate and the acceptable delay can also be performed on the client. Specifically, when the client determines the constant transmission rate and the acceptable time delay, the client can first determine the acceptable delay corresponding to the target media stream, and obtain the code stream information of the target media stream from the server; and then according to the predetermined The time delay and the code stream information of the target media stream can be accepted, and the constant transmission rate can be determined.
  • the acceptable delay can be preset by the system or determined according to the size of the media buffer.
  • the client can also obtain the acceptable delay from the server. This embodiment does not make any special mentions. limited.
  • the client After the client determines the acceptable delay, it can calculate the constant transmission rate for transmitting the target media stream according to the acceptable delay, the code stream information of the target media stream, and the constraint conditions in formula (1).
  • the specific implementation process is similar to that of the server, so I won't repeat it here.
  • the client can also determine the constant transmission rate first, and then determine the acceptable delay based on the constant transmission rate and the code stream information of the target media stream; and when the acceptable delay does not meet the preset requirements , Request the server to adjust the resolution of the target media stream, and re-determine the acceptable delay based on the adjusted code stream information of the target media stream, so that the re-determined acceptable delay meets the preset requirements.
  • the specific implementation process is similar to that of the server, so I won't repeat it here.
  • the server or the client determines the constant transmission rate, if the transmission start time is controlled by the opposite terminal, the constant transmission rate can be sent to the opposite terminal so that the opposite terminal can control the transmission of the target media stream.
  • the client's media buffer size can also be determined through negotiation with the client, so that the client allocates the media buffer size to cache the target media stream according to the media buffer size. Buffer, reduce media loss and jams caused by insufficient client media buffer size.
  • the size of the media buffer may be greater than or equal to the size of the segment with the largest amount of data in the target media stream, so as to ensure that the client has enough space to cache the complete segment of the target media stream.
  • the size of the media buffer can be determined by the client according to its own memory configuration information. If the process of determining the acceptable delay and constant transmission rate is performed on the server, the client can send the size of the media buffer to On the server side, the server side can determine the resolution of the target media stream according to the size of the media buffer.
  • the server can determine whether the size of the media buffer meets the requirements, that is, whether the size of the media buffer is greater than the size of the segment with the largest amount of data in the target media stream, and if so, the resolution of the target media stream can be maintained No change, if not, similar to adjusting the resolution of the target media stream based on the acceptable delay, the server can adjust the resolution of the target media stream to make the media buffer size meet the above requirements.
  • the client can request the server to adjust the resolution of the target media stream when the size of the media buffer does not meet the requirements, so that the size of the media buffer meets the above requirements.
  • the size of the media buffer may not be predetermined, but determined according to the size of the segment with the largest amount of data in the target media stream. For example: the client does not send the media buffer size to the server, the server can directly determine the media buffer size as the amount of data in the target media stream after determining the acceptable delay and constant transmission rate corresponding to the target media stream The size of the largest fragment, and then send the media buffer size to the client.
  • the target media stream is transmitted between the server and the client at a constant transmission rate.
  • the server and the client After the server and the client have negotiated the constant transmission rate and acceptable delay, they can sequentially transmit the segments in the target media stream in the order of the playing time according to the constant transmission rate.
  • the server can send the target media stream to the client at the constant transmission rate after negotiating the constant transmission rate, that is, the server controls the transmission start time of the target media stream; the server can also After the constant transmission rate is negotiated, and the data transmission request sent by the client is received, the target media stream is sent to the client, that is, the client controls the transmission start time of the target media stream, where the data transmission request can be
  • the identifier of the target media stream is carried to indicate that the request is for requesting transmission of the target media stream.
  • the data transmission request may carry a constant transmission rate to tell the server to transmit the target media stream at the constant transmission rate.
  • the server When the server transmits the target media stream, it can control the transmission rate through the transmission layer sending window, the network card exit rate or other methods, so that the transmission rate of the target media stream is the above-mentioned constant transmission rate.
  • the server or client can add a transmission time label to the target media stream, that is, before transmitting the target media stream, determine the transmission time label of each segment in the target media stream, and identify the sending time of each segment .
  • the client After the client receives the media file transmitted by the server, it can be cached in the media buffer. After receiving a complete segment, it can be taken out of the buffer before the playback start time of the segment is reached. The segment is decoded, and then the segment is played when the playback requirement of the segment is met. For example, the segment can be played when the playback start time of the segment is reached or a user's play instruction is received. After fetching the data of the fragment from the buffer, the client can release the buffer to receive new media data.
  • the client requests the server to obtain the next media stream according to the acceptable delay.
  • the client Before the end of the playback of the target media stream, the client can request the server to play the next media stream.
  • the client can request the server to obtain the next media stream when the time between the current time and the playback end time of the target media stream is greater than or equal to the acceptable delay, and the server and the client repeat the above step S110 And S120, complete parameter negotiation, and transmit the next media stream.
  • the server and the client repeat the above step S110 And S120, complete parameter negotiation, and transmit the next media stream.
  • it can also be determined according to the value of the negotiation parameter corresponding to the target media stream. For example, when determining the negotiation parameter corresponding to the target media stream, the client sends an acceptable time to the server.
  • the client may not send the acceptable delay, and the server may directly use the acceptable delay sent by the client to determine the constant transmission rate; the same, if it is The constant transmission rate is determined first, or the last determined constant transmission rate may be directly used to determine the acceptable time delay; a similar method may also be used for the size of the media buffer, which is not particularly limited in this embodiment.
  • next media stream and the target media stream may be different segments in the same media, or may belong to different media.
  • step S130 may not be executed.
  • the data traffic can be smoothly transmitted, and the network transmission performance can be effectively improved.
  • the media quality and encoding can be effectively improved.
  • Efficiency when traffic shaping is performed, factors such as the code stream information of the media data and the acceptable delay of the client are comprehensively considered. This can improve the accuracy of traffic shaping, reduce the stalling phenomenon of the client, and improve Media playback effect.
  • the following introduces another application scenario to which the technical solution of the present application is applicable.
  • the CBR encoding method is used to encode the media, and the bandwidth quality of the media traffic is guaranteed.
  • the application scenario may specifically be an interactive network television (Internet Protocol television, IPTV) scenario or other similar scenarios.
  • IPTV Internet Protocol television
  • an IPTV scenario is taken as an example for illustration.
  • the operator can uniformly set the acceptable playback delay and the guaranteed transmission rate of the client, where the acceptable playback delay of each media can be the same or different, and can be set according to actual conditions.
  • FIG. 4 is a schematic diagram of a process for determining a constant transmission rate according to an embodiment of the application. As shown in FIG. 4, the method may include the following steps:
  • the VBR media stream can be converted into a constant data flow. Therefore, the server can convert the CBR-encoded original media stream into the VBR-encoded media stream (ie, the first media stream) to improve the media quality.
  • S112 Determine the first transmission rate c1 according to the code stream information and the acceptable time delay of the first media stream.
  • the constant transmission rate (ie, the first transmission rate c1) corresponding to the first media stream can be determined according to the aforementioned formula (1).
  • the specific determination process is similar to the previous method of determining the constant transmission rate. I won't repeat it here.
  • step S113 Determine whether the difference between the preset guaranteed transmission rate c_q minus the first transmission rate c1 is less than or equal to the preset rate threshold c_t, if yes, perform step S114, otherwise, perform step S115.
  • the closeness between the first transmission rate c1 and the guaranteed transmission rate c_q can be judged.
  • the difference between the guaranteed transmission rate c_q minus the first transmission rate c1 ( That is, the magnitude relationship between c_q-c1) and the rate threshold c_t is used to measure the closeness.
  • c_q-c1 ⁇ c_t it can be considered that the closeness between the first transmission rate c1 and the guaranteed transmission rate c_q meets the requirements ;
  • c_q-c1>c_t it can be considered that the proximity between the first transmission rate c1 and the guaranteed transmission rate c_q does not meet the requirements.
  • the rate threshold can be set according to actual needs, which is not particularly limited in this embodiment. In specific implementation, it can also be judged whether the value of c_q-c1 is less than the rate threshold c_t. In the case of c_q-c1 ⁇ c_t, it is considered that the proximity between the first transmission rate c1 and the guaranteed transmission rate c_q meets the requirements; In the case of c_q-c1 ⁇ c_t, it is considered that the proximity between the first transmission rate c1 and the guaranteed transmission rate c_q does not meet the requirements, which is not particularly limited in this embodiment.
  • the difference between the guaranteed transmission rate c_q minus the first transmission rate c1 is less than or equal to the rate threshold c_t, that is, c_q-c1 ⁇ c_t, it means that the first transmission rate c1 and the guaranteed transmission rate c_q are relatively close.
  • the media stream is determined as the target media stream, and the first transmission rate is determined as the constant transmission rate.
  • step S115 Adjust the variable bit rate coding parameters, and return to step S111.
  • variable rate encoding parameter is returned to step S111 until the closeness between the first transmission rate c1 corresponding to the regenerated first media stream and the guaranteed transmission rate c_q meets the requirement.
  • the server and the client can use the constant transmission rate corresponding to the target media stream to transmit the target media stream, and the client can also transmit the target media stream according to the acceptable delay.
  • the specific implementation process is similar to the foregoing steps S120 and S130, and will not be repeated here.
  • the above technical solution provided by this embodiment can convert a CBR-encoded media stream into a VBR-encoded media stream for transmission, which can effectively improve the media quality, thereby improving the media playback effect, and can maintain the constant flow characteristics of CBR and improve Network transmission performance.
  • FIG. 5 is a schematic diagram of another application scenario provided by an embodiment of the application.
  • the devices involved in the application scenario may include: a server 100, a client 200, and a gateway device 300.
  • the server 100, the gateway Data transmission is performed between the device 300 and the client 200 through the network.
  • the difference between this application scenario and the foregoing application scenario is that the server 100 and the client 200 also include other transfer devices.
  • the transfer device may be the gateway device 300 shown in FIG. 5 or other devices, such as Routers, etc.
  • the transit device may include one or more.
  • the transit device includes a gateway device 300 as an example for illustration, which is not intended to limit the application.
  • the gateway device 300 can download media data from the server 100 and cache it, the client 200 can request the gateway device 300 to play the target media stream, and the gateway device 300 can perform traffic on the target media stream based on the request of the client 200.
  • the interaction process between the gateway device 300 and the client 200 is similar to the interaction process between the server 100 and the client 200 in FIG. 2, and will not be repeated here. That is to say, in this application, the media sending end that implements traffic shaping can be the server 100, or a transfer device between the server 100 and the client 200, which can effectively expand the scope of application of traffic shaping.
  • an embodiment of the present application provides a traffic shaping device.
  • This device embodiment corresponds to the foregoing method embodiment.
  • this device embodiment no longer compares the previous method embodiments. The details will be repeated one by one, but it should be clear that the device in this embodiment can correspondingly implement all the content in the foregoing method embodiment.
  • FIG. 6 is a schematic structural diagram of a traffic shaping device provided by an embodiment of the application.
  • the device may be applied to a media sending end.
  • the traffic shaping device 110 provided in this embodiment may include: a parameter determination module 111 and The transmission module 112, where:
  • the parameter determination module 111 is used to determine the acceptable delay corresponding to the target media stream to be played, and determine a constant transmission rate according to the acceptable delay and the stream information of the target media stream, where the acceptable delay is the client's acceptable delay
  • the received media playback delay of the target media stream, the target media stream is encoded with a variable bit rate, and the stream information of the target media stream includes the size and playback duration of each segment contained in the target media stream;
  • the transmission module 112 is configured to transmit the target media stream according to a constant transmission rate.
  • the acceptable delay may be sent by the client; the acceptable delay may also be preset or determined according to the advertising playing time of the target media stream.
  • the transmission module 112 is further configured to: send an acceptable delay to the client to instruct the client to play the next media stream of the target media stream according to the Accept the delay to request the next media stream.
  • the parameter determination module 111 is further configured to: after determining the constant transmission rate according to the acceptable delay and the code stream information of the target media stream, before transmitting the target media stream according to the constant transmission rate , When the network bandwidth information meets the preset conditions, increase the constant transmission rate.
  • the target media stream has a corresponding original media stream, the original media stream is encoded with a constant bit rate, and the acceptable delay is preset; the parameter determination module 111 specifically uses At:
  • the first media stream is determined as the target media stream, and the first transmission rate is determined as the constant transmission rate;
  • variable rate encoding parameter is adjusted, and the step of converting the original media stream into the first media stream using variable rate encoding is returned.
  • the code stream information of the target media stream is determined using a time series analysis method.
  • the parameter determination module 111 is further configured to: before the transmission module 112 transmits the target media stream according to the constant transmission rate, negotiate with the client to determine the size of the media buffer of the client to instruct the client The terminal allocates a buffer for caching the target media stream according to the size of the media buffer, and the size of the media buffer is greater than or equal to the size of the slice with the largest amount of data in the target media stream.
  • the size of the media buffer is sent by the client, and the resolution of the target media stream is determined according to the size of the media buffer.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is the amount of media data between ts and t size.
  • the parameter determination module 111 is configured to: determine the constant transmission rate corresponding to the target media stream to be played; and determine according to the constant transmission rate and the code stream information of the target media stream Acceptable delay, the acceptable delay is the media playback delay of the target media stream acceptable to the client;
  • the transmission module 112 is configured to transmit the target media stream according to an acceptable delay and a constant transmission rate.
  • the parameter determination module 111 is specifically configured to determine the constant transmission rate corresponding to the target media stream to be played according to the network bandwidth information.
  • the transmission module 112 is specifically configured to transmit the target media stream at a constant transmission rate when the acceptable delay meets the preset requirements; when the acceptable delay does not meet the preset requirements, If required, adjust the resolution of the target media stream so that the acceptable delay determined based on the code stream information of the adjusted target media stream meets the preset requirements; and use a constant transmission rate to transmit the adjusted target media stream. In this way, the accuracy of traffic shaping can be improved, and the media playback effect of the client can be improved.
  • the transmission module 112 is further configured to: before adjusting the resolution of the target media stream, send an acceptable delay to the client; Indicate whether the acceptable delay meets the preset requirements.
  • the device provided in this embodiment can execute the method executed by the media sending end in the foregoing method embodiment, and its implementation principle and technical effect are similar, and will not be repeated here.
  • FIG. 7 is a schematic structural diagram of another traffic shaping device provided by an embodiment of the application.
  • the device may be applied to a client.
  • the traffic shaping device 120 provided in this embodiment may include:
  • the obtaining module 121 is configured to obtain code stream information of the target media stream to be played from the media sending end, and the target media stream is encoded with a variable code rate;
  • the parameter determination module 122 is configured to determine a constant transmission rate according to the predetermined acceptable delay corresponding to the target media stream and the code stream information of the target media stream, where the acceptable delay is the value of the target media stream acceptable to the client.
  • Media playback delay, the code stream information of the target media stream includes the size and playback duration of each fragment contained in the target media stream;
  • the transmission module 123 is configured to transmit the target media stream according to a constant transmission rate.
  • the transmission module 123 is specifically configured to:
  • the data transmission request is used to request the transmission of the target media stream, and the data transmission request carries a constant transmission rate;
  • the obtaining module 121 is further configured to: in the case that the duration from the end of the playback of the target media stream is greater than or equal to the acceptable delay, request the media sender to obtain the next media flow.
  • c is the constant transmission rate
  • d is the acceptable delay
  • ts is the playback start time of the target media stream
  • te is the playback end time of the target media stream
  • S(t) is the amount of media data between ts and t size.
  • the device provided in this embodiment can execute the method executed by the client in the foregoing method embodiment, and its implementation principle and technical effect are similar, and will not be repeated here.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • the electronic device provided in this embodiment may include: a processor 210, a memory 220, a communication module 230, and so on.
  • the processor 210 may include one or more of processors 210 such as a central processing unit 210, an application processor 210 (application processor, AP), and a baseband processor 210.
  • the processor 210 may be the nerve center and command center of the wireless router.
  • the processor 210 can generate an operation control signal according to the instruction operation code and the timing signal, and complete the control of fetching and executing instructions.
  • the memory 220 may be used to store computer executable program code, and the executable program code includes instructions.
  • the processor 210 executes various functional applications and data processing of the electronic device by running instructions stored in the memory 220.
  • the memory 220 may include a program storage area and a data storage area, such as storing data of a sound signal to be played.
  • the memory 220 may be a double-rate synchronous dynamic random access memory 220 DDR or flash memory.
  • the communication module 230 can provide applications on electronic devices including Wireless Local Area Networks (WLAN) (such as Wireless Fidelity (Wi-Fi) networks), Bluetooth (Bluetooth, BT), mobile communication networks, and global Navigation Satellite System (Global Navigation Satellite System, GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared Technology (Infrared, IR) and other communication solutions.
  • WLAN Wireless Local Area Networks
  • BT Bluetooth
  • BT Bluetooth
  • BT Global Navigation Satellite System
  • GNSS Global Navigation Satellite System
  • FM Frequency Modulation
  • NFC Near Field Communication
  • Infrared Technology Infrared, IR
  • the communication module 230 may be one or more devices integrating at least one communication processing module.
  • the communication module 230 may include an antenna, and the antenna may have only one array element or an antenna array including multiple array elements.
  • the communication module 230 can receive electromagnetic waves through an antenna, frequency-modulate and filter the electromagnetic wave signals, and send the processed signals to the processor 210.
  • the electronic device may also include a power management module (not shown).
  • the power management module may receive input from a battery and/or a charger to supply power to the processor 210, the memory 220, the communication module 230, and the like.
  • FIG. 8 does not constitute a limitation on the structure of the electronic device, and may include more or fewer components than shown in the figure, or combine some components, or different components.
  • the electronic device may also include a display screen. , Indicator lights, motors, controls (such as buttons), gyroscope sensors, acceleration sensors, etc.
  • the electronic device can be the aforementioned media sending end or the client.
  • the electronic device provided in this embodiment can execute the foregoing method embodiments, and its implementation principles and technical effects are similar, and details are not described herein again.
  • the embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described in the foregoing method embodiment is implemented.
  • the embodiments of the present application also provide a computer program product.
  • the computer program product runs on an electronic device, the electronic device executes the method described in the above method embodiment.
  • An embodiment of the present application also provides a chip system, which includes a processor, which is coupled with a memory, and the processor executes a computer program stored in the memory to implement the method described in the foregoing method embodiment.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium.
  • the computer instructions can be sent from a website site, computer, server, or data center to another website site, computer, Server or data center for transmission.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (such as a floppy disk, a hard disk, or a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (Solid State Disk, SSD)).
  • the process can be completed by a computer program instructing relevant hardware.
  • the program can be stored in a computer readable storage medium. , May include the processes of the above-mentioned method embodiments.
  • the aforementioned storage media may include various media capable of storing program codes, such as ROM or random storage RAM, magnetic disks, or optical disks.
  • the disclosed apparatus/equipment and method may be implemented in other ways.
  • the device/equipment embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the term “if” can be construed as “when” or “once” or “in response to determination” or “in response to detecting “.
  • the phrase “if determined” or “if detected [described condition or event]” can be interpreted as meaning “once determined” or “in response to determination” or “once detected [described condition or event]” depending on the context ]” or “in response to detection of [condition or event described]”.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本申请提供一种流量整形方法、装置与电子设备,涉及通信技术领域,其中,该方法包括:确定待播放的目标媒体流对应的可接受时延,并根据可接受时延和目标媒体流的码流信息确定恒定传输速率,然后根据恒定传输速率传输目标媒体流。其中,可接受时延为客户端可接受的目标媒体流的媒体播放时延,目标媒体流是采用可变码率编码的,目标媒体流的码流信息包括目标媒体流包含的各分片的大小和播放时长。本申请提供的技术方案可以提高网络传输性能和媒体播放效果。

Description

流量整形方法、装置与电子设备
本申请要求于2020年04月29日提交国家知识产权局、申请号为202010358023.5、申请名称为“流量整形方法、装置与电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种流量整形方法、装置与电子设备。
背景技术
在进行媒体传输时,一般都会对媒体进行编码后再进行传输,以提高传输效率。其中,可变码率(Variable Bit Rate,VBR)编码技术由于能够保证较高的媒体质量,而被普遍应用在各种媒体传输系统中。
VBR编码技术是根据图像或声音的复杂程度确定采用的编码码率,以视频传输为例,在图像不复杂的情况下,用比较低的码率编码;在图像复杂或者内容变化较大的情况下,用较大的码率编码,即VBR编码技术的码率可以随着图像的复杂程度的不同而变化,因而其编码效率较高,且可以保证视频质量。根据上述的VBR编码技术的编码原理可知,VBR编码技术具有码率变化大的特征,在实际应用中,其峰值码率可以达到甚至远远超过平均速率的数十倍,因此,采用VBR编码技术进行编码的媒体数据流量波动幅度较大。
而媒体流量波动会降低网络的资源利用率,且容易引起网络拥塞和延迟等问题,因而会导致网络传输性能较低,影响媒体播放效果。
发明内容
有鉴于此,本申请提供一种流量整形方法、装置与电子设备,用于提高网络传输性能和媒体播放效果。
为了实现上述目的,第一方面,本申请实施例提供一种流量整形方法,包括:
确定待播放的目标媒体流对应的可接受时延,并根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率,然后根据所述恒定传输速率传输所述目标媒体流。其中,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延,所述目标媒体流是采用可变码率编码的,所述目标媒体流的码流信息包括所述目标媒体流包含的各分片的大小和播放时长。
通过将VBR媒体流采用恒定传输速率传输,可以平滑传输数据流量,有效提高网络传输性能,同时相比生成恒定码率的媒体数据进行传输的方式,可以有效提高媒体质量和编码效率;另外,在确定恒定传输速率时,根据客户端的可接受时延和目标媒体流的码流信息进行确定,这样可以提高流量整形的精确度,减少客户端的卡顿现象,提高媒体播放效果。
在第一方面的一种可能的实施方式中,所述可接受时延是客户端发送的。
在第一方面的一种可能的实施方式中,所述可接受时延是预先设置的,或根据所述目标媒体流的广告播放时长确定的。
在第一方面的一种可能的实施方式中,所述方法还包括:向所述客户端发送所述可接受时延,以指示所述客户端在需要播放所述目标媒体流的下一媒体流的情况下,根据所述可接受时延请求所述下一媒体流。这样客户端可以更准确的确定传输下一媒体流的时间,减少媒体传输过早和过晚对媒体播放效果产生的影响。
在第一方面的一种可能的实施方式中,在所述根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率之后,所述根据所述恒定传输速率传输所述目标媒体流之前,所述方法还包括:若网络带宽信息满足预设条件,则增大所述恒定传输速率。这样可以提高网络资源的利用率。
在第一方面的一种可能的实施方式中,所述目标媒体流具有对应的原始媒体流,所述原始媒体流是采用恒定码率编码的,且所述可接受时延是预先设置的;所述根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率,包括:
将所述原始媒体流转换为采用可变码率编码的第一媒体流;并根据所述第一媒体流的码流信息和所述可接受时延,确定第一传输速率。
若预先设置的可保障传输速率减第一传输速率之差小于等于预设的速率阈值,则将所述第一媒体流确定为所述目标媒体流,将所述第一传输速率确定为所述恒定传输速率;若所述预先设置的可保障传输速率减第一传输速率之差大于所述速率阈值,则调整可变码率编码参数,返回执行将所述原始媒体流转换为采用可变码率编码的第一媒体流的步骤。
通过上述实施方式,可以将采用CBR编码的媒体转换成采用VBR编码的媒体,这样可以有效的提高媒体质量,进而提高媒体播放效果,并可以保持CBR的流量恒定特性,提高网络传输性能。
在第一方面的一种可能的实施方式中,所述目标媒体流的码流信息是采用时间序列分析方法确定的。这样可以扩大流量整形的适用范围。
在第一方面的一种可能的实施方式中,在所述根据所述恒定传输速率传输所述目标媒体流之前,所述方法还包括:与客户端协商确定所述客户端的媒体缓冲区大小,以指示客户端根据所述媒体缓冲区大小分配用于缓存目标媒体流的缓冲区,所述媒体缓冲区大小大于等于所述目标媒体流中数据量最大的分片的大小。这样可以进一步提高流量整形的精确度,减少客户端的卡顿现象,提高媒体播放效果。
在第一方面的一种可能的实施方式中,所述媒体缓冲区大小是所述客户端发送的,所述目标媒体流的分辨率是根据所述媒体缓冲区大小确定的。
在第一方面的一种可能的实施方式中,所述恒定传输速率与所述可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为所述恒定传输速率,d为所述可接受时延,ts为所述目标媒体流的播放起始时间,te为所述目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
第二方面,本申请实施例提供一种流量整形方法,包括:
确定待播放的目标媒体流对应的恒定传输速率;并根据所述恒定传输速率和所述目标媒体流的码流信息确定可接受时延,然后根据所述可接受时延和所述恒定传输速率传输所述目标媒体流,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延。
通过将VBR媒体流采用恒定传输速率传输,可以平滑传输数据流量,有效提高网络 传输性能,同时相比生成恒定码率的媒体数据进行传输的方式,可以有效提高媒体质量和编码效率;另外,在进行流量整形时,根据恒定传输速率和目标媒体流的码流信息确定客户端的可接受时延,然后根据可接受时延和恒定传输速率传输目标媒体流,这样可以提高流量整形的精确度,减少客户端的卡顿现象,提高媒体播放效果。
在第二方面的一种可能的实施方式中,所述确定待播放的目标媒体流对应的恒定传输速率,包括:根据网络带宽信息确定待播放的目标媒体流对应的恒定传输速率。这样可以提高确定的恒定传输速率的准确性,进而提高网络资源利用率。
在第二方面的一种可能的实施方式中,所述根据所述可接受时延和所述恒定传输速率传输所述目标媒体流,包括:若所述可接受时延满足预设要求,则采用所述恒定传输速率传输所述目标媒体流;若所述可接受时延不满足预设要求,则调整所述目标媒体流的分辨率,使基于调整后的目标媒体流的码流信息确定的可接受时延满足所述预设要求;并采用所述恒定传输速率传输调整后的所述目标媒体流。这样可以提高流量整形的精确度,提高客户端的媒体播放效果。
在第二方面的一种可能的实施方式中,在所述若所述可接受时延不满足预设要求,则调整所述目标媒体流的分辨率之前,所述方法还包括:
向所述客户端发送所述可接受时延;接收所述客户端发送的确认信息,所述确认信息用于指示所述可接受时延是否满足预设要求。
在第二方面的一种可能的实施方式中,所述恒定传输速率与所述可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为所述恒定传输速率,d为所述可接受时延,ts为所述目标媒体流的播放起始时间,te为所述目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
第三方面,本申请实施例提供一种流量整形方法,包括:
从媒体发送端获取待播放的目标媒体流的码流信息,然后根据预先确定的所述目标媒体流对应的可接受时延和所述目标媒体流的码流信息,确定恒定传输速率;再根据所述恒定传输速率传输所述目标媒体流。其中,所述目标媒体流是采用可变码率编码的;所述可接受时延为客户端可接受的目标媒体流的媒体播放时延,所述目标媒体流的码流信息包括所述目标媒体流包含的各分片的大小和播放时长。
通过将VBR媒体流采用恒定传输速率传输,可以平滑传输数据流量,有效提高网络传输性能,同时相比生成恒定码率的媒体数据进行传输的方式,可以有效提高媒体质量和编码效率;另外,在确定恒定传输速率时,根据客户端的可接受时延和目标媒体流的码流信息进行确定,这样可以提高流量整形的精确度,减少客户端的卡顿现象,提高媒体播放效果。
在第三方面的一种可能的实施方式中,所述根据所述恒定传输速率传输所述目标媒体流,包括:向所述媒体发送端发送数据传输请求,所述数据传输请求用于请求传输所述目标媒体流,所述数据传输请求中携带所述恒定传输速率;然后接收所述媒体发送端根据所述恒定传输速率发送的所述目标媒体流。
在第三方面的一种可能的实施方式中,所述方法还包括:在距离所述目标媒体流的播放结束时间的时长大于等于所述可接受时延的情况下,向所述媒体发送端请求获取下一媒 体流。这样客户端可以更准确的确定传输下一媒体流的时间,减少媒体传输过早和过晚对媒体播放效果产生的影响。
在第三方面的一种可能的实施方式中,所述恒定传输速率与所述可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为所述恒定传输速率,d为所述可接受时延,ts为所述目标媒体流的播放起始时间,te为所述目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
第四方面,本申请实施例提供一种流量整形装置,包括:参数确定模块和传输模块,其中:
所述参数确定模块用于:确定待播放的目标媒体流对应的可接受时延,并根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率,其中,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延,所述目标媒体流是采用可变码率编码的,所述目标媒体流的码流信息包括所述目标媒体流包含的各分片的大小和播放时长;
所述传输模块用于:根据所述恒定传输速率传输所述目标媒体流。
在第四方面的一种可能的实施方式中,所述可接受时延是客户端发送的。
在第四方面的一种可能的实施方式中,所述可接受时延是预先设置的,或根据所述目标媒体流的广告播放时长确定的。
在第四方面的一种可能的实施方式中,所述传输模块还用于:向所述客户端发送所述可接受时延,以指示所述客户端在需要播放所述目标媒体流的下一媒体流的情况下,根据所述可接受时延请求所述下一媒体流。
在第四方面的一种可能的实施方式中,所述参数确定模块还用于:在所述根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率之后,所述根据所述恒定传输速率传输所述目标媒体流之前,在网络带宽信息满足预设条件的情况下,增大所述恒定传输速率。
在第四方面的一种可能的实施方式中,所述目标媒体流具有对应的原始媒体流,所述原始媒体流是采用恒定码率编码的,且所述可接受时延是预先设置的;所述参数确定模块具体用于:
将所述原始媒体流转换为采用可变码率编码的第一媒体流;
根据所述第一媒体流的码流信息和所述可接受时延,确定第一传输速率;
若预先设置的可保障传输速率减第一传输速率之差小于等于预设的速率阈值,则将所述第一媒体流确定为所述目标媒体流,将所述第一传输速率确定为所述恒定传输速率;
若所述预先设置的可保障传输速率减第一传输速率之差大于所述速率阈值,则调整可变码率编码参数,返回执行将所述原始媒体流转换为采用可变码率编码的第一媒体流的步骤。
在第四方面的一种可能的实施方式中,所述目标媒体流的码流信息是采用时间序列分析方法确定的。
在第四方面的一种可能的实施方式中,所述参数确定模块还用于:在所述传输模块根据所述恒定传输速率传输所述目标媒体流之前,与客户端协商确定所述客户端的媒体缓冲区大小,以指示客户端根据所述媒体缓冲区大小分配用于缓存目标媒体流的缓冲区,所述 媒体缓冲区大小大于等于所述目标媒体流中数据量最大的分片的大小。
在第四方面的一种可能的实施方式中,所述媒体缓冲区大小是所述客户端发送的,所述目标媒体流的分辨率是根据所述媒体缓冲区大小确定的。
在第四方面的一种可能的实施方式中,所述恒定传输速率与所述可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为所述恒定传输速率,d为所述可接受时延,ts为所述目标媒体流的播放起始时间,te为所述目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
第五方面,本申请实施例提供一种流量整形装置,包括:参数确定模块和传输模块,其中:
所述参数确定模块用于:确定待播放的目标媒体流对应的恒定传输速率;并根据所述恒定传输速率和所述目标媒体流的码流信息确定可接受时延,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延;
所述传输模块用于:根据所述可接受时延和所述恒定传输速率传输所述目标媒体流。
在第五方面的一种可能的实施方式中,所述参数确定模块具体用于:
根据网络带宽信息确定待播放的目标媒体流对应的恒定传输速率。
在第五方面的一种可能的实施方式中,所述传输模块具体用于:在所述可接受时延满足预设要求的情况下,采用所述恒定传输速率传输所述目标媒体流;在所述可接受时延不满足预设要求的情况下,调整所述目标媒体流的分辨率,使基于调整后的目标媒体流的码流信息确定的可接受时延满足所述预设要求;并采用所述恒定传输速率传输调整后的所述目标媒体流。这样可以提高流量整形的精确度,提高客户端的媒体播放效果。
在第五方面的一种可能的实施方式中,所述传输模块还用于:在调整所述目标媒体流的分辨率之前,向所述客户端发送所述可接受时延;接收所述客户端发送的确认信息,所述确认信息用于指示所述可接受时延是否满足预设要求。
在第五方面的一种可能的实施方式中,所述恒定传输速率与所述可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为所述恒定传输速率,d为所述可接受时延,ts为所述目标媒体流的播放起始时间,te为所述目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
第六方面,本申请实施例提供一种流量整形装置,包括:
获取模块,用于从媒体发送端获取待播放的目标媒体流的码流信息,所述目标媒体流是采用可变码率编码的;
确定模块,用于根据预先确定的所述目标媒体流对应的可接受时延和所述目标媒体流的码流信息,确定恒定传输速率,其中,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延,所述目标媒体流的码流信息包括所述目标媒体流包含的各分片的大小和播放时长;
传输模块,用于根据所述恒定传输速率传输所述目标媒体流。
在第六方面的一种可能的实施方式中,所述传输模块具体用于:
向所述媒体发送端发送数据传输请求,所述数据传输请求用于请求传输所述目标媒体 流,所述数据传输请求中携带所述恒定传输速率;
接收所述媒体发送端根据所述恒定传输速率发送的所述目标媒体流。
在第六方面的一种可能的实施方式中,所述获取模块还用于:在距离所述目标媒体流的播放结束时间的时长大于等于所述可接受时延的情况下,向所述媒体发送端请求获取下一媒体流。
在第六方面的一种可能的实施方式中,所述恒定传输速率与所述可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为所述恒定传输速率,d为所述可接受时延,ts为所述目标媒体流的播放起始时间,te为所述目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
第七方面,本申请实施例提供一种电子设备,包括:存储器和处理器,存储器用于存储计算机程序;处理器用于在调用计算机程序时执行上述第一方面、第二方面或第三方面所述的方法。
第八方面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述第一方面、第二方面或第三方面所述的方法。
第九方面,本申请实施例提供一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述第一方面、第二方面或第三方面所述的方法。
第十方面,本申请实施例提供一种芯片系统,包括处理器,所述处理器与存储器耦合,所述处理器执行存储器中存储的计算机程序,以实现上述第一方面、第二方面或第三方面所述的方法。其中,所述芯片系统可以为单个芯片,或者多个芯片组成的芯片模组。
可以理解的是,上述第四方面至第十方面的有益效果可以参见上述第一方面至第三方面中的相关描述,在此不再赘述。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种应用场景的示意图;
图2为本申请实施例提供的流量整形方法的流程示意图;
图3为本申请实施例提供的媒体流转换示意图;
图4为本申请实施例提供的确定恒定传输速率的流程示意图;
图5为本申请实施例提供的另一种应用场景的示意图;
图6为本申请实施例提供的一种流量整形装置的结构示意图;
图7为本申请实施例提供的另一种流量整形装置的结构示意图;
图8为本申请实施例提供的电子设备的结构示意图。
具体实施方式
下面结合本申请实施例中的附图对本申请实施例进行描述。本申请实施例的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。
为了便于理解,下面先对本申请实施例涉及的一些相关技术进行说明。
目前的媒体编码中,普遍采用VBR编码技术,以保证媒体质量和编码效率。以视频编码为例,VBR编码技术的码率可以随着图像的复杂程度的不同而变化,即该编码技术的码率变化较大,这样会导致媒体数据流量具有波动幅度大的特点。而媒体流量波动会降低网络的资源利用率,且容易引起网络拥塞和延迟等问题,因而会导致网络传输性能较低,并影响媒体播放效果。
目前业界解决上述问题的方案主要包括两种:一种是通过改变编码技术来生成恒定码率的媒体数据,例如采用恒定码率(Constant Bit Rate,CBR)、约束可变码率(Constraint Variable Bit Rate,CVBR)或平均码率(Average Bit Rate,ABR)等编码技术;另一种是通过流量整形技术调整VBR媒体流的传输速率,来减小媒体流量波动,进而提高网络传输性能和媒体播放效果。
对于第一种方案,其中,CBR是以恒定码率方式进行编码,在媒体内容变化较大的场景,例如运动场景中,由于码率恒定,因此会降低媒体质量,即CBR编码技术是以牺牲媒体质量来保证媒体流量的稳定,而且该编码技术编码效率较低。CVBR一般是让用户输入最大码率和最小码率,媒体内容变化较小时,码率稳定在最小码率,媒体内容变化较大时,码率大于最小码率且不超过最大码率,该编码技术仍然存在码率波动的问题,即存在一定的媒体流量波动问题,并且也牺牲了一定的媒体质量。ABR是在一定的时间范围内达到设定的码率,但是局部码率的峰值可以超过设定的码率,即平均码率恒定,该编码技术只是限制了平均码率,并没有消除码率的波动,因而同样存在一定的媒体流量波动问题。
对于第二种方案,其相关技术包括缓冲发送方法、传输控制协议(Transmission Control Protocol,TCP)Pacing拥塞控制方法和约定访问速度(Committed Access Rate,CAR)等,其中,缓冲发送方法是将媒体数据放入缓冲区或队列内,再根据特定的算法(例如漏桶算法)均匀的向外发送这些被缓存的数据;TCP Pacing拥塞控制方法与缓冲发送方法类似,是将一个TCP发送窗口内的媒体数据以确定的速率发送;CAR是限制流量不能超过设定的阈值,当超过设定的阈值后,可以进行缓存降速。目前的这些流量整形技术一般都是只根据数据流量的流量大小进行流量控制,其控制精度有限,比较容易引起客户端媒体卡顿的现象而影响媒体播放效果。
针对上述问题,本申请实施例提供一种流量整形方法,通过将VBR媒体流采用恒定传输速率传输,来平滑传输数据流量,提高网络传输性能,同时保证媒体质量;并且通过在进行流量整形时,综合考虑媒体数据的码流信息和客户端可接受时延等要素,来提高流量整形的精确度,缓解客户端的卡顿现象,提高媒体播放效果。
下面结合几种应用场景来详细描述本申请的技术方案。
图1为本申请实施例提供的一种应用场景的示意图,如图1所示,该应用场景中涉及的设备可以包括:服务端100和客户端200,服务端100和客户端200直接通过网络进行数据传输。
服务端100和客户端200都可以是服务器、桌上型计算机、笔记本电脑、掌上电脑、手机或智能电视等具备计算和存储等功能的电子设备。
服务端100与客户端200之间进行通信的网络可以包括以太网、无线局域网(Wireless Local Area Networks,WLAN)(如无线保真(Wireless Fidelity,Wi-Fi)网络)和/或移动 通信网络等。
服务端100可以提供点播和直播服务,用户可以通过客户端200向服务端100请求获取媒体数据进行播放,其中,该媒体获取请求中可以携带待播放的目标媒体流的媒体标识、播放起止时间和媒体分辨率等信息;目标媒体流可以是视频流,也可以是音频流,为了便于理解,本申请实施例中以视频流为例进行示例性说明。
在服务端100接收到客户端200的媒体获取请求后,服务端100和客户端200可以根据目标媒体流的码流信息,对目标媒体流进行流量整形,以平滑传输数据流量,提高网络传输性能和媒体播放效果。其中,服务端100和客户端200在进行流量整形时,具体采用的流量整形方法可以参见图2。
图2为本申请实施例提供的流量整形方法的流程示意图,如图2所示,该方法可以包括如下步骤:
S110、服务端与客户端协商确定恒定传输速率和可接受时延。
本实施例中,服务端接收到客户端的媒体获取请求后,可以与客户端协商确定恒定传输速率和客户端的可接受时延等参数,其中,可接受时延为客户端可接受的目标媒体流的媒体播放时延,恒定传输速率和可接受时延相互约束,可以根据其中一个参数确定另一个参数。在具体确定另一个参数时,可以根据目标媒体流的码流信息和如下约束条件进行确定:
S(t)≤(t-t s+d)c,t∈[t s,t e]        (1)
其中,c为恒定传输速率,d为客户端的可接受时延,t s为目标媒体流的播放起始时间,t e为目标媒体流的播放结束时间,S(t)为t s到t之间的媒体数据量大小。
对于媒体流量已知的场景,例如视频点播场景,视频流(即目标媒体流)的码流信息可以根据服务端上的视频存储信息获知。该场景下,服务端上存储有各个视频文件,用户可以通过服务端提供的门户网站选择想要观看的视频进行下载和播放;服务端存储的视频文件可以预先采用分片技术分割成多个分片,各个分片可以单独传输、解码和播放,以便使视频边下载边播放。其中,视频文件中的分片的存储格式可以是HTTP实时流(HTTP Live Streaming,HLS)协议中的TS格式,也可以是HTTP上的动态自适应流传输(Dynamic Adaptive Streaming over HTTP,MPEG-DASH)标准中的m4s或mp4格式,还可以是其他格式,本实施例对此不做特别限定。每个分片包括至少一帧视频数据,每个分片具有对应的数据量大小和播放时长等码流信息,目标媒体流的码流信息包括目标媒体流包含的各分片的码流信息。
对于媒体流量未知的场景,例如视频直播场景,目标媒体流的码流信息可以采用时间序列分析方法进行估算,在具体实现时,可以采用任意一种相关的时间序列分析算法,本实施例对此不做特别限定。
本实施例中,确定恒定传输速率和可接受时延的过程可以在服务端执行,也可以在客户端执行,其中,在服务端执行时,服务端可以采用但不限于如下两种方式确定恒定传输速率和可接受时延:
第一种:先确定目标媒体流对应的可接受时延,再根据可接受时延和目标媒体流的码流信息确定目标媒体流对应的恒定传输速率。
具体的,可接受时延可以是客户端发送的,该可接受时延具体可以携带在媒体获取请 求中,当然也可以携带在其他消息中,本实施例对此不做特别限定。
可接受时延也可以是服务端单独确定的,其中,服务端可以根据经验值或目前大多数客户端的基本配置信息,预先设置好可接受时延。在播放广告的情况下,服务端也可以根据目标媒体流的广告播放时长确定可接受时延,例如可以将可接受时延设定为不高于广告播放时长的值。
服务端确定了可接受时延后,可以根据该可接受时延、目标媒体流的码流信息和公式(1)中的约束条件,计算出用于传输该目标媒体流的恒定传输速率。
具体实现时,对于目标媒体流中每个分片的播放结束时间t,可以计算出该播放结束时间t与目标媒体流的播放起始时间t s之间的媒体数据量大小S(t),然后确定每个分片对应的恒定传输速率:S(t)/(t﹣t s+d),将各个分片对应的恒定传输速率中的最大值确定为该目标媒体流对应的恒定传输速率。下面举例进行说明:
图3为本申请实施例提供的媒体流转换示意图,如图3所示,目标媒体流包括四个TS格式的分片:0.ts(分片0)、1.ts(分片1)、2.ts(分片2)和3.ts(分片3),其中,分片0的大小为6KB,播放起止时间为0~1s;分片1的大小为4KB,播放起止时间为1~2s;分片2的大小为10KB,播放起止时间为2~3s;分片3的大小为4KB,播放起止时间为3~4s,即每个分片的播放时长均为1s,t s=0,t e=4。
假设可接受时延d为2s,则对于分片0,t=1,对应的,S(t)=S(1)=6KB,t_sum=t﹣t s+d=1+2=3s;分片0对应的恒定传输速率c 0=S(t)/t_sum=6/3=2KB/s。
对于分片1:t=2,S(t)=S(2)=6+4=10KB,t_sum=2+2=4s;分片1对应的恒定传输速率c 1=S(t)/t_sum=10/4=2.5KB/s。
对于分片2:t=3,S(t)=S(3)=6+4+10=20KB,t_sum=3+2=5s;分片2对应的恒定传输速率c 2=S(t)/t_sum=20/5=4KB/s。
对于分片3:t=4,S(t)=S(4)=6+4+10+4=24KB,t_sum=4+2=6s;分片3对应的恒定传输速率c 3=S(t)/t_sum=24/6=4KB/s。
即各分片对应的恒定传输速率分别为:2KB/s、2.5KB/s、4KB/s和4KB/s,其中的最大值为4KB/s,则目标媒体流对应的恒定传输速率即可以为4KB/s。
如图3所示,原来需要4s传输完的四个分片,可以在6s内以恒定传输速率4KB/s传输完毕,即可以认为将VBR码流(即目标媒体流)转换成了恒定码流。对于转换后的恒定码流,服务端在第0秒开始传输分片0的前4KB数据;在第1秒开始传输分片0的后2KB数据和分片1的前2KB数据;在第2秒开始传输分片1的后2KB数据和分片2的前2KB数据;在第3秒到第5秒期间传输分片2的剩余8KB数据;在第5秒开始传输分片3的4KB数据。
服务端在确定了恒定传输速率后,在网络带宽资源比较空闲的情况下,也可以对确定的恒定传输速率进行调整,加快传输速度,提高网络资源利用率,即如果网络带宽信息满足预设条件,则可以增大恒定传输速率。
第二种:先确定目标媒体流对应的恒定传输速率,再根据恒定传输速率和目标媒体流的码流信息确定目标媒体流对应的可接受时延。
具体的,服务端可以根据经验值预先设置恒定传输速率,也可以根据网络带宽信息确定目标媒体流对应的恒定传输速率,比如:在可保障的网络带宽不低于100M的情况下, 可以直接将发送速率确定为不高于100Mb/s的值。
服务端确定了恒定传输速率后,可以根据该恒定传输速率、目标媒体流的码流信息和公式(1)中的约束条件,计算出用于传输该目标媒体流的可接受时延。
具体实现时,对于目标媒体流中每个分片的播放结束时间t,可以计算出该播放结束时间t与目标媒体流的播放起始时间t s之间的媒体数据量大小S(t),然后确定每个分片对应的可接受时延:S(t)/c﹣(t﹣t s),将各个分片对应的可接受时延中的最大值确定为该目标媒体流对应的可接受时延。下面举例进行说明:
继续以上述图3为例,假设目标媒体流对应的恒定传输速率c为4KB/s,则对于分片0,t s=0,t=1,S(t)=S(1)=6KB,t﹣t s=1s;分片0对应的可接受时延d 0=S(t)/c﹣(t﹣t s)=6/4﹣1=0.5s。
对于分片1:t=2,S(t)=S(2)=6+4=10KB,t﹣t s=2s;分片1对应的可接受时延d 1=S(t)/c﹣(t﹣t s)=10/4﹣2=0.5s。
对于分片2:t=3,S(t)=S(3)=6+4+10=20KB,t﹣t s=3s;分片2对应的可接受时延d 2=S(t)/c﹣(t﹣t s)=20/4﹣3=2s。
对于分片3:t=4,S(t)=S(4)=6+4+10+4=24KB,t﹣t s=4s;分片3对应的可接受时延d 3=S(t)/c﹣(t﹣t s)=24/4﹣4=2s。
即各分片对应的可接受时延分别为:0.5s、0.5s、2s和2s,其中的最大值为2s,则目标媒体流对应的可接受时延即可以为2s。
服务端确定了可接受时延后,可以判断可接受时延是否满足预设要求,如果满足,可以直接采用确定的恒定传输速率传输目标媒体流;如果不满足,可以调整目标媒体流的分辨率,使基于调整后的目标媒体流的码流信息确定的可接受时延满足预设要求,然后再传输调整后的目标媒体流,以降低客户端的卡顿现象,提高媒体播放效果。
其中,服务端可以根据预先设置的时延阈值来判断可接受时延是否满足预设要求,例如判断可接受时延是否大于时延阈值,若大于,则认为可接受时延不满足预设要求,否则可以认为可接受时延满足预设要求。
服务端也可以向客户端发送可接受时延,根据客户端反馈的确认信息来判断可接受时延是否满足预设要求。即可以由客户端根据预先设置的时延阈值来判断可接受时延是否满足预设要求,若满足,客户端可以向服务端反馈用于指示可接受时延满足预设要求的确认信息,若不满足,客户端可以向服务端反馈用于指示可接受时延不满足预设要求的确认信息。
服务端在可接受时延不满足预设要求的情况下,可以通过降低目标媒体流的分辨率来减小可接受时延,例如可以将目标媒体流的分辨率从1080p降为720p,若可接受时延还不满足预设要求,可以再次降低分辨率。其中,目标媒体流的原始分辨率可以是客户端请求的,也可以是服务端预先确定的。当然,服务端在可接受时延不满足预设要求的情况下,也可以适当调整恒定传输速率,或者也可以不做处理,本实施例对此不做特别限定。
服务端在确定好可接受时延后,可以向客户端发送该可接受时延,这样客户端在需要播放目标媒体流的下一媒体流的情况下,可以根据可接受时延提前请求下一媒体流(详细描述可以参见后续步骤),以减少网络延迟现象,进而提高视频播放效果。
如前面所述,本实施例中,确定恒定传输速率和可接受时延的过程也可以在客户端执 行。具体的,在客户端确定恒定传输速率和可接受时延时,客户端可以先确定目标媒体流对应的可接受时延,并从服务端获取目标媒体流的码流信息;然后根据预先确定的可接受时延和目标媒体流的码流信息,确定恒定传输速率。
在具体实现时,可接受时延可以是系统预先设置的,也可以是根据媒体缓冲区大小确定的,当然,客户端也可以从服务端获取可接受时延,本实施例对此不做特别限定。
客户端确定了可接受时延后,可以根据该可接受时延、目标媒体流的码流信息和公式(1)中的约束条件,计算出用于传输该目标媒体流的恒定传输速率。具体的实现过程与服务端类似,此处不再赘述。
与服务端类似,客户端也可以先确定恒定传输速率,再根据恒定传输速率和目标媒体流的码流信息,确定可接受时延;并可以在可接受时延不满足预设要求的情况下,请求服务端调整目标媒体流的分辨率,基于调整后的目标媒体流的码流信息重新确定可接受时延,使重新确定的可接受时延满足预设要求。具体的实现过程与服务端类似,此处不再赘述。
服务端或客户端确定了恒定传输速率之后,若传输起始时间是在对端进行控制,则可以将该恒定传输速率发送给对端,以便对端进行目标媒体流的传输控制。
本实施例中,为了进一步提高媒体播放效果,在进行流量整形过程中,还可以与客户端协商确定客户端的媒体缓冲区大小,以使客户端根据该媒体缓冲区大小分配用于缓存目标媒体流的缓冲区,降低由于客户端媒体缓冲区大小不足而造成的媒体丢失和卡顿现象。
其中,媒体缓冲区大小可以大于等于目标媒体流中数据量最大的分片的大小,以保证客户端可以有足够的空间缓存目标媒体流的完整分片。
本实施例中,媒体缓冲区大小可以是客户端根据自身的内存配置信息确定的,若确定可接受时延和恒定传输速率的过程在服务端执行,则客户端可以将媒体缓冲区大小发送给服务端,服务端可以根据媒体缓冲区大小确定目标媒体流的分辨率。
在具体实现时,服务端可以判断该媒体缓冲区大小是否满足要求,即判断该媒体缓冲区大小是否大于目标媒体流中数据量最大的分片的大小,若是,可以保持目标媒体流的分辨率不变,若不是,与基于可接受时延调整目标媒体流的分辨率类似,服务端可以调整目标媒体流的分辨率,使媒体缓冲区大小满足上述要求。
若确定可接受时延和恒定传输速率的过程在客户端执行,客户端可以在媒体缓冲区大小不满足要求时,请求服务端调整目标媒体流的分辨率,使媒体缓冲区大小满足上述要求。
本实施例中,媒体缓冲区大小也可以不是预先确定好的,而是根据目标媒体流中数据量最大的分片的大小确定的。例如:客户端未向服务端发送媒体缓冲区大小,服务端可以在确定好目标媒体流对应的可接受时延和恒定传输速率后,可以直接将媒体缓冲区大小确定为目标媒体流中数据量最大的分片的大小,然后将该媒体缓冲区大小发送给客户端。
S120、服务端与客户端之间以恒定传输速率传输目标媒体流。
服务端与客户端在协商好恒定传输速率和可接受时延后,就可以根据该恒定传输速率按播放时间先后顺序依次传输目标媒体流中的各分片。
其中,在进行传输时,服务端可以在协商好恒定传输速率后即以该恒定传输速率向客户端发送目标媒体流,即由服务端控制目标媒体流的传输起始时间;服务端也可以在协商好恒定传输速率后,接收到客户端发送的数据传输请求的情况下,向客户端发送目标媒体 流,即由客户端控制目标媒体流的传输起始时间,其中,该数据传输请求中可以携带目标媒体流的标识,以表示该请求是用于请求传输目标媒体流,另外,该数据传输请求中可以携带恒定传输速率,以告诉服务端以该恒定传输速率传输目标媒体流。
服务端在传输目标媒体流时,可以通过传输层发送窗口、网卡出口速率或其他方式控制传输速率,使目标媒体流的传输速率为上述恒定传输速率。
为了方便传输,服务端或客户端可以为目标媒体流添加传输时间标签,即可以在传输目标媒体流之前,确定目标媒体流中每个分片的传输时间标签,标识每个分片的发送时刻。
客户端接收到服务端传输的媒体文件后,可以将其缓存在媒体缓冲区中,当接收到一个完整的分片后,可以在到达该分片的播放起始时间之前,从缓冲区中取出该分片进行解码,然后在满足该分片的播放要求时播放该分片,比如:可以在到达该分片的播放起始时间或接收到用户的播放指令时进行播放。在从缓冲区中取出该分片的数据后,客户端可以释放缓冲区,以接收新的媒体数据。
S130、客户端根据可接受时延向服务端请求获取下一媒体流。
客户端在目标媒体流播放结束前,可以向服务端请求下一媒体流进行播放。
在具体实现时,客户端可以在当前时间距离目标媒体流的播放结束时间的时长大于等于可接受时延的情况下,向服务端请求获取下一媒体流,服务端与客户端重复上述步骤S110和S120,完成参数协商,并传输该下一媒体流。其中,在进行下一媒体流的参数协商时,也可以根据目标媒体流对应的协商参数的值确定,例如:在确定目标媒体流对应的协商参数时,客户端向服务端发送了可接受时延,在确定下一媒体流对应的协商参数时,客户端可以不发送该可接受时延,服务端可以直接采用客户端上次发送的可接受时延确定恒定传输速率;同样的,如果是先确定恒定传输速率,也可以直接采用上次确定的恒定传输速率确定可接受时延;媒体缓冲区大小也可以采用类似的方法,本实施例对此均不做特别限定。
其中,该下一媒体流与目标媒体流可以是同一媒体中的不同片断,也可以属于不同的媒体。当然,在不需要播放下一媒体流时,也可以不执行该步骤S130。
本实施例中,通过将VBR媒体流采用恒定传输速率传输,可以平滑传输数据流量,有效提高网络传输性能,同时相比生成恒定码率的媒体数据进行传输的方式,可以有效提高媒体质量和编码效率;另外,本实施例中,在进行流量整形时,综合考虑媒体数据的码流信息和客户端可接受时延等要素,这样可以提高流量整形的精确度,减少客户端的卡顿现象,提高媒体播放效果。
下面介绍本申请的技术方案所适用的另一种应用场景。该应用场景下,为了便于带宽管理,采用CBR编码方式编码媒体,同时对媒体流量进行了带宽质量保障。该应用场景具体可以是交互式网络电视(Internet Protocol television,IPTV)场景或其他类似场景,本申请实施例中以IPTV场景为例进行示例性说明。
该应用场景下,可以由运营商统一设定客户端的可接受播放时延和可保障传输速率,其中,各媒体的可接受播放时延可以相同也可以不同,具体可以根据实际情况设置。
对于每个媒体,服务端可以将该媒体的CBR媒体流转换成VBR媒体流,并使转换后的VBR媒体流对应的恒定传输速率尽量接近或等于可保障传输速率。具体实现过程可以参见图4,图4为本申请实施例提供的确定恒定传输速率的流程示意图,如图4所示,该 方法可以包括如下步骤:
S111、将原始媒体流转换为采用可变码率编码的第一媒体流。
本实施例中,可以将VBR媒体流转换成恒定的数据流量,因此,服务端可以将CBR编码的原始媒体流转换为VBR编码的媒体流(即第一媒体流),以提高媒体质量。
S112、根据第一媒体流的码流信息和可接受时延,确定第一传输速率c1。
在转换得到第一媒体流后,可以依据前述公式(1)确定第一媒体流对应的恒定传输速率(即第一传输速率c1),具体的确定过程与前面确定恒定传输速率的方式类似,此处不再赘述。
S113、判断预先设置的可保障传输速率c_q减第一传输速率c1之差是否小于等于预设的速率阈值c_t,若是则执行步骤S114,否则执行步骤S115。
具体的,在确定出第一传输速率c1后,可以判断第一传输速率c1与可保障传输速率c_q之间的接近程度,此处通过可保障传输速率c_q减第一传输速率c1的差值(即c_q﹣c1)与速率阈值c_t之间的大小关系来衡量该接近程度,在c_q﹣c1≤c_t的情况下,可以认为第一传输速率c1与可保障传输速率c_q之间的接近程度满足要求;在c_q﹣c1>c_t的情况下,可以认为第一传输速率c1与可保障传输速率c_q之间的接近程度不满足要求。
其中,该速率阈值可以根据实际需要设置,本实施例对此不做特别限定。在具体实现时,也可以是判断c_q﹣c1的值是否小于速率阈值c_t,在c_q﹣c1<c_t的情况下,认为第一传输速率c1与可保障传输速率c_q之间的接近程度满足要求;在c_q﹣c1≥c_t的情况下,认为第一传输速率c1与可保障传输速率c_q之间的接近程度不满足要求,本实施例对此不做特别限定。
S114、将第一媒体流确定为目标媒体流,将第一传输速率c1确定为恒定传输速率。
如果可保障传输速率c_q减第一传输速率c1之差小于等于速率阈值c_t,即c_q﹣c1≤c_t,说明第一传输速率c1与可保障传输速率c_q之间比较接近,此时可以将第一媒体流确定为目标媒体流,将第一传输速率确定为恒定传输速率。
S115、调整可变码率编码参数,返回执行步骤S111。
如果可保障传输速率c_q减第一传输速率c1之差大于速率阈值c_t,即c_q﹣c1>c_t,说明第一传输速率c1与可保障传输速率c_q之间的差别较大,此时可以调整可变码率编码参数,返回执行步骤S111,直至重新生成的第一媒体流对应的第一传输速率c1与可保障传输速率c_q之间的接近程度满足要求为止。
服务端根据CBR编码的原始媒体流转换得到VBR编码的目标媒体流之后,服务端与客户端之间可以采用目标媒体流对应的恒定传输速率传输目标媒体流,客户端也可以根据可接受时延向服务端请求获取下一媒体流,具体实现过程与前述步骤S120和S130类似,此处不再赘述。
本实施例提供的上述技术方案,可以将CBR编码的媒体流转换成VBR编码的媒体流进行传输,这样可以有效的提高媒体质量,进而提高媒体播放效果,并可以保持CBR的流量恒定特性,提高网络传输性能。
下面介绍本申请的技术方案所适用的另一种应用场景。
图5为本申请实施例提供的另一种应用场景的示意图,如图5所示,该应用场景中涉及的设备可以包括:服务端100、客户端200和网关设备300,服务端100、网关设备300 和客户端200之间通过网络进行数据传输。
该应用场景与前述应用场景的不同之处在于,服务端100与客户端200之间还包括其他中转设备,该中转设备可以是图5中所示的网关设备300,也可以是其他设备,比如路由器等,中转设备可以包括一个或多个,本实施例中是以中转设备包括一个网关设备300为例进行示例性说明,其并非用于限制本申请。
具体的,网关设备300可以从服务端100下载媒体数据并进行缓存,客户端200可以向网关设备300请求目标媒体流进行播放,网关设备300可以基于客户端200的请求,对目标媒体流进行流量整形,网关设备300与客户端200之间的交互过程与图2中服务端100与客户端200之间的交互过程类似,此处不再赘述。也就是说,本申请中,实现流量整形的媒体发送端可以是服务端100,也可以是服务端100与客户端200之间的中转设备,这样可以有效扩大流量整形的适用范围。
本领域技术人员可以理解,以上实施例是示例性的,并非用于限定本申请。在可能的情况下,以上实施例中的一个或者几个步骤的执行顺序可以进行调整,也可以进行选择性组合,得到一个或多个其他实施例。本领域技术人员可以根据需要从上述步骤中任意进行选择组合,凡是未脱离本申请方案实质的,都落入本申请的保护范围。
基于同一发明构思,作为对上述方法的实现,本申请实施例提供了流量整形装置,该装置实施例与前述方法实施例对应,为便于阅读,本装置实施例不再对前述方法实施例中的细节内容进行逐一赘述,但应当明确,本实施例中的装置能够对应实现前述方法实施例中的全部内容。
图6为本申请实施例提供的一种流量整形装置的结构示意图,该装置可以应用于媒体发送端,如图6所示,本实施例提供的流量整形装置110可以包括:参数确定模块111和传输模块112,其中:
参数确定模块111用于:确定待播放的目标媒体流对应的可接受时延,并根据可接受时延和目标媒体流的码流信息确定恒定传输速率,其中,可接受时延为客户端可接受的目标媒体流的媒体播放时延,目标媒体流是采用可变码率编码的,目标媒体流的码流信息包括目标媒体流包含的各分片的大小和播放时长;
传输模块112用于:根据恒定传输速率传输目标媒体流。
其中,可接受时延可以是客户端发送的;可接受时延也可以是预先设置的,或根据目标媒体流的广告播放时长确定的。
作为本申请实施例一种可选的实施方式,传输模块112还用于:向客户端发送可接受时延,以指示客户端在需要播放目标媒体流的下一媒体流的情况下,根据可接受时延请求下一媒体流。
作为本申请实施例一种可选的实施方式,参数确定模块111还用于:在根据可接受时延和目标媒体流的码流信息确定恒定传输速率之后,根据恒定传输速率传输目标媒体流之前,在网络带宽信息满足预设条件的情况下,增大恒定传输速率。
作为本申请实施例一种可选的实施方式,目标媒体流具有对应的原始媒体流,原始媒体流是采用恒定码率编码的,且可接受时延是预先设置的;参数确定模块111具体用于:
将原始媒体流转换为采用可变码率编码的第一媒体流;
根据第一媒体流的码流信息和可接受时延,确定第一传输速率;
若预先设置的可保障传输速率减第一传输速率之差小于等于预设的速率阈值,则将第一媒体流确定为目标媒体流,将第一传输速率确定为恒定传输速率;
若预先设置的可保障传输速率减第一传输速率之差大于速率阈值,则调整可变码率编码参数,返回执行将原始媒体流转换为采用可变码率编码的第一媒体流的步骤。
作为本申请实施例一种可选的实施方式,目标媒体流的码流信息是采用时间序列分析方法确定的。
作为本申请实施例一种可选的实施方式,参数确定模块111还用于:在传输模块112根据恒定传输速率传输目标媒体流之前,与客户端协商确定客户端的媒体缓冲区大小,以指示客户端根据媒体缓冲区大小分配用于缓存目标媒体流的缓冲区,媒体缓冲区大小大于等于目标媒体流中数据量最大的分片的大小。
作为本申请实施例一种可选的实施方式,媒体缓冲区大小是客户端发送的,目标媒体流的分辨率是根据媒体缓冲区大小确定的。
作为本申请实施例一种可选的实施方式,恒定传输速率与可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为恒定传输速率,d为可接受时延,ts为目标媒体流的播放起始时间,te为目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
在另一实施例中,作为一种可选的实施方式,参数确定模块111用于:确定待播放的目标媒体流对应的恒定传输速率;并根据恒定传输速率和目标媒体流的码流信息确定可接受时延,可接受时延为客户端可接受的目标媒体流的媒体播放时延;
传输模块112用于:根据可接受时延和恒定传输速率传输目标媒体流。
作为本申请实施例一种可选的实施方式,参数确定模块111具体用于:根据网络带宽信息确定待播放的目标媒体流对应的恒定传输速率。
作为本申请实施例一种可选的实施方式,传输模块112具体用于:在可接受时延满足预设要求的情况下,采用恒定传输速率传输目标媒体流;在可接受时延不满足预设要求的情况下,调整目标媒体流的分辨率,使基于调整后的目标媒体流的码流信息确定的可接受时延满足预设要求;并采用恒定传输速率传输调整后的目标媒体流。这样可以提高流量整形的精确度,提高客户端的媒体播放效果。
作为本申请实施例一种可选的实施方式,传输模块112还用于:在调整目标媒体流的分辨率之前,向客户端发送可接受时延;接收客户端发送的确认信息,确认信息用于指示可接受时延是否满足预设要求。
本实施例提供的装置可以执行上述方法实施例中媒体发送端所执行的方法,其实现原理与技术效果类似,此处不再赘述。
图7为本申请实施例提供的另一种流量整形装置的结构示意图,该装置可以应用于客户端,如图7所示,本实施例提供的流量整形装置120可以包括:
获取模块121,用于从媒体发送端获取待播放的目标媒体流的码流信息,目标媒体流是采用可变码率编码的;
参数确定模块122,用于根据预先确定的目标媒体流对应的可接受时延和目标媒体流的码流信息,确定恒定传输速率,其中,可接受时延为客户端可接受的目标媒体流的媒体 播放时延,目标媒体流的码流信息包括目标媒体流包含的各分片的大小和播放时长;
传输模块123,用于根据恒定传输速率传输目标媒体流。
作为本申请实施例一种可选的实施方式,传输模块123具体用于:
向媒体发送端发送数据传输请求,数据传输请求用于请求传输目标媒体流,数据传输请求中携带恒定传输速率;
接收媒体发送端根据恒定传输速率发送的目标媒体流。
作为本申请实施例一种可选的实施方式,获取模块121还用于:在距离目标媒体流的播放结束时间的时长大于等于可接受时延的情况下,向媒体发送端请求获取下一媒体流。
作为本申请实施例一种可选的实施方式,恒定传输速率与可接受时延之间满足如下条件:
S(t)≤(t-t s+d)c,t∈[t s,t e]
其中,c为恒定传输速率,d为可接受时延,ts为目标媒体流的播放起始时间,te为目标媒体流的播放结束时间,S(t)为ts到t之间的媒体数据量大小。
本实施例提供的装置可以执行上述方法实施例中客户端所执行的方法,其实现原理与技术效果类似,此处不再赘述。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
基于同一发明构思,本申请实施例还提供了一种电子设备。图8为本申请实施例提供的电子设备的结构示意图,如图8所示,本实施例提供的电子设备可以包括:处理器210、存储器220和通信模块230等。
其中,处理器210可以包括中央处理器210、应用处理器210(application processor,AP)、基带处理器210等处理器210中的一种或多种。处理器210可以是无线路由器的神经中枢和指挥中心。处理器210可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。存储器220可以用于存储计算机可执行程序代码,可执行程序代码包括指令。处理器210通过运行存储在存储器220的指令,从而执行电子设备的各种功能应用以及数据处理。存储器220可以包括存储程序区和存储数据区,比如存储待播放的声音信号的数据等。例如,该存储器220可以是双倍速率同步动态随机存储器220DDR或闪存Flash等。
通信模块230可以提供应用在电子设备上的包括无线局域网(Wireless Local Area Networks,WLAN)(如无线保真(Wireless Fidelity,Wi-Fi)网络),蓝牙(Bluetooth,BT),移动通信网络,全球导航卫星系统(Global Navigation Satellite System,GNSS),调频(Frequency Modulation,FM),近距离无线通信技术(Near Field Communication, NFC),红外技术(Infrared,IR)等通信的解决方案。通信模块230可以是集成至少一个通信处理模块的一个或多个器件。该通信模块230可以包括天线,该天线可以只有一个阵元,也可以是包括多个阵元的天线阵列。该通信模块230可以通过天线接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。通信模块230还可以从处理器210接收待发送的信号,对其进行调频、放大,经天线转为电磁波辐射出去。
电子设备还可以包括电源管理模块(未示出),电源管理模块可以接收电池和/或充电器的输入,为处理器210、存储器220和通信模块230等供电。
需要说明的是,上述图8并不构成对电子设备结构的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如电子设备还可以包括显示屏、指示灯、马达、控件(例如按键)、陀螺仪传感器、加速度传感器等。
该电子设备可以是上述的媒体发送端,也可以是客户端。
本实施例提供的电子设备可以执行上述方法实施例,其实现原理与技术效果类似,此处不再赘述。
本申请实施例还提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述方法实施例所述的方法。
本申请实施例还提供一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行时实现上述方法实施例所述的方法。
本申请实施例还提供一种芯片系统,该芯片系统包括处理器,处理器与存储器耦合,处理器执行存储器中存储的计算机程序,以实现上述方法实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者通过所述计算机可读存储介质进行传输。所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如软盘、硬盘或磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质可以包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
在本申请所提供的实施例中,应该理解到,所揭露的装置/设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/设备实施例仅仅是示意性的,例如,所述模块或单 元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (22)

  1. 一种流量整形方法,其特征在于,包括:
    确定待播放的目标媒体流对应的可接受时延,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延;
    根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率,其中,所述目标媒体流是采用可变码率编码的,所述目标媒体流的码流信息包括所述目标媒体流包含的各分片的大小和播放时长;
    根据所述恒定传输速率传输所述目标媒体流。
  2. 根据权利要求1所述的方法,其特征在于,所述可接受时延是客户端发送的。
  3. 根据权利要求1所述的方法,其特征在于,所述可接受时延是预先设置的,或根据所述目标媒体流的广告播放时长确定的。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    向所述客户端发送所述可接受时延,以指示所述客户端在需要播放所述目标媒体流的下一媒体流的情况下,根据所述可接受时延请求所述下一媒体流。
  5. 根据权利要求1所述的方法,其特征在于,在所述根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率之后,所述根据所述恒定传输速率传输所述目标媒体流之前,所述方法还包括:
    若网络带宽信息满足预设条件,则增大所述恒定传输速率。
  6. 根据权利要求1所述的方法,其特征在于,所述目标媒体流具有对应的原始媒体流,所述原始媒体流是采用恒定码率编码的,且所述可接受时延是预先设置的;所述根据所述可接受时延和所述目标媒体流的码流信息确定恒定传输速率,包括:
    将所述原始媒体流转换为采用可变码率编码的第一媒体流;
    根据所述第一媒体流的码流信息和所述可接受时延,确定第一传输速率;
    若预先设置的可保障传输速率减第一传输速率之差小于等于预设的速率阈值,则将所述第一媒体流确定为所述目标媒体流,将所述第一传输速率确定为所述恒定传输速率;
    若所述预先设置的可保障传输速率减第一传输速率之差大于所述速率阈值,则调整可变码率编码参数,返回执行将所述原始媒体流转换为采用可变码率编码的第一媒体流的步骤。
  7. 根据权利要求1所述的方法,其特征在于,所述目标媒体流的码流信息是采用时间序列分析方法确定的。
  8. 根据权利要求1所述的方法,其特征在于,在所述根据所述恒定传输速率传输所述目标媒体流之前,所述方法还包括:
    与客户端协商确定所述客户端的媒体缓冲区大小,以指示客户端根据所述媒体缓冲区大小分配用于缓存目标媒体流的缓冲区,所述媒体缓冲区大小大于等于所述目标媒体流中数据量最大的分片的大小。
  9. 根据权利要求8所述的方法,其特征在于,所述媒体缓冲区大小是所述客户端发送的,所述目标媒体流的分辨率是根据所述媒体缓冲区大小确定的。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述恒定传输速率与所述可接 受时延之间满足如下条件:
    S(t)≤(t-t s+d)c,t∈[t s,t e]
    其中,c为所述恒定传输速率,d为所述可接受时延,t s为所述目标媒体流的播放起始时间,t e为所述目标媒体流的播放结束时间,S(t)为t s到t之间的媒体数据量大小。
  11. 一种流量整形方法,其特征在于,包括:
    确定待播放的目标媒体流对应的恒定传输速率;
    根据所述恒定传输速率和所述目标媒体流的码流信息确定可接受时延,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延;
    根据所述可接受时延和所述恒定传输速率传输所述目标媒体流。
  12. 根据权利要求11所述的方法,其特征在于,所述确定待播放的目标媒体流对应的恒定传输速率,包括:
    根据网络带宽信息确定待播放的目标媒体流对应的恒定传输速率。
  13. 根据权利要求11所述的方法,其特征在于,所述根据所述可接受时延和所述恒定传输速率传输所述目标媒体流,包括:
    若所述可接受时延满足预设要求,则采用所述恒定传输速率传输所述目标媒体流;
    若所述可接受时延不满足预设要求,则调整所述目标媒体流的分辨率,使基于调整后的目标媒体流的码流信息确定的可接受时延满足所述预设要求;并采用所述恒定传输速率传输调整后的所述目标媒体流。
  14. 根据权利要求13所述的方法,其特征在于,在所述若所述可接受时延不满足预设要求,则调整所述目标媒体流的分辨率之前,所述方法还包括:
    向所述客户端发送所述可接受时延;
    接收所述客户端发送的确认信息,所述确认信息用于指示所述可接受时延是否满足预设要求。
  15. 根据权利要求11-14任一项所述的方法,其特征在于,所述恒定传输速率与所述可接受时延之间满足如下条件:
    S(t)≤(t-t s+d)c,t∈[t s,t e]
    其中,c为所述恒定传输速率,d为所述可接受时延,t s为所述目标媒体流的播放起始时间,t e为所述目标媒体流的播放结束时间,S(t)为t s到t之间的媒体数据量大小。
  16. 一种流量整形方法,其特征在于,包括:
    从媒体发送端获取待播放的目标媒体流的码流信息,所述目标媒体流是采用可变码率编码的;
    根据预先确定的所述目标媒体流对应的可接受时延和所述目标媒体流的码流信息,确定恒定传输速率,其中,所述可接受时延为客户端可接受的目标媒体流的媒体播放时延,所述目标媒体流的码流信息包括所述目标媒体流包含的各分片的大小和播放时长;
    根据所述恒定传输速率传输所述目标媒体流。
  17. 根据权利要求16所述的方法,其特征在于,所述根据所述恒定传输速率传输所述目标媒体流,包括:
    向所述媒体发送端发送数据传输请求,所述数据传输请求用于请求传输所述目标媒体流,所述数据传输请求中携带所述恒定传输速率;
    接收所述媒体发送端根据所述恒定传输速率发送的所述目标媒体流。
  18. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    在距离所述目标媒体流的播放结束时间的时长大于等于所述可接受时延的情况下,向所述媒体发送端请求获取下一媒体流。
  19. 根据权利要求16-18任一项所述的方法,其特征在于,所述恒定传输速率与所述可接受时延之间满足如下条件:
    S(t)≤(t-t s+d)c,t∈[t s,t e]
    其中,c为所述恒定传输速率,d为所述可接受时延,t s为所述目标媒体流的播放起始时间,t e为所述目标媒体流的播放结束时间,S(t)为t s到t之间的媒体数据量大小。
  20. 一种电子设备,其特征在于,包括:存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于在调用所述计算机程序时执行如权利要求1-19任一项所述的方法。
  21. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1-19任一项所述的方法。
  22. 一种芯片系统,其特征在于,所述芯片系统包括处理器,所述处理器与存储器耦合,所述处理器执行存储器中存储的计算机程序,以实现如权利要求1-19任一项所述的方法。
PCT/CN2021/081668 2020-04-29 2021-03-19 流量整形方法、装置与电子设备 WO2021218479A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010358023.5A CN113573062B (zh) 2020-04-29 2020-04-29 流量整形方法、装置与电子设备
CN202010358023.5 2020-04-29

Publications (1)

Publication Number Publication Date
WO2021218479A1 true WO2021218479A1 (zh) 2021-11-04

Family

ID=78157752

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/081668 WO2021218479A1 (zh) 2020-04-29 2021-03-19 流量整形方法、装置与电子设备

Country Status (2)

Country Link
CN (1) CN113573062B (zh)
WO (1) WO2021218479A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024179279A1 (zh) * 2023-03-01 2024-09-06 深圳Tcl新技术有限公司 多媒体数据传输方法、装置、介质及设备

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979757B (zh) * 2022-06-02 2024-01-30 北京字跳网络技术有限公司 视频发布方法、装置、设备及存储介质
CN114915593B (zh) * 2022-06-10 2023-05-09 北京世纪好未来教育科技有限公司 基于Redis的流量控制方法、装置、电子设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7530089B1 (en) * 2004-03-29 2009-05-05 Nortel Networks Limited System and method for improving video quality using a constant bit rate data stream
CN103152497A (zh) * 2013-03-29 2013-06-12 贵阳朗玛信息技术股份有限公司 手机VoIP系统中动态比特率的实现方法、装置及系统
CN103780907A (zh) * 2014-01-27 2014-05-07 浙江宇视科技有限公司 一种视频数据流量整形的方法和装置
CN105338422A (zh) * 2014-06-09 2016-02-17 杭州海康威视数字技术股份有限公司 视频图像数据的网络发送速率的平滑方法
CN110996125A (zh) * 2019-11-18 2020-04-10 腾讯科技(深圳)有限公司 一种视频流的生成方法、装置、电子设备及存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100442796C (zh) * 2004-09-09 2008-12-10 上海川海信息科技有限公司 一种流媒体传输系统中的速率控制方法
US8474001B2 (en) * 2009-02-10 2013-06-25 Cisco Technology, Inc. Near real time delivery of variable bit rate media streams
CN106657143A (zh) * 2017-01-20 2017-05-10 中兴通讯股份有限公司 一种流媒体传输方法、装置、服务器及终端
CN108668146B (zh) * 2017-03-27 2021-07-16 华为技术有限公司 一种调整流媒体码率的方法及设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7530089B1 (en) * 2004-03-29 2009-05-05 Nortel Networks Limited System and method for improving video quality using a constant bit rate data stream
CN103152497A (zh) * 2013-03-29 2013-06-12 贵阳朗玛信息技术股份有限公司 手机VoIP系统中动态比特率的实现方法、装置及系统
CN103780907A (zh) * 2014-01-27 2014-05-07 浙江宇视科技有限公司 一种视频数据流量整形的方法和装置
CN105338422A (zh) * 2014-06-09 2016-02-17 杭州海康威视数字技术股份有限公司 视频图像数据的网络发送速率的平滑方法
CN110996125A (zh) * 2019-11-18 2020-04-10 腾讯科技(深圳)有限公司 一种视频流的生成方法、装置、电子设备及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024179279A1 (zh) * 2023-03-01 2024-09-06 深圳Tcl新技术有限公司 多媒体数据传输方法、装置、介质及设备

Also Published As

Publication number Publication date
CN113573062A (zh) 2021-10-29
CN113573062B (zh) 2023-12-29

Similar Documents

Publication Publication Date Title
WO2021218479A1 (zh) 流量整形方法、装置与电子设备
EP2880548B1 (en) Methods for quality-aware adaptive streaming over hypertext transfer protocol
CN104394486B (zh) 一种基于云桌面的视频流处理方法及装置
US7783773B2 (en) Glitch-free media streaming
WO2020192152A1 (zh) 视频传输的方法、根节点、子节点、p2p服务器和系统
US8474001B2 (en) Near real time delivery of variable bit rate media streams
JP7496022B2 (ja) クライアント、サーバ、受信方法及び送信方法
WO2016049987A1 (zh) 一种数据处理方法、装置及相关服务器
US9420022B2 (en) Media requests to counter latency and minimize network bursts
CN110636339B (zh) 基于码率的调度方法、装置及电子设备
CN104956631A (zh) 链路感知流传输自适应
US9967303B2 (en) Throttling a media stream for transmission via a radio access network
WO2019128800A1 (zh) 一种内容服务的实现方法、装置及内容分发网络节点
US11146606B2 (en) Data buffering method, network device, and storage medium
US10165331B2 (en) Method and device operable to store video and audio data
WO2023051243A1 (zh) 视频码率切换方法、装置、电子设备及存储介质
US10609111B2 (en) Client-driven, ABR flow rate shaping
US10270832B1 (en) Method and system for modifying a media stream having a variable data rate
US11206295B1 (en) System and method for streaming content selection
KR102419087B1 (ko) 미디어 스트리밍 제어 장치 및 방법
WO2022199484A1 (zh) 一种媒体播放方法、装置和电子设备
US20160014181A1 (en) Content transfer method, content transfer apparatus and content receiving apparatus
US20240223832A1 (en) Video stream bitrate adjustment method and apparatus, computer device, and storage medium

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: 21797281

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: 21797281

Country of ref document: EP

Kind code of ref document: A1