The content of the invention
In order to solve the above-mentioned technical problem, the present invention provides a kind of method and device for judging network condition, and it can be used for
During user carries out Video chat, timely and accurately judge in the network condition and video room of client other into
The network condition of the client of member.
It is a primary object of the present invention to provide a kind of method for judging network condition, comprise the following steps:
Obtain the first up packet loss, descending packet loss and other up packet loss;The first up packet loss is this
Client uploaded videos flow to the packet loss of server end, and the descending packet loss is that the client is downloaded from the server end
The packet loss of the video flowing of other members in video room, other described up packet loss are the visitors of other members in video room
Family end uploaded videos flow to the packet loss of the server end;The video room is that the client user is entered by the client
The virtual video room entered;
According to the described first up packet loss, descending packet loss and other up packet loss got, the client is judged
The network condition of the client of other members in the network condition and video room at end.
In the method for judging network condition, it is preferred that the network condition and video room for judging the client
The network condition of the client of other interior members includes:
Setup parameter x, y, wherein 0 < x < y < 1;
By the described first up packet loss, descending packet loss, compared respectively with x, y, draw the first comparing result, and root
The network condition of the client is judged according to first comparing result;
It is described to judge that the network condition of the client includes according to first comparing result:
If the first up packet loss is more than y, judge the network condition of the client to be poor;
If the first up packet loss is less than or equal to y, and descending packet loss is more than y, then judges the net of the client
Network situation is poor;
If the first up packet loss is less than or equal to y, and descending packet loss is less than or equal to x, then judges the client
The network condition at end is preferably;
If the first up packet loss is less than or equal to y, and descending packet loss is more than x and is less than or equal to y, then judges
During the network condition of the client is.
Further, the network of the network condition for judging the client and the client of other members in video room
Situation also includes:
Other up packet loss are compared with x, y respectively, draw the second comparing result, and tie according to the described second contrast
Fruit judges the network condition of the client of other members in video room;
It is described to judge that the network condition of the client of other members in video room includes according to second comparing result:
If other up packet loss are more than y, other members corresponding with the up packet loss in video room are judged
The network condition of client is poor;
If other up packet loss are less than or equal to x, judge in video room it is corresponding with the up packet loss other
The network condition of the client of member is preferably;
If other up packet loss are more than x and are less than or equal to y, judge corresponding with the up packet loss in video room
The network condition of client of other members be.
In preferred embodiment, the method for judging network condition also includes:The display operation of customer in response end subscriber,
Show the network condition of the client of other members in the network condition and video room of the client.
Preferably, the first up packet loss of the acquisition, descending packet loss and other up packet loss, are to obtain each second
Take once.
The present invention's also provides a kind of device for judging network condition, and it includes:
Acquisition module, for obtaining the first up packet loss, descending packet loss and other up packet loss;On described first
Row packet loss is the packet loss that the client uploaded videos flow to server end, and the descending packet loss is the client from described
The packet loss of the video flowing of other members in server end foradownloaded video room, other described up packet loss are in video room
The client uploaded videos of other members flow to the packet loss of the server end;The video room is that the client user is led to
Cross the virtual video room of client entrance;
Judge module, for according to the described first up packet loss, descending packet loss and other the up packet losses got
Rate, judge the network condition of the client of other members in the network condition and video room of the client.
The device for judging network condition, it is preferred that the judge module includes:
Setup unit, for setup parameter x, y, wherein 0 < x < y < 1;
First comparison unit, for by the described first up packet loss, descending packet loss, comparing, drawing with x, y respectively
First comparing result, and judge according to first comparing result network condition of the client;
First comparison unit includes:
First judgment sub-unit, if being more than y for the described first up packet loss, judge the network condition of the client
For difference;
Second judgment sub-unit, if it is less than or equal to y for the described first up packet loss, and descending packet loss is more than y,
Then judge the network condition of the client to be poor;
3rd judgment sub-unit, if be less than or equal to y for the described first up packet loss, and descending packet loss be less than or
Equal to x, then the network condition of the client is judged preferably;
4th judgment sub-unit, if it is less than or equal to y for the described first up packet loss, and descending packet loss is more than x
And be less than or equal to y, then during the network condition for judging the client is.
It is preferred that the judge module also includes:
Second comparison unit, for other up packet loss to be compared with x, y respectively, the second comparing result is drawn, and
The network condition of the client of other members in video room is judged according to second comparing result;
Second comparison unit includes:
5th judgment sub-unit, if being more than y for other up packet loss, judge in video room with the up packet loss
The network condition of the client of other members is poor corresponding to rate;
6th judgment sub-unit, if being less than or equal to x for other up packet loss, judge in video room and on this
The network condition of the client of other members corresponding to row packet loss is preferably;
7th judgment sub-unit, if being more than x for other up packet loss and being less than or equal to y, judge video room
During the network condition of the client of interior other members corresponding with the up packet loss is.
The device for judging network condition, it is preferred that it also includes display module, for customer in response end subscriber
Display operation, show the network condition of the client of other members in the network condition and video room of the client.
It is described judge network condition device, wherein, it is described acquisition the first up packet loss, descending packet loss and other on
Row packet loss, it is to obtain once each second.
The method of the judgement network condition of the embodiment of the present invention, can be during user carries out Video chat, in time
The network condition of the client of other members in the network condition and video room of client is judged exactly, if network goes out
Existing Caton phenomenon, it is which side network there is a problem on earth that the people of Video chat, which can quickly and accurately know, and then
User can be facilitated to quickly cope with the phenomenon of network interim card, improve the experience effect of the Video chat of user.
Embodiment
Below in conjunction with the accompanying drawing in the present invention, technical scheme is clearly and completely described, it is clear that
Described embodiment is part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, sheet
The every other embodiment that field those of ordinary skill is obtained under the premise of creative work is not made, belongs to the present invention
The scope of protection.
Some features are simply discriminatively called by " first ", " second " in the embodiment of the present invention, this be in order to
It is convenient understanding setting, have no otherwise restriction.
The method of judgement network condition as shown in Figure 1, it comprises the following steps:
S101:Obtain the first up packet loss, descending packet loss and other up packet loss;The first up packet loss
It is the packet loss that the client uploaded videos flow to server end, the descending packet loss is the client from the server end
The packet loss of the video flowing of other members in foradownloaded video room, other described up packet loss are other members in video room
Client uploaded videos flow to the packet loss of the server end;The video room is that the client user passes through the client
Hold the virtual video room entered.
Can there are two members or more members in the video room, the quantity of other up packet loss can
Can be one or more to be corresponding with other numbers of members in video room.Other members in video room,
Refer to user member corresponding to other clients in addition to user member corresponding to the client.When video room have two into
For member when carrying out Video chat, other members in video room are one, and other described up packet loss are one;Work as video
There are three members in room when carrying out Video chat, and other members in video room are two, other described up packet loss
Can be one or two;When video room has more than three members carrying out Video chat, in video room other into
Member is two or more, and other described up packet loss can be one or two or more.
As shown in Fig. 2 the method for the first up packet loss statistics can include:
S1011:Server or client define the statistic period T 1 of a packet;It is that client often sends T1 number
According to bag, packet loss of server statistics;
S1012:Transmitted packet is numbered client, is then sent to server according to number order;
S1013:After server receives the packet of client transmission, the numbering of the packet is first judged;If server is received
Numbering to the first packet is n1, then writes down the numbering n1 of the packet;
S1014:When server judges that the numbering for receiving packet is more than or equal to n1+T1-1, carry out counting the cycle
The number of interior received packet, and calculate the first up packet loss in the cycle;
S1015:If server judges that receiving the numbering of packet is more than n1+T1-1, using the packet received as
The beginning of next measurement period;If the numbering that server judges to receive packet is equal to n1+T1-1, next by what is received
Beginning of the packet as next measurement period;Circulated with this, calculate the first up packet loss in each cycle.
Wherein, T1 can be the positive integers such as 10,30,55,80,100,200,500, and numbering can be numbered from 0, press
Natural number according to 0,1,2,3,4 order or it is numbered from other natural numbers.
Specifically, it is assumed that T1=10, be that client often sends 10 packets, packet loss of server statistics;It is false
If the numbering of the first packet be 10 (package number that client is sent is 10,11,12,13,14,15,16,17,18,19,
20th, 21 etc.), when server receives the packet, the numbering of the packet is write down;Judge to receive packet in server
Numbering be more than or equal to 19 when, counted the number of received packet, and calculate in the cycle first on
Row packet loss.If server judges that the numbering for receiving packet is more than 19, using the packet received as next statistics
The beginning in cycle;If server judges that the numbering for receiving packet is equal to 19, using the next packet received as next
The beginning of individual measurement period;Circulated with this, calculate the first up packet loss in each cycle.
Further, by taking the period 1 as an example, server writes down the numbering of packet when the first packet is received
10.If server receives 19 number bags, server starts to count received packet, it is assumed that the packet received
Numbering has 10,14,15,17,18,19, then the packet lost just has 11,12,13,16, then losing in this measurement period
Bag rate is 4/10;If after server receives 18 number bags, directly receiving 20 number bags, then server starts to count and received
Packet, it is assumed that the numbering of the packet received has 10,14,15,17,18, then the packet lost just has 11,12,13,
16th, 19, then the packet loss in this measurement period is 5/10.
Further, if after server receives 20 number bags, using the packet received as next statistics week
The beginning of phase, when server judges that the numbering for receiving packet is more than or equal to 29, counted received data
Bag, and calculate the packet loss in this cycle.If after server receives 18 number bags, what is directly received is 21 number bags,
Then beginning of the server using the 21 number bag received as next measurement period, server judge to receive the volume of packet
Number be more than or equal to 30 when, counted the number of received packet, and calculate the packet loss in this cycle.If clothes
Business device receives 30 number bags, then server starts to count received packet, it is assumed that the numbering of the packet received has
21st, 24,25,27,28,29,30, then the packet lost just has 22,23,26, then the packet loss in this measurement period is
3/10。
The method of the descending packet loss statistics can be similar with the method for the described first up packet loss statistics, specifically may be used
With including:
Step 1:Server or client define the statistic period T 2 of a packet;It is that server often sends T2 number
According to bag, client counts a packet loss;
Step 2:Transmitted packet is numbered server, is then sent to client according to number order;
Step 3:After client receives the packet of server transmission, the numbering of the packet is first judged;If client is received
Numbering to the first packet is n2, then writes down the numbering n2 of the packet;
Step 4:When client judges that the numbering for receiving packet is more than or equal to n2+T2-1, carry out counting the cycle
The number of interior received packet, and calculate the first up packet loss in the cycle;
Step 5:If client judges that receiving the numbering of packet is more than n2+T2-1, using the packet received as
The beginning of next measurement period;If the numbering that client judges to receive packet is equal to n2+T2-1, next by what is received
Beginning of the packet as next measurement period;Circulated with this, calculate the descending packet loss in each cycle;
Wherein, T2 can be the positive integers such as 10,30,55,80,100,200,500, and numbering can be numbered from 0, press
Natural number according to 0,1,2,3,4 order or it is numbered from other natural numbers.
Other described up packet loss are that the client uploaded videos of other members in video room flow to the server
The packet loss at end, it is to be counted in server reception video room during the client uploaded videos stream of other members,
Its statistical method can be identical with the method for the described first up packet loss statistics, and simply client object is different.
The first up packet loss of the acquisition, descending packet loss and other up packet loss can be specifically clients from
The first up packet loss and other up packet loss are obtained on server, descending packet loss is obtained from client inside.
S102:According to the described first up packet loss, descending packet loss and other up packet loss got, judging should
The network condition of the client of other members in the network condition and video room of client.
The network condition of other members in the network condition for judging the client and video room, can be by the client
In the network condition and video room at end the network condition of other members be respectively divided into, poor two grades, or be divided into,
In, poor Three Estate, or made a distinction according to other grades.
Specifically, can be with setup parameter m, 0 < m < 1;
If the first up packet loss is more than m, judge the network condition of the client to be poor;
If the first up packet loss is less than or equal to m, and descending packet loss is more than m, then judges the net of the client
Network situation is poor;
If the first up packet loss is less than or equal to m, and descending packet loss is less than or equal to m, then judges the client
The network condition at end is preferably.
If other up packet loss are more than m, other members visitor corresponding with the up packet loss in video room is judged
The network condition at family end is poor;
If other up packet loss are less than or equal to m, judge in video room it is corresponding with the up packet loss other
The network condition of member client is preferably.
The method of the judgement network condition of the embodiment of the present invention, can be during user carries out Video chat, in time
The network condition of the client of other members in the network condition and video room of client is judged exactly, if network goes out
Existing Caton phenomenon, it is which side network there is a problem on earth that the people of Video chat, which can quickly and accurately know, and then
User can be facilitated to quickly cope with the phenomenon of network interim card, improve the experience effect of the Video chat of user.
Generally, in order to judge more rapidly and more accurately other members in the network condition and video room of the client
Network condition, it is described to judge the client as shown in figure 3, wherein based on the method for the judgement network condition shown in Fig. 1
The network condition of the client of other members includes in network condition and video room:
S201:Setup parameter x, y, wherein 0 < x < y < 1;
S202:By the described first up packet loss, descending packet loss, compared respectively with x, y, draw the first contrast knot
Fruit, and judge according to first comparing result network condition of the client;
It is described to judge that the network condition of the client includes according to first comparing result:
If the first up packet loss is more than y, judge the network condition of the client to be poor;
If the first up packet loss is less than or equal to y, and descending packet loss is more than y, then judges the net of the client
Network situation is poor;
If the first up packet loss is less than or equal to y, and descending packet loss is less than or equal to x, then judges the client
The network condition at end is preferably;
If the first up packet loss is less than or equal to y, and descending packet loss is more than x and is less than or equal to y, then judges
During the network condition of the client is.
Further, as shown in figure 3, the visitor of the network condition and other members in video room for judging the client
The network condition at family end also includes:
S203:Other up packet loss are compared with x, y respectively, draw the second comparing result, and according to described second
Comparing result judges the network condition of the client of other members in video room;
It is described to judge that the network condition of the client of other members in video room includes according to second comparing result:
If other up packet loss are more than y, other members corresponding with the up packet loss in video room are judged
The network condition of client is poor.
If other up packet loss are less than or equal to x, judge in video room it is corresponding with the up packet loss other
The network condition of the client of member is preferably.
If other up packet loss are more than x and are less than or equal to y, judge corresponding with the up packet loss in video room
The network condition of client of other members be.
Based on the method for the judgement network condition shown in Fig. 1, it also includes:The display operation of customer in response end subscriber, shows
The network condition of the client of other members in the network condition and video room of the client is shown.
Judge in the network condition and video room of the client after the network condition of the client of other members, can be with
Directly display out the network condition of the client of other members in the network condition and video room of the client;Can also be in visitor
When family end subscriber finds that network compares interim card, client user carries out display operation, is grasped in response to the display of client user
Make, show the network condition of the client of other members in the network condition and video room of the client.The latter, Ke Yi
In the case of network condition is preferable, it will not influence the video between user due to frequently showing network condition and link up.
Method based on the judgement network condition shown in Fig. 1, it is preferred that the acquisition first up packet loss, descending
Packet loss and other up packet loss, it is to obtain once each second.Certainly, obtain the first up packet loss, descending packet loss and
The frequency of other up packet loss can also be acquisition per minute once, obtain once or other frequencies within every 0.5 second.It is and per second
Clock obtains once, you can to ensure to monitor the real-time of network quality, can be unlikely to up due to continually obtaining first again
Packet loss, descending packet loss and other up packet loss and influence network.
As one embodiment, the scene of tele-medicine is carried out by internet with reference to doctor and patient, introduces this
The method of the judgement network condition of invention.There was only a doctor and a patient in the video room of the embodiment of the present invention.
The method that doctor's client judges network condition, it comprises the following steps:
S301:Each second obtains a first up packet loss, descending packet loss and other up packet loss;Described first
Up packet loss is the packet loss that doctor's client uploaded videos flow to server end, and the descending packet loss is doctor visitor
The packet loss of family end video flowing of patient member out of described server end foradownloaded video room, other described up packet loss are
The client uploaded videos of patient member flow to the packet loss of the server end in video room;The video room is the doctor
The virtual video room that raw client user is entered by doctor's client;
S302:Setup parameter x, y, wherein x are 1%, y 5%;
S303:By the described first up packet loss, descending packet loss, compared respectively with x, y;
S304:If the first up packet loss is more than y, judge the network condition of doctor's client to be poor;If institute
State the first up packet loss and be less than or equal to y, and descending packet loss is more than y, then the network condition for judging doctor's client is
Difference;If the first up packet loss is less than or equal to y, and descending packet loss is less than or equal to x, then judges doctor's client
Network condition preferably;If the first up packet loss is less than or equal to y, and descending packet loss is more than x and is less than or equal to
Y, then during the network condition for judging doctor's client is;
S305:Other up packet loss are compared with x, y respectively;
S306:If other up packet loss are more than y, judge in video room it is corresponding with the up packet loss other into
The network condition of the client of member is poor;If other up packet loss are less than or equal to x, judge up with this in video room
The network condition of the client of other members corresponding to packet loss is preferably;If other up packet loss are more than x and are less than or equal to
Y, then during the network condition for judging the client of other members corresponding with the up packet loss in video room is;
S307:The display operation of clinician user is responded, is shown in the network condition and video room of doctor's client
The network condition at patient customer end.
The embodiment of the present invention, it can timely and accurately judge doctor client when doctor and patient carry out tele-medicine
The network condition of patient's client in the network condition and video room at end, if Caton phenomenon occurs in network, doctor can be more
Quickly and accurately know it is which side network there is a problem on earth, and then clinician user can be facilitated to quickly cope with net
The phenomenon of network interim card, improve the tele-medicine body effect of clinician user.
The embodiment of the present invention also provides a kind of device for judging network condition, as shown in figure 4, it includes:
Acquisition module, for obtaining the first up packet loss, descending packet loss and other up packet loss;On described first
Row packet loss is the packet loss that the client uploaded videos flow to server end, and the descending packet loss is the client from described
The packet loss of the video flowing of other members in server end foradownloaded video room, other described up packet loss are in video room
The client uploaded videos of other members flow to the packet loss of the server end;The video room is that the client user is led to
Cross the virtual video room of client entrance;
Judge module, for according to the described first up packet loss, descending packet loss and other the up packet losses got
Rate, judge the network condition of the client of other members in the network condition and video room of the client.
The device of the judgement network condition of the embodiment of the present invention, available for the side for realizing the judgement network condition shown in Fig. 1
Method, it during user carries out Video chat, can timely and accurately judge the network condition and video room of client
In other members client network condition, if there is Caton phenomenon in network, the people of Video chat can quickly, standard
Really know it is which side network there is a problem on earth, and then user can be facilitated to quickly cope with showing for network interim card
As improving the experience effect of the Video chat of user.
The device for judging network condition can also include statistics packet loss module, as shown in figure 5, can specifically wrap
Include:
First definition unit, the statistic period T 1 of a packet is defined for server or client;It is client
Often send T1 packet, packet loss of server statistics;
First numbered cell, transmitted packet is numbered for client, then sent according to number order
To server;
First recording unit, after the packet that client is sent is received for server, first judge the numbering of the packet;
If the numbering that server receives the first packet is n1, the numbering n1 of the packet is write down;
First computing unit, for when server judges that the numbering for receiving packet is more than or equal to n1+T1-1, carrying out
The number of the packet received in the cycle is counted, and calculates the first up packet loss in the cycle;
First computing unit, if being additionally operable to the numbering that server judges to receive packet is more than n1+T1-1, it will receive
Beginning of the packet arrived as next measurement period;If the numbering that server judges to receive packet is equal to n1+T1-1,
The then beginning using the next packet received as next measurement period;Circulated with this, calculate first in each cycle
Up packet loss.
The statistics packet loss module, as shown in figure 5, also including:
Second definition unit, is additionally operable to server or client defines the statistic period T 2 of a packet;It is service
Device often sends T2 packet, and client counts a packet loss;
Second numbered cell, it is additionally operable to server and transmitted packet is numbered, then sent out according to number order
Give client;
Second recording unit, after the packet that server is sent is received for client, first judge the numbering of the packet;
If the numbering that client receives the first packet is n2, the numbering n2 of the packet is write down;
Second computing unit, for when client judges that the numbering for receiving packet is more than or equal to n2+T2-1, carrying out
The number of the packet received in the cycle is counted, and calculates the first up packet loss in the cycle;
Second computing unit, if being additionally operable to the numbering that client judges to receive packet is more than n2+T2-1, it will receive
Beginning of the packet arrived as next measurement period;If the numbering that client judges to receive packet is equal to n2+T2-1,
The then beginning using the next packet received as next measurement period;Circulated, calculated descending in each cycle with this
Packet loss.
Generally, in order to judge more rapidly and more accurately other members in the network condition and video room of the client
Network condition, it is described judge network condition device in, as shown in fig. 6, the judge module includes:
Setup unit, for setup parameter x, y, wherein 0 < x < y < 1;
First comparison unit, for by the described first up packet loss, descending packet loss, comparing, drawing with x, y respectively
First comparing result, and judge according to first comparing result network condition of the client;
First comparison unit includes:
First judgment sub-unit, if being more than y for the described first up packet loss, judge the network condition of the client
For difference;
Second judgment sub-unit, if it is less than or equal to y for the described first up packet loss, and descending packet loss is more than y,
Then judge the network condition of the client to be poor;
3rd judgment sub-unit, if be less than or equal to y for the described first up packet loss, and descending packet loss be less than or
Equal to x, then the network condition of the client is judged preferably;
4th judgment sub-unit, if it is less than or equal to y for the described first up packet loss, and descending packet loss is more than x
And be less than or equal to y, then during the network condition for judging the client is.
Further, as shown in fig. 6, the judge module also includes:
Second comparison unit, for other up packet loss to be compared with x, y respectively, the second comparing result is drawn, and
The network condition of the client of other members in video room is judged according to second comparing result;
Second comparison unit includes:
5th judgment sub-unit, if being more than y for other up packet loss, judge in video room with the up packet loss
The network condition of the client of other members is poor corresponding to rate.
6th judgment sub-unit, if being less than or equal to x for other up packet loss, judge in video room and on this
The network condition of the client of other members corresponding to row packet loss is preferably.
7th judgment sub-unit, if being more than x for other up packet loss and being less than or equal to y, judge video room
During the network condition of the client of interior other members corresponding with the up packet loss is.
Further, as shown in fig. 6, the device for judging network condition also includes display module, for customer in response
The display operation of end subscriber, shows the network-like of the client of other members in the network condition and video room of the client
Condition.
It is described judge network condition device, wherein, it is described acquisition the first up packet loss, descending packet loss and other on
Row packet loss, it is to obtain once each second.
Through the above description of the embodiments, those skilled in the art can be understood that the present invention can be by
Software adds the mode of required general hardware platform to realize, naturally it is also possible to which by hardware, but the former is more in many cases
Good embodiment.Based on such understanding, what technical scheme substantially contributed to prior art in other words
Part can be embodied in the form of software product, and the computer software product is stored in a storage medium, if including
It is dry to instruct to cause terminal device (be mobile phone, personal computer, server, or network equipment etc.) to perform the present invention
Method described in each embodiment.
Described above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also should
Depending on protection scope of the present invention.
It will be appreciated by those skilled in the art that the module in device in embodiment can describe be divided according to embodiment
It is distributed in the device of embodiment, respective change can also be carried out and be disposed other than in one or more devices of the present embodiment.On
Stating the module of embodiment can be integrated in one, and can also be deployed separately;A module is can be merged into, can also further be torn open
It is divided into multiple submodule.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Disclosed above is only several specific embodiments of the present invention, and still, the present invention is not limited to this, any ability
What the technical staff in domain can think change should all fall into protection scope of the present invention.