Data packet sending method and device, electronic equipment and computer storage medium

In the Bluetooth A2DP working scenario, the contraction rate of the Source side is adjusted according to the power information of the Sink side, which solves the problem of high power consumption on the Sink side, and achieves more effective power management and extended battery life.

CN120129034APending Publication Date: 2025-06-10GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510297309.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

In the Bluetooth A2DP working scenario, the contraction rate of the Source side fails to effectively consider the power condition of the Sink side, resulting in an increase in power consumption of the Sink side, especially in weak interference scenarios.

Method used

After the first electronic device is connected to the second electronic device, the packet rate of the first electronic device and the power quantity information of the second electronic device are obtained, and the packet rate of the first electronic device is adjusted based on the power quantity information of the second electronic device, and the adjusted packet is obtained, and then a data packet is sent to the second electronic device according to the adjusted packet rate.

Benefits of technology

By adjusting the packetization rate of the Source side, the power consumption of the Sink side can be effectively reduced and its battery life can be extended. Especially when the power of the Sink side is low, the packetization rate can be reduced to save power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120129034A_ABST
    Figure CN120129034A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data packet sending method, which is applied to first electronic equipment, and comprises the following steps: under the condition that the first electronic equipment is connected with second electronic equipment, obtaining a packet sending rate of the first electronic equipment and electric quantity information of the second electronic equipment, and sending a data packet to the second electronic equipment according to the electric quantity information of the second electronic equipment; and adjusting the packet sending rate of the first electronic equipment to obtain the adjusted packet sending rate, and sending the data packet to the second electronic equipment according to the adjusted packet sending rate. The embodiment of the invention also provides a data packet sending device, electronic equipment and a computer storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technology of sending data packets, and in particular, to a method, device, electronic device, and computer storage medium for sending data packets. Background Art

[0002] Currently, the typical working scenario of Bluetooth is the Advanced Audio Distribution Profile (A2DP) service. In the A2DP working scenario, the two Bluetooth devices are respectively the source device (Source) side and the receiving device (Sink) side.

[0003] Among them, the Source side is generally a mobile phone, and the Sink side is generally a car Bluetooth, Bluetooth speaker, Bluetooth headset, etc. After the Source side and the Sink side negotiate the encoding parameters, the Source side encodes and sends the audio data according to the negotiated parameters. After receiving the data packet, the Sink side decodes and plays it.

[0004] However, the packet sending rate of the Source side is restricted by its own algorithm. Then, for the Sink side, it may not be suitable, thus affecting the power consumption of the Sink side. Summary of the Invention

[0005] Embodiments of the present application provide a method, device, electronic device, and computer storage medium for sending data packets, which can adjust the power consumption of the second electronic device.

[0006] The technical solution of the present application is implemented as follows:

[0007] In a first aspect, an embodiment of the present application provides a method for sending data packets, which is applied to a first electronic device and includes:

[0008] When a connection is established between the first electronic device and the second electronic device, obtain the packet sending rate of the first electronic device and the power information of the second electronic device;

[0009] Adjust the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain an adjusted packet sending rate;

[0010] Send data packets to the second electronic device according to the adjusted packet sending rate.

[0011] In a second aspect, an embodiment of the present application provides a device for sending data packets, which is set in the first electronic device and includes:

[0012] An obtaining module, configured to obtain the packet sending rate of the first electronic device and the power information of the second electronic device when the first electronic device establishes a connection with the second electronic device;

[0013] An adjustment module, configured to adjust the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain an adjusted packet sending rate;

[0014] A sending module, configured to send data packets to the second electronic device according to the adjusted packet sending rate.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a storage medium storing executable instructions of the processor; the storage medium depends on the processor to execute operations through a communication bus, and when the instructions are executed by the processor, execute the data packet sending method described in one or more of the above embodiments.

[0016] In a fourth aspect, an embodiment of the present application provides a computer storage medium storing executable instructions, and when the executable instructions are executed by one or more processors, the processor executes the data packet sending method described in one or more of the above embodiments.

[0017] An embodiment of the present application provides a data packet sending method, apparatus, electronic device, and computer storage medium, including: when a first electronic device establishes a connection with a second electronic device, obtaining the packet sending rate of the first electronic device and the power information of the second electronic device, adjusting the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain an adjusted packet sending rate, and sending data packets to the second electronic device according to the adjusted packet sending rate; that is to say, in the embodiment of the present application, after the first electronic device establishes a connection with the second electronic device, the first electronic device obtains its own packet sending rate and obtains the power information of the second electronic device, so that the first electronic device can adjust the packet sending rate of the first electronic device according to its own power information. Then, the first electronic device sends data packets using the adjusted packet sending rate, making the packet sending rate of the first electronic device related to the power of the second electronic device, which helps to adjust the power consumption of the second electronic device. Description of the Drawings

[0018] Figure 1 It is a flowchart of the working process of the Source end and the Sink end in the related art;

[0019] Figure 2 It is a schematic flowchart of an optional data packet sending method provided by an embodiment of the present application;

[0020] Figure 3Schematic flowchart of an example of an optional method for sending data packets provided by an embodiment of this application;

[0021] Figure 4 Schematic structural diagram of an optional data packet sending device provided by an embodiment of this application;

[0022] Figure 5 Schematic structural diagram of an optional electronic device provided by an embodiment of this application. Detailed implementation manners

[0023] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application.

[0024] Figure 1 It is a working flowchart of the Source end and the Sink end in the related art. As Figure 1 shown, the Source end sends data packets (Packets) in each cycle. After receiving the data packets, the Sink end sends an acknowledgment character (Ack) to the Source end.

[0025] Among them, in the encoding mode negotiated by the Source end and the Sink end, the code rate adaptation mode is a typical working mode. In this mode, the Source end will use the code rate adaptation technology to adjust the code rate as needed according to the number of data packets in the buffer of the Source end, so as to achieve the smoothness of Bluetooth playback in an interference environment.

[0026] After the Source end adjusts the encoding code rate, different code rates correspond to different numbers of packets sent. The higher the code rate, the more packets are sent per unit time. For example, for Low-Latency Hi-Definition Audio Codec (LHDC) 5.0 encoding, when the code rate is low, 1 Packet is generated every 20 ms; when the code rate is medium, 2 Packets are generated every 20 ms; when the code rate is high, 4 Packets are generated every 20 ms; the Sink end needs to decode each Packet and then play it.

[0027] It can be seen that the code rate adaptation algorithm generally only considers the packet sending situation of the Source end to adjust the code rate. When performing Bluetooth A2DP in environments such as home and sports, the wireless interference in the environment is small, and the Source end will encode and transmit at a high code rate for a long time.

[0028] As the receiver, the Sink end needs to decode each received Packet. When the code rate is high, the number of Packets that the Sink end needs to decode is large, and the decoding of each Packet consumes a large amount of system resources at the Sink end, resulting in an increase in power consumption at the Sink end. When the Sink end is a Bluetooth headset, the Bluetooth headset is generally small in size. For miniaturization, its battery capacity configuration is generally small, and the continuous working time is relatively short. Especially for true wireless stereo (TWS) headsets, their volume is further reduced and the battery life is also relatively poor. Taking the LHDC 5.0 code rate adaptation technology of TWS headsets as an example, compared with the ordinary code rate scenario, the overall power consumption of the headset increases by more than 30% in the high code rate scenario.

[0029] Therefore, when the Sink end is a Bluetooth headset, the source end code rate adaptation algorithm only adjusts the code rate according to its own packet sending situation, without considering whether the Sink end can work for a long time at this code rate. Especially in a weak interference scenario, the source end encodes at a high code rate and sends more Packets, which will lead to an increase in the power consumption of the Bluetooth headset and a decrease in the continuous working time, especially for TWS headsets.

[0030] In view of the technical problem that the packet sending rate of the existing source end affects the power consumption of the sink end, the embodiment of the present application provides a method for sending data packets, which is applied to a first electronic device. Figure 2 As shown in Figure 2 the following figure, the method for sending data packets may include:

[0031] S201: When the first electronic device and the second electronic device are connected, obtain the packet sending rate of the first electronic device and the power information of the second electronic device;

[0032] The method for data packets provided by the embodiment of the present application can be applied to the situation where the first electronic device and the second electronic device are connected. Here, the connection can be a Bluetooth connection, a wireless fidelity (Wi-Fi) connection, or other connections. Here, the embodiment of the present application does not make specific limitations.

[0033] Taking the Bluetooth connection as an example, the above-mentioned first electronic device is equivalent to the Source end in the A2DP service, and the above-mentioned second electronic device is equivalent to the Sink end in the A2DP. In the above S201, when the first electronic device and the second electronic device are connected, the first electronic device obtains the packet sending rate of the first electronic device, and the first electronic device obtains the power information of the second electronic device.

[0034] Among them, the first electronic device can directly obtain the packet sending rate at which the first electronic device sends data to the second electronic device, or the first electronic device can obtain the coding rate of the first electronic device, and then determine the packet sending rate of the first electronic device based on the coding rate. Here, the embodiments of the present application do not make specific limitations in this regard.

[0035] Moreover, the first electronic device can obtain the power information of the second electronic device by using the connection with the second electronic device. Here, there are various ways to obtain the power information of the second electronic device. For example, the power information of the second electronic device can be obtained by using a standard protocol, or the power information of the second electronic device can be obtained by using a private protocol. Here, the embodiments of the present application do not make specific limitations in this regard.

[0036] S202: Adjust the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain the adjusted packet sending rate;

[0037] Through the above S201, the first electronic device obtains its own packet sending rate and the power information of the second electronic device. In S202, the packet sending rate of the first electronic device can be adjusted according to the power information of the second electronic device.

[0038] Here, different adjustment methods can be adopted for different power information to adjust the packet sending rate of the first electronic device, or the packet sending rate of the first electronic device can be adjusted according to the interval in which the power information falls. The embodiments of the present application do not make specific limitations in this regard.

[0039] It should be noted that the adjustment of the packet sending rate of the first electronic device is positively correlated with the power information of the second electronic device. That is to say, the smaller the power information of the second electronic device, the smaller the adjusted packet sending rate, and the larger the power information of the second electronic device, the larger the adjusted packet sending rate.

[0040] It can be seen that the above adjustment can be to reduce the packet sending rate of the first electronic device or to increase the packet sending rate of the first electronic device. Here, the embodiments of the present application do not make specific limitations in this regard.

[0041] S203: Send data packets to the second electronic device according to the adjusted packet sending rate.

[0042] After obtaining the adjusted packet sending rate through the above S202, in S203, the first electronic device sends data packets to the second electronic device according to the adjusted packet sending rate.

[0043] Here, since the adjusted packet sending rate may be smaller or larger than before. For example, when the power of the second electronic device is low, the adjusted packet sending rate becomes smaller. Then, when the power information of the second electronic device is low, using a smaller packet sending rate to send data packets helps to save the power consumption of the second electronic device. When the power of the second electronic device is high, the adjusted packet sending rate becomes larger. Then, when the power information of the second electronic device is high, using a larger packet sending rate to send data packets helps to increase the data transmission volume between the first electronic device and the second electronic device.

[0044] In order to adjust the packet sending rate of the first electronic device, in an optional embodiment, S202 may include:

[0045] When the power information of the second electronic device is lower than a first preset threshold, reduce the packet sending rate of the first electronic device to obtain the adjusted packet sending rate.

[0046] It can be understood that by comparing the power information of the second electronic device with the first preset threshold, if the power information of the second electronic device is lower than the first preset threshold after comparison, it means that the power information of the second electronic device is low at this time. If the first electronic device still uses a large packet sending rate to send data packets at this time, it will continuously consume the power of the second electronic device, causing the power of the second electronic device to be exhausted.

[0047] In order to prevent the power of the second electronic device from being quickly exhausted, in the embodiment of the present application, when the power information of the second electronic device is lower than the first preset threshold, reduce the packet sending rate of the first electronic device, so as to obtain the adjusted packet sending rate.

[0048] Here, it should be noted that when reducing the packet sending rate of the first electronic device, the packet sending rate of the first electronic device can be reduced according to a fixed step size, or the packet sending rate of the first electronic device can be reduced to a fixed value. Here, the embodiment of the present application does not make a specific limitation on this.

[0049] In this way, by comparing with the first preset threshold and adjusting the packet sending rate of the first electronic device based on the comparison result, the power consumption of the second electronic device when using the adjusted packet sending rate is reduced.

[0050] Further, in order to adjust the packet sending rate of the first electronic device, in an optional embodiment, when the power information of the second electronic device is lower than the first preset threshold, reducing the packet sending rate of the first electronic device to obtain the adjusted packet sending rate may include:

[0051] When the power information of the second electronic device is lower than the first preset threshold and higher than the second preset threshold, reduce the packet sending rate of the first electronic device to the first preset packet sending rate to obtain the adjusted packet sending rate.

[0052] Understandably, here, not only the power information of the second electronic device is compared with the first preset threshold, but also the power information of the second electronic device is compared with the second preset threshold. When the power information of the second electronic device is lower than the first preset threshold and higher than the second preset threshold, the packet sending rate of the first electronic device is reduced to the first preset packet sending rate, so that an adjusted packet sending rate can be obtained.

[0053] Here, it should be noted that in reducing the packet sending rate of the first electronic device to the first preset packet sending rate, it can be in the way of step size or by direct setting. Here, the embodiments of the present application do not make specific limitations on this.

[0054] Among them, the above first preset threshold is greater than the second preset threshold. That is to say, by presetting the first preset threshold and the second preset threshold, an interval is set for the power information of the second electronic device. When it falls within the interval between the second preset threshold and the first preset threshold, the packet sending rate of the first electronic device is reduced to the first preset packet sending rate.

[0055] In this way, the number of data packets received by the second electronic device with a power within the interval between the second preset threshold and the first preset threshold per unit time is reduced, thereby reducing the power consumption of the second electronic device.

[0056] In addition, in order to adjust the packet sending rate of the first electronic device, in an alternative embodiment, when the power information of the second electronic device is lower than the first preset threshold, reducing the packet sending rate of the first electronic device to obtain an adjusted packet sending rate may include:

[0057] When the power information of the second electronic device is lower than the second preset threshold, reducing the packet sending rate of the first electronic device to the second preset packet sending rate to obtain an adjusted packet sending rate.

[0058] Understandably, the power information of the second electronic device is compared with the second preset threshold. After comparison, if the power information of the second electronic device is lower than the second preset threshold, it means that the power information of the second electronic device is approaching exhaustion at this time. If the first electronic device still uses a relatively large or medium packet sending rate to send data packets at this time, it will continuously consume the almost exhausted power of the second electronic device, resulting in the complete exhaustion of the power of the second electronic device.

[0059] Here, when the power information of the second electronic device is lower than the second preset threshold, reducing the packet sending rate of the first electronic device to the second preset packet sending rate, in reducing the packet sending rate of the first electronic device to the second preset packet sending rate, it can be in the way of step size or by direct setting. Here, the embodiments of the present application do not make specific limitations on this.

[0060] Among them, the first preset packet sending rate is greater than the second preset packet sending rate. That is to say, the packet sending rate to which the first electronic device reduces for the power in the interval between the second preset threshold and the first preset threshold is greater than the packet sending rate to which the first electronic device reduces for the power in the interval from 0 to the second preset threshold. That is, the lower the power, the smaller the reduced packet sending rate.

[0061] In this way. By reducing the packet sending rate of the first electronic device in the above segmented interval manner, the packet sending rate of the first electronic device can be adjusted to an appropriate value, which helps the second electronic device to receive different numbers of data packets at different powers and adjust the power consumption to different extents.

[0062] In order to obtain the packet sending rate of the first electronic device and the power information of the second electronic device, in an optional embodiment, S201 may include:

[0063] When the first electronic device establishes a connection with the second electronic device and the second electronic device is a device of a preset type, obtain the packet sending rate of the first electronic device and the power information of the second electronic device.

[0064] It can be understood that in addition to obtaining the packet sending rate of the first electronic device and the power information of the second electronic device when the first electronic device establishes a connection with the second electronic device, it is also necessary to further determine whether the second electronic device is a device of a preset type, where the device of the preset type is a device with a battery capacity less than a preset capacity.

[0065] That is to say, only when the second electronic device is a device with a battery capacity less than a preset capacity and the first electronic device establishes a connection with the second electronic device, the first electronic device obtains the packet sending rate of the first electronic device, and moreover, the first electronic device obtains the power information of the second electronic device.

[0066] In this way, the above data packet sending method is only executed for devices with a battery capacity less than a preset capacity. Here, it is mainly considered that the devices with a lower battery capacity have limited power storage capacity, and adjusting the packet sending rate according to their power can adjust the power consumption of the devices with a lower battery capacity.

[0067] For the first electronic device, in an optional embodiment, when the first electronic device sends data packets to the second electronic device using the code rate adaptation mode, the packet sending rate of the first electronic device is: the packet sending rate corresponding to the code rate when the first electronic device uses the code rate adaptation mode.

[0068] Understandably, after the first electronic device and the second electronic device establish a connection, the first electronic device can use the rate adaptation mode to send data packets to the second electronic device. At this time, the packet sending rate of the first electronic device can be determined according to the code rate of the first electronic device. Among them, the packet sending rate corresponding to the code rate when the first electronic device uses the rate adaptation mode is used as the packet sending rate of the first electronic device.

[0069] For the rate adaptation mode, different packet sending rates correspond to different code rates. Therefore, here, as long as the first electronic device knows its own code rate, it can determine the packet sending rate of the first electronic device.

[0070] Of course, here, when the first electronic device uses the rate adaptation mode, when adjusting the packet sending rate of the first electronic device according to the power information of the first electronic device, the packet sending rate of the first electronic device can be adjusted to the packet sending rates corresponding to different code rates.

[0071] In the rate adaptation mode, the packet sending rate of the first electronic device can be adjusted by restricting the code rate. Similarly, the larger the code rate, the larger the packet sending rate.

[0072] In this way, by obtaining the packet sending rate of the first electronic device through the above rate adaptation mode, the data packet sending method of the embodiment of the present application can be applied to the rate adaptation mode, and the packet sending rate of the first electronic device is adjusted by restricting the code rate, so as to realize the adjustment of the power consumption of the second electronic device.

[0073] In addition to adjusting the packet sending rate of the first electronic device according to the packet sending rate of the second electronic device, in an alternative embodiment, the above method may further include:

[0074] Obtain the power information of the first electronic device;

[0075] Adjust the packet sending rate of the first electronic device according to the power information of the first electronic device; obtain the adjusted packet sending rate.

[0076] Understandably, when adjusting the packet sending rate of the first electronic device, the power information of the first electronic device can also be obtained, and the packet sending rate of the first electronic device is adjusted according to the power information of the first electronic device, so as to obtain the adjusted packet sending rate, and then the first electronic device uses the adjusted packet sending rate to send data packets to the second electronic device.

[0077] In an embodiment of the present application, the first electronic device may also adjust the packet sending rate of the first electronic device according to the power information of the first electronic device and the power information of the second electronic device. For example, adjustment weights are set for each adjustment method to achieve the adjustment, and the packet sending rate of the first electronic device may also be adjusted by resetting the interval. Here, the embodiments of the present application do not make specific limitations in this regard.

[0078] In this way, through the above method, the first electronic device can adjust its own packet sending rate according to its own power information, so that the packet sending rate of the first electronic device is related not only to the power information of the second electronic device but also to the power information of the first electronic device, which helps to adjust the power consumption of the first electronic device by adjusting the packet sending rate of the first electronic device.

[0079] Further, in order to adjust the packet sending rate of the first electronic device, in an optional embodiment, the packet sending rate of the first electronic device is adjusted according to the power information of the first electronic device; obtaining the adjusted packet sending rate may include:

[0080] When the power information of the second electronic device is lower than a third preset threshold, the packet sending rate of the first electronic device is decreased to obtain the adjusted packet sending rate.

[0081] It can be understood that the power information of the second electronic device is compared with the third preset threshold. After comparison, if the power information of the second electronic device is lower than the third preset threshold, it means that the power information of the second electronic device is relatively low at this time. If the first electronic device still uses a relatively large packet sending rate to send data packets at this time, it will continuously consume the power of the second electronic device, resulting in the exhaustion of the power of the second electronic device.

[0082] In order to prevent the rapid exhaustion of the power of the second electronic device, in the embodiments of the present application, when the power information of the second electronic device is lower than the third preset threshold, the packet sending rate of the first electronic device is decreased, so as to obtain the adjusted packet sending rate.

[0083] Here, it should be noted that when decreasing the packet sending rate of the first electronic device, the packet sending rate of the first electronic device may be decreased at a fixed step, or the packet sending rate of the first electronic device may be decreased to a fixed value. Here, the embodiments of the present application do not make specific limitations in this regard.

[0084] In this way, by comparing with the third preset threshold and adjusting the packet sending rate of the first electronic device based on the comparison result, the power consumption of the second electronic device is reduced when using the adjusted packet sending rate.

[0085] Furthermore, to adjust the packet sending rate of the first electronic device, in an optional embodiment, when the power information of the second electronic device is lower than a third preset threshold, reducing the packet sending rate of the first electronic device to obtain an adjusted packet sending rate may include:

[0086] When the power information of the second electronic device is lower than the third preset threshold and higher than the fourth preset threshold, reducing the packet sending rate of the first electronic device to a third preset packet sending rate to obtain an adjusted packet sending rate.

[0087] It can be understood that here, not only is the power information of the second electronic device compared with the third preset threshold, but also the power information of the second electronic device is compared with the fourth preset threshold. When the power information of the second electronic device is lower than the third preset threshold and higher than the fourth preset threshold, the packet sending rate of the first electronic device is reduced to the third preset packet sending rate, so that an adjusted packet sending rate can be obtained.

[0088] Here, it should be noted that in reducing the packet sending rate of the first electronic device to the third preset packet sending rate, it can be in the way of step size or by direct setting. Here, the embodiments of the present application do not make specific limitations on this.

[0089] Among them, the above first preset threshold is greater than the third preset threshold. That is to say, by presetting the third preset threshold and the fourth preset threshold, an interval is set for the power information of the second electronic device. When it falls into the interval between the fourth preset threshold and the third preset threshold, the packet sending rate of the first electronic device is reduced to the first preset packet sending rate.

[0090] In this way, the number of data packets received by the second electronic device with the power falling into the interval between the fourth preset threshold and the third preset threshold per unit time is reduced, thereby reducing the power consumption of the second electronic device.

[0091] In addition, to adjust the packet sending rate of the first electronic device, in an optional embodiment, when the power information of the second electronic device is lower than the fourth preset threshold, reducing the packet sending rate of the first electronic device to obtain an adjusted packet sending rate may include:

[0092] When the power information of the second electronic device is lower than the fourth preset threshold, reducing the packet sending rate of the first electronic device to a fourth preset packet sending rate to obtain an adjusted packet sending rate.

[0093] Understandably, the power information of the second electronic device is compared with a fourth preset threshold. After comparison, if the power information of the second electronic device is lower than the fourth preset threshold, it indicates that the power information of the second electronic device is approaching exhaustion at this time. If the first electronic device still uses a relatively large or medium packet sending rate to send data packets at this time, it will continuously consume the nearly exhausted power of the second electronic device, resulting in the complete exhaustion of the power of the second electronic device.

[0094] Here, when the power information of the second electronic device is lower than the fourth preset threshold, the packet sending rate of the first electronic device is reduced to the fourth preset packet sending rate. In the above reduction of the packet sending rate of the first electronic device to the fourth preset packet sending rate, it can be in the form of a step size or by direct setting. Here, the embodiments of the present application do not make specific limitations on this.

[0095] Among them, the third preset packet sending rate is greater than the fourth preset packet sending rate. That is to say, the packet sending rate to which the first electronic device with power in the interval between the fourth preset threshold and the third preset threshold is reduced is greater than the packet sending rate to which the first electronic device with power in the interval from 0 to the fourth preset threshold is reduced. That is, the lower the power, the smaller the reduced packet sending rate.

[0096] In this way. By reducing the packet sending rate of the first electronic device in the above segmented interval manner, the packet sending rate of the first electronic device can be adjusted to an appropriate value, which helps the first electronic device to receive different numbers of data packets at different powers and adjust the power consumption to different extents.

[0097] It should be noted that the above first preset threshold and the third preset threshold can be equal or not equal, the above second preset threshold and the fourth preset threshold can be equal or not equal, the above first preset packet sending rate and the third preset packet sending rate can be equal or not equal, and the above second preset packet sending rate and the fourth preset packet sending rate can be equal or not equal; here, the embodiments of the present application do not make specific limitations on this.

[0098] Next, an example is given to describe the method for sending data packets described in one or more of the above embodiments.

[0099] In this example, after the Source end and the Sink end negotiate the playback parameters, if the Source end is in the bitrate adaptive mode and the Sink end is a headset, during the subsequent Bluetooth A2DP playback process, the bitrate adaptive algorithm of the Source end takes the current battery power information of the Sink end as an important factor and adds it to the bitrate calculation. When the power of the Sink end is low, the bitrate is reduced to reduce the number of Packets that the Sink end needs to decode, reduce the power consumption of the Sink end, and extend the battery life.

[0100] Figure 3Schematic diagram of the process of an example of an optional data packet sending method provided by an embodiment of the present application, as Figure 3 shown, the data packet sending method may include:

[0101] S301: The Sink end starts playing;

[0102] S302: The source end bitrate adaptation algorithm calculates the current bitrate s according to the packet sending situation;

[0103] S303: The source end obtains the battery power of the Sink end;

[0104] S304: Does the source end determine whether the power is less than 40%? If yes, execute S305; if no, execute S306;

[0105] S305: Does the source end determine whether the power is less than 15%? If yes, execute S307; if no, execute S308;

[0106] S306: The source end does not limit the bitrate t; execute S309;

[0107] S307: The source end limits the bitrate t to the minimum bitrate; execute S309;

[0108] S308: The source end limits the bitrate t not to exceed the medium bitrate; execute S309;

[0109] S309: The source end encodes and sends packets according to the bitrate t;

[0110] S310: The source end waits for the interval time and executes S302.

[0111] It should be noted that there are many ways for the source end to obtain the power of the Sink end. It can either use the standard Hands-Free Profile (HFP) protocol or obtain it through a private protocol. The definition of the above battery power judgment standard is intended to illustrate the technical solution of this example. In actual implementation, it can be changed and adjusted as needed.

[0112] In this example, in the A2DP bitrate adaptation mode, when the source end has a higher encoding bitrate, it also needs to send more data packets on the uplink (Tx) for data transmission, consuming more power. Therefore, the above solution of reducing the A2DP encoding bitrate of the source end according to the power of the Sink end also applies to the scenario where the power of the source end is low.

[0113] In this way, when the power of the Sink end is low, the bitrate is reduced, the power consumption of the Sink end is reduced, and the battery life is extended.

[0114] It can be seen that in this example, the Source end restricts the maximum bit rate according to the power information of the Sink end. When the power of the Sink end is low, the bit rate is reduced to reduce the power consumption of the Sink end. The power information of the Sink end can be obtained using the standard HFP protocol without adding a new software process, and the solution has very good compatibility.

[0115] The embodiment of the present application provides a method for sending data packets, including: when a connection is established between a first electronic device and a second electronic device, obtaining the packet sending rate of the first electronic device and the power information of the second electronic device, adjusting the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain an adjusted packet sending rate, and sending data packets to the second electronic device according to the adjusted packet sending rate; that is to say, in the embodiment of the present application, after a connection is established between the first electronic device and the second electronic device, the first electronic device obtains its own packet sending rate and the power information of the second electronic device, so that the first electronic device can adjust the packet sending rate of the first electronic device according to its own power information. Then, the first electronic device sends data packets using the adjusted packet sending rate, making the packet sending rate of the first electronic device related to the power of the second electronic device, which helps to adjust the power consumption of the second electronic device.

[0116] Based on the same inventive concept as the foregoing embodiment, the embodiment of the present application provides a data packet sending device, which is arranged in the first electronic device. Figure 4 It is a schematic structural diagram of an optional data packet sending device provided by the embodiment of the present application, as Figure 4 shown. The data packet sending device includes: an obtaining module 41, an adjusting module 42, and a sending module 43; where

[0117] The obtaining module 41 is configured to obtain the packet sending rate of the first electronic device and the power information of the second electronic device when a connection is established between the first electronic device and the second electronic device;

[0118] The adjusting module 42 is configured to adjust the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain an adjusted packet sending rate;

[0119] The sending module 43 is configured to send data packets to the second electronic device according to the adjusted packet sending rate.

[0120] In an optional embodiment, the adjusting module 42 is specifically configured to:

[0121] When the power information of the second electronic device is lower than a first preset threshold, reduce the packet sending rate of the first electronic device to obtain an adjusted packet sending rate.

[0122] In an alternative embodiment, when the power information of the second electronic device is lower than the first preset threshold, the adjustment module 42 reduces the packet sending rate of the first electronic device to obtain the adjusted packet sending rate, including:

[0123] When the power information of the second electronic device is lower than the first preset threshold and higher than the second preset threshold, the packet sending rate of the first electronic device is reduced to the first preset packet sending rate to obtain the adjusted packet sending rate.

[0124] In an alternative embodiment, when the power information of the second electronic device is lower than the first preset threshold, the adjustment module 42 reduces the packet sending rate of the first electronic device to obtain the adjusted packet sending rate, including:

[0125] When the power information of the second electronic device is lower than the second preset threshold, the packet sending rate of the first electronic device is reduced to the second preset packet sending rate to obtain the adjusted packet sending rate;

[0126] wherein, the first preset packet sending rate is greater than the second preset packet sending rate.

[0127] In an alternative embodiment, the obtaining module 41 is specifically configured to:

[0128] When the first electronic device establishes a connection with the second electronic device and the second electronic device is a device of a preset type, obtain the packet sending rate of the first electronic device and the power information of the second electronic device;

[0129] wherein, the device of the preset type is a device whose battery capacity is less than the preset capacity.

[0130] In an alternative embodiment, when the first electronic device sends data packets to the second electronic device using the code rate adaptation mode, the packet sending rate of the first electronic device is: the packet sending rate corresponding to the code rate when the first electronic device uses the code rate adaptation mode.

[0131] In an alternative embodiment, the device is further configured to:

[0132] Obtain the power information of the first electronic device;

[0133] Adjust the packet sending rate of the first electronic device according to the power information of the first electronic device; obtain the adjusted packet sending rate.

[0134] In practical applications, the above-mentioned acquisition module 41, adjustment module 42, and sending module 43 can be implemented by a processor located on the sending device of the data packet, specifically implemented by a CPU, a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0135] Figure 5 The following is a schematic structural diagram of an optional electronic device provided by an embodiment of the present application. As Figure 5 shown, an embodiment of the present application provides an electronic device 500, and the electronic device 500 includes:

[0136] a processor 51 and a storage medium 52 storing executable instructions of the processor 51; the storage medium 52 depends on the processor 51 to execute operations through a communication bus 53. When the instructions are executed by the processor 51, the data packet sending method described in the above one or more embodiments is executed.

[0137] It should be noted that in practical applications, each component in the computer device is coupled together through the communication bus 53. It can be understood that the communication bus 53 is used to realize the connection and communication between these components. In addition to the data bus, the communication bus 53 also includes a power bus, a control bus, and a status signal bus.

[0138] An embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processor executes the data packet sending method described in the above one or more embodiments.

[0139] Among them, the computer-readable storage medium may be a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.

[0140] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories and optical memories, etc.) containing computer-usable program code.

[0141] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0142] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0143] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable apparatus to generate a computer-implemented process, thereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one process or a plurality of processes and / or blocks Figure 1 one process or a plurality of processes and / or blocks Figure 1 steps for implementing the functions specified in one block or a plurality of blocks.

[0144] As described above, only the preferred embodiments of the present application are provided, and they are not intended to limit the protection scope of the present application.

Claims

1. A method for sending a data packet, characterized in that: Applicable to a first electronic device, comprising: When the first electronic device is connected to the second electronic device, obtaining the packet sending rate of the first electronic device and the power information of the second electronic device; According to the power information of the second electronic device, adjusting the packet sending rate of the first electronic device to obtain an adjusted packet sending rate; The data packet is sent to the second electronic device according to the adjusted packet sending rate.

2. The method according to claim 1, characterized in that: The step of adjusting the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain the adjusted packet sending rate includes: When the power information of the second electronic device is lower than a first preset threshold, the packet sending rate of the first electronic device is reduced to obtain the adjusted packet sending rate.

3. The method according to claim 2, characterized in that When the power information of the second electronic device is lower than a first preset threshold, reducing the packet sending rate of the first electronic device to obtain the adjusted packet sending rate includes: When the power information of the second electronic device is lower than the first preset threshold and higher than the second preset threshold, the packet sending rate of the first electronic device is reduced to the first preset packet sending rate to obtain the adjusted packet sending rate.

4. The method according to claim 3, characterized in that When the power information of the second electronic device is lower than a first preset threshold, reducing the packet sending rate of the first electronic device to obtain the adjusted packet sending rate includes: When the power information of the second electronic device is lower than a second preset threshold, reducing the packet sending rate of the first electronic device to the second preset packet sending rate to obtain the adjusted packet sending rate; Among them, the first preset packet sending rate is greater than the second preset packet sending rate.

5. The method according to any one of claims 1 to 4, characterized in that: When the first electronic device is connected to the second electronic device, obtaining the packet sending rate of the first electronic device and the power information of the second electronic device includes: When the first electronic device is connected to the second electronic device and the second electronic device is a device of a preset type, obtaining a packet sending rate of the first electronic device and power information of the second electronic device; The device of the preset type is a device whose battery capacity is smaller than a preset capacity.

6. The method according to any one of claims 1 to 4, characterized in that: When the first electronic device sends a data packet to the second electronic device using the bit rate adaptive mode, the packet sending rate of the first electronic device is: the packet sending rate corresponding to the bit rate when the first electronic device uses the bit rate adaptive mode.

7. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Acquiring power information of the first electronic device; According to the power information of the first electronic device, the packet sending rate of the first electronic device is adjusted to obtain the adjusted packet sending rate.

8. A device for sending a data packet, characterized in that: The device is provided in a first electronic device and includes: An acquisition module, configured to acquire a packet sending rate of the first electronic device and power information of the second electronic device when the first electronic device is connected to the second electronic device; An adjustment module, configured to adjust the packet sending rate of the first electronic device according to the power information of the second electronic device to obtain an adjusted packet sending rate; The sending module is used to send the data packet to the second electronic device according to the adjusted packet sending rate.

9. An electronic device, characterized in that: include: A processor and a storage medium storing instructions executable by the processor; The storage medium relies on the processor to perform operations through a communication bus, and when the instructions are executed by the processor, the method for sending a data packet described in any one of claims 1 to 7 is executed.

10. A computer storage medium, characterized in that: Executable instructions are stored, and when the executable instructions are executed by one or more processors, the processors execute the method for sending a data packet as described in any one of claims 1 to 7.