method for adjusting dynamic code rate of mobile phone video call based on network condition

文档序号:1579904 发布日期:2020-01-31 浏览:6次 中文

阅读说明:本技术 一种基于网络状况调节手机视频通话动态码率的方法 (method for adjusting dynamic code rate of mobile phone video call based on network condition ) 是由 曾立强 邵永托 黄熙 陈涛 于 2019-10-30 设计创作,主要内容包括:本发明公开一种基于网络状况调节手机视频通话动态码率的方法,采用的是推流端和流媒体服务端通过发送特定指令和接收到指令之间所花费时间来检测网络的强落。本发明采用Socket向流媒体发送数据流,精准的检测推流端到服务端的网络状态,提供了动态码率的有效依据;为了达成动态码率,在好的网络下提高通话质量,在弱网络下实现无感知的降低码率,保证通话质量,不影响直播体验效果。本发明能够准确、即时的检测到网络强弱,来适当调整发送媒体数据的码率,实现弱网络和较好网络无感知切换通话质量。(The invention discloses methods for adjusting dynamic code rate of mobile phone video call based on network condition, which adopts the time spent between the sending of specific instruction and the receiving of the instruction by the stream pushing end and the streaming media server end to detect the strong drop of the network.)

1, method for adjusting dynamic code rate of mobile phone video call based on network condition, which is characterized in that it includes following steps:

step 1, the plug flow end sends a specific instruction A to the server end, and records the sending time T1;

step 2, when receiving the instruction A, the server side immediately returns an appointed instruction B to the stream pushing side;

step 3, the plug flow end receives the instruction B and simultaneously records the receiving time T2;

step 4, calculating the time T1 for sending the A instruction and the time T2 for receiving the B instruction by the plug flow end, and subtracting to obtain a time difference T3;

step 5, judging the current network environment state based on the time difference T3;

when the time difference T3 is greater than or equal to the network environment judgment threshold T, judging that the data is transmitted to the server side and is in a weak network environment slowly, and executing the step 6; when the time difference T3 is smaller than the network environment judgment threshold T, judging that the time required for sending the data to the server side is smaller as a good network environment, and executing the step 8;

step 6, adding 1 to the weak network environment frequency N, clearing the good network environment frequency m, and judging whether the value of N is greater than the code-adjusting threshold value N, if so, executing step 7, otherwise, executing step 1;

step 7, judging whether the current state is in a low code rate state; if yes, the code rate is not changed and the step 1 is executed; otherwise, reducing the current code rate and executing the step 1;

step 8, adding 1 to the good network environment times M, clearing the weak network environment times n, and judging whether the value of M is greater than a code modulation threshold value M; if yes, executing step 9; otherwise, executing step 1;

step 9, judging whether the current state is in a high code rate state; if yes, the code rate is not changed and the step 1 is executed; otherwise, increasing the current code rate and executing the step 1.

2. The method for adjusting mobile phone video call dynamic code rate based on network conditions, as claimed in claim 1, wherein the stream pushing end sends the specified instruction A using socket in step 1.

3. The method of kinds of adjusting dynamic bitrate for mobile phone video call based on network status as claimed in claim 1, wherein in step 3, when the stream pushing end does not receive the instruction B within 2 seconds after the time T1 of transmission, it directly determines the network environment is weak and executes step 6.

4. The method of video call dynamic bitrate based on network conditions as claimed in claim 1, wherein the network environment determination threshold t of step 5 is 100 ms.

5. The method for kinds of adjusting dynamic bit rates of mobile phone video calls based on network conditions as claimed in claim 1, wherein the value of the th bit rate threshold N in step 6 is 5.

6. The method of kinds of adjusting dynamic bit rate of mobile phone video calls based on network conditions as claimed in claim 1, wherein the value of the second bit rate threshold M in step 8 is 3.

7. The method for adjusting dynamic bitrate for mobile phone video call based on network condition as claimed in claim 1, wherein is further included to divide each video frame into 1400-byte packets for transmission when in high bitrate state.

Technical Field

The invention relates to a video call technology, in particular to methods for adjusting dynamic code rate of a mobile phone video call based on network conditions.

Background

In the last two years, the live broadcast industry is more and more hot, each live broadcast platform adds and has almost three hundred more families, some live broadcast platforms do show, live broadcast and outdoor live broadcast of comprehensive entertainment, for example live broadcast, some live broadcast of playing, for example live broadcast of fighting fish and tiger teeth, some live broadcast of sports events, for example live broadcast of watching music, and the classification is also various.

The most direct method for changing the code rate is to adopt a cascade code rate changing transcoder which recodes the decoded video stream according to the target code rate so as to obtain the best image quality, but the complete decoding and encoding process has extremely high computational complexity, and the other methods adopt an open-loop code rate changing transcoder which re-quantizes the coefficients by decoding to a DCT domain, and the method has simple form and small operation amount, but the decoded image quality damage is accumulated in an image group due to the loss of high-frequency information so as to aggravate the drift phenomenon.

Briefly: under a good network environment, the audio and video data can be timely sent, the audio and video data cannot be accumulated locally, the live broadcast effect is smooth, and the time delay is low. Under the environment of a weak network, audio and video data are slowly sent and are accumulated in a large amount in the local area, so that the phenomena of black screen, blockage, time delay and the like occur in live broadcasting, and the user experience is poor.

Disclosure of Invention

The invention aims to provide methods for adjusting the dynamic code rate of a mobile phone video call based on network conditions.

The technical scheme adopted by the invention is as follows:

A method for adjusting dynamic code rate of mobile phone video call based on network condition, comprising the following steps:

step 1, the plug flow end sends a specific instruction A to the server end, and records the sending time T1;

step 2, when receiving the instruction A, the server side immediately returns an appointed instruction B to the stream pushing side;

step 3, the plug flow end receives the instruction B and simultaneously records the receiving time T2;

step 4, calculating the time T1 for sending the A instruction and the time T2 for receiving the B instruction by the plug flow end, and subtracting to obtain a time difference T3;

step 5, judging the current network environment state based on the time difference T3;

when the time difference T3 is greater than or equal to the network environment judgment threshold T, judging that the data is transmitted to the server side and is in a weak network environment slowly, and executing the step 6; when the time difference T3 is smaller than the network environment judgment threshold T, judging that the time required for sending the data to the server side is smaller as a good network environment, and executing the step 8;

step 6, adding 1 to the weak network environment frequency N, clearing the good network environment frequency m, and judging whether the value of N is greater than the code-adjusting threshold value N, if so, executing step 7, otherwise, executing step 1;

step 7, judging whether the current state is in a low code rate state; if yes, the code rate is not changed and the step 1 is executed; otherwise, reducing the current code rate and executing the step 1;

step 8, adding 1 to the good network environment times M, clearing the weak network environment times n, and judging whether the value of M is greater than a code modulation threshold value M; if yes, executing step 9; otherwise, executing step 1;

step 9, judging whether the current state is in a high code rate state; if yes, the code rate is not changed and the step 1 is executed; otherwise, increasing the current code rate and executing the step 1.

And , in step 1, the plug end sends a specified instruction A by using a socket.

, when the stream pushing end does not receive the command B within 2 seconds after the time T1 sent in step 3, it is directly determined as a weak network environment and step 6 is executed.

Step , the network environment decision threshold t is 100 ms in step 5.

, the value of the code modulation threshold N in step 6 is 5.

Further , the value of the second code modulation threshold M in step 8 is 3.

, when it is in high code rate state, it divides each video frame into 1400 bytes small packets to be transmitted.

By adopting the technical scheme, the data stream is sent to the streaming media by adopting Socket, the network state from the push stream end to the service end is accurately detected, and the effective basis of dynamic code rate is provided; in order to achieve dynamic code rate, the communication quality is improved under a good network, the code rate is reduced without perception under a weak network, the communication quality is ensured, and the live broadcast experience effect is not influenced. The method is suitable for the Android terminal to properly adjust the code rate of the transmitted media data by detecting the strength of the network channel signal in the video call.

Drawings

The invention is described in further detail with reference to the figures and the detailed description;

fig. 1 is an interaction diagram of methods for adjusting dynamic bit rate of a mobile phone video call based on network conditions.

Detailed Description

As shown in fig. 1, in order to solve the problems of food call delay, blockage, black screen and the like caused by a weak network environment, the invention discloses methods for adjusting the dynamic code rate of a mobile phone video call based on network conditions, which comprise the following steps:

step 1, the plug flow end sends a specific instruction A to the server end, and records the sending time T1; specifically, the plug flow end sends a specified instruction A by using a socket;

step 2, when receiving the instruction A, the server side immediately returns an appointed instruction B to the stream pushing side;

step 3, the stream pushing end receives the instruction B and records the receiving time T2, step , when the stream pushing end does not receive the instruction B within 2 seconds after the sending time T1, the stream pushing end directly judges the network environment as weak and executes step 6;

step 4, calculating the time T1 for sending the A instruction and the time T2 for receiving the B instruction by the plug flow end, and subtracting to obtain a time difference T3;

step 5, judging the current network environment state based on the time difference T3;

when the time difference T3 is greater than or equal to the network environment judgment threshold T, judging that the data is transmitted to the server side and is in a weak network environment slowly, and executing the step 6; when the time difference T3 is smaller than the network environment judgment threshold T, judging that the time required for sending the data to the server side is smaller as a good network environment, and executing the step 8;

specifically, the network environment determination threshold t is 100 milliseconds;

step 6, adding 1 to the weak network environment frequency N and clearing the good network environment frequency m, and judging whether the value of N is greater than the th code adjusting threshold value N or not in order to avoid frequent code rate switching caused by network fluctuation, if so, executing step 7, otherwise, executing step 1, and specifically, the value of the th code adjusting threshold value N is 5;

step 7, judging whether the current state is in a low code rate state; if yes, the code rate is not changed and the step 1 is executed; otherwise, reducing the current code rate and executing the step 1;

step 8, adding 1 to the good network environment times M and resetting the weak network environment times n, and judging whether the value of M is greater than a code modulation threshold value M or not in order to avoid frequent code rate switching caused by network fluctuation; if yes, executing step 9; otherwise, executing step 1; specifically, the value of the second code modulation threshold M is 3;

step 9, judging whether the current state is in a high code rate state; if yes, the code rate is not changed and the step 1 is executed; otherwise, increasing the current code rate and executing the step 1.

, when it is in high code rate state, it divides each video frame into 1400 bytes small packets to be transmitted.

The invention utilizes socket to send an appointed command A to a service end at a stream pushing end, the service end receives the command A and returns an appointed command B to the stream pushing end, the stream pushing end receives the command B, and the time difference obtained by subtracting the sent command A from the time of receiving the command B can be calculated to effectively detect the network state (PS: if the command B is not received within 2 seconds, the current network can be judged to be weaker), and the video coding rate is dynamically switched to ensure the smoothness of live broadcast, thereby improving the video coding rate under the better condition of the network, leading each video frame to be more clear and clear, simultaneously increasing the size of each video frame, dividing each video frame into 1400-byte packets to be sent during coding, reducing the video coding rate under the weak condition of the network, leading each frame video frame to be clear, simultaneously reducing the size of each video frame and being beneficial to better frame-assembling imaging of the service end.

By adopting the technical scheme, the method is different from the Android mobile phone network detection method in the market, the network judgment is carried out by transmitting byte numbers and receiving byte numbers by the mobile phone end in many ways in the market, and the method adopts the time spent between the transmission of a specific instruction and the reception of the instruction by the stream pushing end and the stream media server end to detect the network brute force. The invention adopts Socket to send data stream to the streaming media, accurately detects the network state from the push stream end to the service end, and provides effective basis of dynamic code rate; in order to achieve dynamic code rate, the communication quality is improved under a good network, the code rate is reduced without perception under a weak network, the communication quality is ensured, and the live broadcast experience effect is not influenced. The invention can accurately and immediately detect the network strength and realize the non-perception switching conversation quality of the weak network and the better network. The method is suitable for the Android terminal to properly adjust the code rate of the transmitted media data by detecting the strength of the network channel signal in the video call.

6页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种远程信息处理方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类