CN115174538A - Data transmission method and device, electronic equipment and computer readable medium - Google Patents

Data transmission method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN115174538A
CN115174538A CN202210772322.2A CN202210772322A CN115174538A CN 115174538 A CN115174538 A CN 115174538A CN 202210772322 A CN202210772322 A CN 202210772322A CN 115174538 A CN115174538 A CN 115174538A
Authority
CN
China
Prior art keywords
data
target
code rate
capacity
audio
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210772322.2A
Other languages
Chinese (zh)
Inventor
王泽卫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202210772322.2A priority Critical patent/CN115174538A/en
Publication of CN115174538A publication Critical patent/CN115174538A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • H04B5/70Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes
    • H04B5/72Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes for local intradevice communication

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application discloses a data transmission method, a data transmission device, electronic equipment and a computer readable medium, which relate to the technical field of multimedia playing, and the method comprises the following steps: in the process that the wireless audio playing equipment plays the target audio data sent by the electronic equipment through a preset wireless network, acquiring the target data capacity of the audio data to be played, which is currently stored in a data buffer area of the wireless audio playing equipment; determining a target code rate based on the target data capacity; coding unsent data in the target audio data at a target code rate to obtain specified audio data; and sending the specified audio data coded with the target code rate to the wireless audio playing equipment through a preset wireless network. Therefore, by referring to the data capacity in the data buffer of the wireless audio playing device and determining the code rate based on the capacity, compared with directly reducing the code rate, the time length for playing the data stored in the wireless audio playing device can be considered, so that the setting of the target code rate is more reasonable.

Description

Data transmission method and device, electronic equipment and computer readable medium
Technical Field
The present application relates to the field of multimedia playing technologies, and in particular, to a data transmission method, an apparatus, an electronic device, and a computer-readable medium.
Background
With the popularization of wireless audio playing devices such as wireless earphones, wireless sound boxes and the like, scenes and time for users to use the wireless audio playing devices are more and more, but because the existing protocol definition only supports the rate of a 3Mbps physical layer at most, the audio transmission with high tone quality/higher tone quality is difficult to support. Especially in a complex interference environment, as the transmission failure rate increases, the number of required retransmissions also increases, thereby causing audio jamming.
At present, the method for solving the stuck phenomenon of playing audio by a wireless earphone is to reduce the code rate, that is, when transmitting an audio bit stream to a communication module, the audio bit stream passes through a coder and a decoder, and the compression rates of different coding and decoding modes are different. For example, the audio is usually encoded and decoded in AAC, SBC, LHDC, and the corresponding compressed code rates are 128kbps, 256kbps, and more than 256kbps, respectively. Although the tone quality is sacrificed to a certain extent due to the reduction of the audio code rate, more bit streams can be transmitted at the same network transmission rate, which alleviates audio congestion to a certain extent. However, the audio pause phenomenon during audio playing is only relieved by reducing the code rate, and the effect is poor.
Disclosure of Invention
The application provides a data transmission method, a data transmission device, an electronic device and a computer readable medium, so as to overcome the defects.
In a first aspect, an embodiment of the present application provides a data transmission method, which is applied to an electronic device, where the electronic device is connected to a wireless audio playing device through a preset wireless network, and the method includes: in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network, acquiring the target data capacity of the currently stored audio data to be played in a data buffer area of the wireless audio playing device, wherein the data in the data buffer area is removed after being played; determining a target code rate based on the target data capacity, wherein the target data capacity is in positive correlation with the target code rate, and the target code rate is used for representing that the playing fluency of the wireless audio playing device for playing the data to be played with the code rate meets the use requirement under the condition that the data capacity of the data to be played, which is stored by the wireless audio playing device, is the target data capacity; coding the unsent data in the target audio data at the target code rate to obtain appointed audio data; and sending the target audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
In a second aspect, an embodiment of the present application further provides a data transmission device, which is applied to an electronic device, where the electronic device is connected to a wireless audio playing device through a preset wireless network, and the device includes: the device comprises an acquisition unit, a determination unit, an encoding unit and a transmission unit. And the acquisition unit is used for acquiring the target data capacity of the audio data to be played, which is currently stored in the data buffer area of the wireless audio playing device, in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network. The determining unit is configured to determine a target code rate based on the target data capacity, where the target data capacity is positively correlated with the target code rate, and the target code rate is used to characterize that, when the data capacity of the to-be-played data stored in the wireless audio playing device is the target data capacity, the playing fluency of the to-be-played data at the code rate played by the wireless audio playing device meets the use requirement. And the coding unit is used for coding the data which is not sent in the target audio data at the target code rate to obtain the specified audio data. And the transmission unit is used for transmitting the specified audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
In a third aspect, an embodiment of the present application further provides an electronic device, including: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to perform the above-described method.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, where a program code executable by a processor is stored, and when executed by the processor, the program code causes the processor to execute the above method.
According to the data transmission method, the data transmission device, the electronic equipment and the computer readable medium, in the process that the wireless audio playing equipment plays the target audio data sent by the electronic equipment through the preset wireless network, the target data capacity of the target audio data stored in a data buffer area of the wireless audio playing equipment at present is obtained, the target code rate is determined based on the target data capacity, the target code rate is used for representing that under the condition that the data capacity of the data to be played stored by the wireless audio playing equipment is the target data capacity, the playing fluency of the data to be played at the code rate is played by the wireless audio playing equipment meets the use requirement, the data which are not sent in the target audio data are coded at the target code rate to obtain the specified audio data, and the specified audio data coded at the target code rate are sent to the wireless audio playing equipment through the preset wireless network. Because the target audio data stored in the data buffer area is played when the wireless audio playing device plays the target audio data, and the played data can be removed from the data buffer area, the code rate is determined based on the capacity by referring to the data capacity in the data buffer area of the wireless audio playing device, and compared with directly reducing the code rate, the time length that the data stored in the wireless audio playing device can be played can be taken into consideration, so that the target code rate is set more reasonably.
Additional features and advantages of embodiments of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of embodiments of the present application. The objectives and other advantages of the embodiments of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a schematic diagram of an audio system provided by an embodiment of the present application;
fig. 2 is a flowchart illustrating a method of data transmission according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating an audio playing interface provided by an embodiment of the present application;
fig. 4 is a flowchart illustrating a method of data transmission according to another embodiment of the present application;
FIG. 5 is a diagram illustrating a mapping relationship provided by an embodiment of the present application;
FIG. 6 is a flow chart of a method of data transmission according to another embodiment of the present application;
FIG. 7 is a flow chart of a method of data transmission according to yet another embodiment of the present application;
FIG. 8 is a diagram illustrating a mapping relationship provided by another embodiment of the present application;
fig. 9 shows a block diagram of a data transmission apparatus according to an embodiment of the present application;
FIG. 10 is a block diagram of an electronic device according to an embodiment of the present application;
fig. 11 is a storage unit according to an embodiment of the present application, configured to store or carry program code for implementing a data transmission method according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
With the development of wireless communication technology and the popularization of wireless audio playing devices, when a user plays a multimedia file (e.g., a video file or an audio file) with an electronic device, the user may play audio data of the multimedia file with the wireless audio playing device. Wireless headsets are becoming more and more widely used due to their features of being convenient to carry and the like. Among them, the real Wireless Stereo (TWS) headset has gradually increased occupancy in the headset market due to its excellent characteristics of being more comfortable to wear, convenient to use, unobtrusive, smaller and more beautiful. Specifically, the wireless headset and the electronic device may cooperate with each other to play audio data, for example, when the electronic device plays a video file or plays audio, the terminal sends the audio data to the wireless headset, and the audio data is played by the wireless headset.
As shown in fig. 1, the audio system 10 includes an electronic device 100 and a wireless audio playback device 200. The wireless audio playback device 200 refers to a device for playing back audio that is independent of the electronic device 100, and is capable of receiving and playing back audio data transmitted by the electronic device 100. For example: when a user plays a song with the electronic device, the user may start a music playing application program on a display interface of the electronic device 100, or play a locally stored song with a player of an operating system of the electronic device 100, the electronic device 100 processes the song during the process of playing the song to obtain digitized audio data and sends the processed audio data to the wireless audio playing device 200, and the wireless audio playing device 200 performs digital-to-analog conversion on the audio data after receiving the audio data to obtain an analog signal, and plays the analog signal with a playing function of an external sound device, so as to realize song playing through the external sound device.
In the embodiment of the present invention, the electronic device 100 and the wireless audio playing device 200 interact with each other through a wireless network to transmit signals, wherein the wireless network may be a bluetooth, wifi, LTE network, or NFC.
In this embodiment of the present invention, the wireless audio playing device 200 is a bluetooth sound device or a bluetooth earphone, the wireless audio playing device 200 can realize connection with the electronic device 100 by starting a bluetooth function, and after the connection is established, the electronic device 100 sends the voice to be played to the bluetooth sound device, so that the bluetooth sound device realizes voice playing.
Specifically, after the bluetooth functions of the electronic device 100 and the wireless audio playing device 200 are started, the electronic device 100 searches for bluetooth devices within a preset distance of the electronic device 100 and displays names of the searched bluetooth devices on a display interface of the electronic device, after a user clicks or selects the wireless audio playing device 200 on the display interface, the electronic device 100 sends a connection request to the wireless audio playing device 200, and after receiving the connection request, the wireless audio playing device 200 establishes a connection with the electronic device 100 and feeds back a connection success message.
After the electronic device 100 establishes connection with the wireless audio playing device 200, if the electronic device 100 has audio such as a song or a video that needs to be played, the electronic device processes the audio data into a digital signal and sends the audio data to the wireless audio playing device 200, and after receiving the audio data, the wireless audio playing device 200 processes and plays the audio data, thereby playing the audio. Specifically, the electronic device 100 and the wireless audio playing device 200 are connected via bluetooth, and data and instructions between the electronic device 100 and the wireless audio playing device 200 are transmitted according to a certain bluetooth protocol, when the electronic device 100 sends audio data to the wireless audio playing device 200, the audio data needs to be encoded according to an encoding format under the supported bluetooth protocol, for example, for audio, apt to adopt Apt-X, SBC, AAC, and LDAC encoding algorithms.
The electronic device 100 encodes the audio data to generate an audio data packet, and then transmits the audio data packet to the wireless audio playing device 200 through a bluetooth transmission channel between the electronic device 100 and the wireless audio playing device 200, after the wireless audio playing device 200 acquires the audio data packet, the audio data can be acquired after decoding the data packet, taking the audio in the MP3 format as an example, the encoding process is that the electronic device samples and discretizes an MP3 file after PCM encoding, converts the audio data into an SBC encoding format, and then transmits the SBC format to the wireless audio playing device, and the wireless audio playing device decodes the audio in the SBC format to acquire the audio data in the PCM format, and then drives components such as a voice coil of the wireless audio playing device to vibrate and sound according to the PCM encoding.
However, since the bluetooth technology defined by the existing protocol only supports 3Mbps physical layer rate at most, it is difficult to support high-quality/higher-quality audio transmission. Especially in a complex interference environment, as the transmission failure rate increases, the number of retransmissions required also increases, thereby causing audio congestion. At present, the way of solving the problem of bluetooth audio jamming is to reduce the code rate, namely, when transmitting the audio bit stream to the bluetooth module, the audio bit stream passes through the bluetooth codec, and the compression rates of different codec modes are different. The common coding and decoding modes are AAC, SBC and LHDC, and the corresponding code rates after compression are respectively 128kbps, 256kbps and more than 256kbps. Although the sound quality is sacrificed to a certain extent due to the reduction of the audio code rate, more bit streams can be transmitted at the same Bluetooth rate, which relieves the audio jam to a certain extent.
However, the inventor finds in research that the existing way of reducing the code rate is single, and the audio code rate is generally adjusted directly according to the transmission quality of the bluetooth itself. For example, when the electronic device plays audio through the bluetooth headset, the electronic device sends audio data to the bluetooth headset, the bluetooth headset receives the audio data, and the encoding and decoding of the audio stream are also performed on the electronic device side, so that the electronic device can monitor the transmission conditions of the bluetooth in real time, such as the transmission conditions of packet loss rate, retransmission and the like, and if the packet loss rate/retransmission times are increased, the code rate is correspondingly reduced, thereby improving the transmission efficiency and relieving the audio jam. However, although this scheme has a certain effect on improving the jamming, the problem is not solved efficiently, because the main reason for the jamming is that the audio data to be played in the data buffer (buffer) of the bluetooth headset is insufficient or missing, so that no audio data is available at the headset end, and the deterioration of the bluetooth transmission condition at the side of the monitored electronic device is only the current situation of a short time, and cannot represent the data insufficiency in the buffer of the current wireless headset, therefore, if there is enough audio data in the buffer of the headset to be played, the code rate of the audio data is reduced, and the code rate is likely to be reduced only in advance, so the disadvantage of this scheme is mainly that the user tone quality experience during audio playing is sacrificed too early or too much.
Therefore, in order to overcome the above-mentioned drawbacks, embodiments of the present application provide a data transmission method, an apparatus, an electronic device, and a computer readable medium, which can fully consider the data capacity of the audio data to be played stored in the data buffer of the wireless audio playing device to adjust the code rate of the audio data when the network quality is not good.
Specifically, as shown in fig. 2, an embodiment of the present application provides a data transmission method, which is applied to the above-mentioned electronic device, where the electronic device is connected to a wireless audio playing device through a preset wireless network, for example, the wireless audio playing device may be a bluetooth headset, and the preset wireless network may be a bluetooth network, and specifically, the method includes: s201 to S204.
S201: and acquiring the target data capacity of the currently stored audio data to be played in the data buffer area of the wireless audio playing device in the process of playing the target audio data sent by the electronic device through the preset wireless network by the wireless audio playing device.
As an embodiment, the audio data to be played in the data buffer is removed after being played, and the preset wireless network may be a bluetooth network, or may also be a wifi network or a zigbee network, which is not limited herein. In the embodiment of the present application, a predetermined wireless network is taken as an example of a bluetooth network, and the embodiment of the present application is described.
Illustratively, after the electronic device and the wireless audio playing device establish a bluetooth network, the electronic device sends target audio data to the wireless audio playing device through the bluetooth network, after the wireless audio playing device receives the target audio data, the target audio data is stored in a data buffer (buffer), the wireless audio playing device takes out the audio data from the buffer for playing, and the played data is removed from the buffer so that new audio data to be played is stored in the buffer. In some embodiments, after the electronic device establishes a bluetooth network with a wireless audio playing device, the electronic device detects whether an audio playing request is acquired, determines target audio data requested to be played by the audio playing request if the audio playing request is acquired, and sends the target audio data to the wireless audio playing device, so as to play the target audio data through the wireless audio playing device. Specifically, the audio play request may be a request for playing a reminder message or an audio file. The reminding information comprises information for reminding a user that some events are triggered, such as call reminding information, short message reminding information, alarm reminding information and the like. For example, the call reminding information is used for reminding the user of the current incoming call.
Illustratively, a plurality of audio playing software are installed in the electronic device, and the software may be a music playing APP, a video playing APP, or a recording APP. For example, referring to fig. 3, an audio playing interface of a music playing APP is displayed on a screen of an electronic device, a user selects a song to be played, that is, audio data to be played, on the audio playing interface, and then clicks a playing button, the electronic device can detect an audio playing request, and then invoke an audio player to play an audio file corresponding to the audio playing request, where the audio player may be a music player of the electronic device itself, or may be a third party APK, and this is not limited herein. As shown in fig. 3, the wireless audio playing device includes a first wireless earphone and a second wireless earphone, the electronic device is connected to the first wireless earphone 210 via bluetooth, and then the first wireless earphone 210 is connected to the second wireless earphone 220 via bluetooth, so that the electronic device, the first wireless earphone 210 and the second wireless earphone 220 are connected simultaneously via networking. In this embodiment, the first wireless headset 210 may serve as a master headset, the second wireless headset 220 may serve as a slave headset, the electronic device sends the target audio data to the first wireless headset 210 through the bluetooth network, and the second wireless headset 220 acquires the target audio data by monitoring data transmitted between the electronic device and the first wireless headset 210, so as to implement binaural playing through the first wireless headset and the second wireless headset.
Therefore, after the electronic device and the wireless audio playing device establish the bluetooth network and detect the audio playing request, the electronic device may send the target audio data through the preset wireless network, and in the process of playing the target audio data sent by the electronic device through the preset wireless network by the wireless audio playing device, the code rate of the target audio device may be adjusted by the method of the embodiment of the present application. Specifically, a target data capacity of currently stored audio data to be played in a data buffer of the wireless audio playing device is obtained. As an implementation manner, based on the bluetooth protocol, after receiving an audio data packet obtained by encoding target audio data sent by an electronic device, a wireless audio playing device feeds back an acknowledgement packet to the electronic device, where the acknowledgement packet includes a first parameter and a second parameter, the first parameter is used to inform the electronic device whether the data packet has been received, and the second parameter is used to inform the electronic device whether the data packet needs to be retransmitted. In this embodiment of the application, the wireless audio playing device may add capacity information to the confirmation packet, where the capacity information is used to represent a target data capacity of currently stored audio data to be played in a data buffer of the wireless audio playing device, and the electronic device may obtain the target data capacity of the currently stored audio data to be played in the data buffer of the wireless audio playing device based on the capacity information.
It should be noted that the played audio data may be audio data corresponding to target audio data, for example, the target audio data is a song, and when playing, an audio clip is sent to the wireless audio playing device each time, for example, the audio data of each 5 seconds of the target audio data is used as an audio clip (also referred to as an audio frame), and then the audio data to be played stored in the data buffer of the wireless audio playing device may be a plurality of audio frames that have been sent to the wireless audio playing device in the target audio data. Of course, the audio data to be played may also be audio data corresponding to an audio file other than the target audio data, for example, taking the audio playing interface as an example, the current audio playing list includes song 1 and song 2, where song 2 is the target audio data, the playing sequence of song 1 and song 2 is that song 1 is played first and then song 2 is played, and the data to be played stored in the data buffer of the wireless audio playing device may be the audio data corresponding to song 1 and the audio data corresponding to song 2, for example, the audio data of the last 10 seconds corresponding to song 1 and the audio data of the first 15 seconds corresponding to song 2.
S202: and determining a target code rate based on the target data capacity.
As an implementation manner, the target data capacity is positively correlated with the target code rate, where the target code rate is a code rate corresponding to a target coding algorithm, that is, the code rate of the audio data encoded by the target coding algorithm is the target code rate, for example, the code rate of the audio encoded by the AAC coding algorithm is 128kbps, and the code rate corresponding to a coding algorithm supported by a communication transmission protocol between the electronic device and the wireless audio playback device. Specifically, the electronic device supports multiple encoding algorithms for encoding audio data, and then a communication network between the electronic device and the wireless audio playing device may transmit the encoded audio data, specifically, audio data, such as MP3 format audio, encoded into an audio data packet according to the encoding algorithms and then sent to the wireless audio playing device, such as Apt-X, SBC, AAC, and LDAC encoding algorithms. The coding rate corresponding to each coding algorithm is different, that is, when different coding algorithms code the same audio data, the size of the obtained coded audio data is also different.
After the electronic device acquires the target audio data, the audio data in the target audio data needs to be encoded based on an encoding algorithm supported by a bluetooth protocol to obtain an audio data packet, and the target audio data is sent to the wireless audio playing device through the audio data packet. Specifically, after the electronic device acquires the audio data, the audio data needs to be transmitted to the wireless audio playing device through bluetooth, and in order to ensure the speed of data transmission, the audio data needs to be encoded according to a bluetooth transmission protocol between the electronic device and the wireless audio playing device to form a format for user transmission, for example, the audio data is encoded into an SBC format, and in order to increase the transmission speed and increase the fault tolerance rate of transmission, the audio data needs to be sampled and encoded, so that the size of the audio data is reduced, and the transmission is facilitated. Similarly, for the increase of the encoding rate for transmitting the audio data, the sampling rate of the audio data during the transmission may be increased or the compression ratio during the encoding may be decreased, so that more useful information of the audio data is saved, and the tone quality of the audio data is further improved, but the audio data packet is larger. Therefore, the higher the code rate corresponding to the encoding algorithm is, the less useful information is lost by the audio data, that is, the higher the sound quality of the audio data is, but the larger the data amount of the data packet formed after the audio data is encoded is, and conversely, the lower the code rate corresponding to the encoding algorithm is, the more useful information is lost by the audio data, that is, the lower the sound quality of the audio data is, but the lower the data amount of the data packet formed after the audio data is encoded is.
As an implementation manner, the target data capacity can reflect a duration of the wireless audio playing device continuously playing the audio when the wireless audio playing device receives the target audio data and plays the audio data to be played in the data buffer, when there is no audio data that can be played in the data buffer, the wireless audio playing device does not have the audio data that can be played, so that the audio playing is paused, and the target code rate determined based on the target data capacity can represent that the playing fluency of the wireless audio playing device playing the data to be played at the code rate meets the use requirement when the data capacity of the data to be played, which is stored in the wireless audio playing device, is the target data capacity. Therefore, the target data capacity is positively correlated with the time length for playing the audio, and the size of the code rate determines the time length consumed by audio data transmission, for example, for a data packet of an audio frame in the AAC format (if the audio frame is audio data in 3 seconds), the code rate of the audio corresponding to the AAC format is 128kbps, the data size of the data packet of the audio frame in the AAC format is 384kb, and if the data packet format of the audio frame is SBC, and the code rate of the audio corresponding to the SBC format is 256kbps, the data size of the data packet of the audio frame in the SBC format is 768kb, it is obvious that the larger the data size of the audio data with the higher code rate is, the longer the time consumed by transmission is, the larger the time length for continuously playing the audio by the wireless audio playing device is, therefore, the target data capacity is positively correlated with the target code rate, that is, the larger the target data capacity is, the longer the time length capable of playing is, the time length is sufficient for transmitting the higher audio data packet, and conversely, the smaller the target data capacity is, the smaller the time length of the code rate is not sufficient for transmitting the audio data packet, so that the code rate is less, the code rate is required for transmitting the lower the data packet is.
As an embodiment, a corresponding relationship between the data capacity and the code rate may be preset, for example, the corresponding relationship may be a mapping table, where the mapping table includes a plurality of capacity thresholds and a code rate corresponding to each capacity threshold, where the code rate corresponding to the capacity threshold refers to that, when the data capacity of the data to be played, which is stored in the wireless audio playing device, is in the range of the capacity threshold, the playing fluency of the data to be played, which is played by the wireless audio playing device, meets the use requirement, that is, if the capacity threshold is 20-30kb and the code rate is akbps, when the data capacity in the data buffer of the wireless audio playing device is in 20-30kb, and the audio data is transmitted with the bpaks code rate, the played data and the transmitted data may be relatively balanced in a preset time period, that is, the wireless audio playing device has the capability of playing the audio data in the preset time period, that is, that the playing of the audio data does not suffer from stutter. As another embodiment, the relationship among the data capacity, the code rate, and the playing time may also be determined by a functional expression, so that the playing time represented by the data capacity matches the transferred data amount represented by the code rate, without causing a pause.
Therefore, through the mapping table or the functional relationship, the target code rate corresponding to the target data capacity can be determined, and when the data stored in the wireless audio playing device is the target data capacity and the target audio data is transmitted by adopting the target code rate when the target audio data is played, the playing of the target audio data cannot cause pause.
S203: and coding the data which is not sent in the target audio data at the target code rate to obtain the specified audio data.
And coding the data which is not sent in the target audio data at the target code rate, thereby obtaining the specified audio data coded at the target code rate. In the embodiment of the present application, the target audio data encoded at the target code rate may be named as the designated audio data. Exemplarily, assuming that a current frame of the target audio data is an nth frame, a next frame is an N +1 th frame, and a code rate used when the nth frame is transmitted is Akbps, then, determining that the target code rate is Bkbps, and encoding subsequent audio frames of the current frame, such as the N +1 th frame, the N +2 th frame, the (b + 1) th frame, the (b + 2) th frame, and the like, with the Bkbps to obtain the specified audio data encoded at the target code rate.
For example, when the network is poor, the code rate may be reduced, that is, when it is detected that the network quality of the preset wireless network does not satisfy the use condition in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network, the target data capacity of the audio data to be played, which is currently stored in the data buffer of the wireless audio playing device, is obtained, so as to determine the target code rate according to the target data capacity. Of course, the target data capacity may be obtained by adjusting at specified time intervals, the target code rate may be determined based on the target data capacity, and then the specified audio data encoded at the target code rate is obtained, which is not limited herein.
S204: and sending the specified audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
It should be noted that, because the data amount per second of the audio data with different code rates is different, the larger the code rate is, the larger the data amount of the audio data is, and the smaller the audio data transmitted in the unit time of the audio data with the higher code rate is in the same network state. For example, if the same song is 1 minute, the audio data packet obtained by encoding the song with one code rate is 10KB, and the audio data packet obtained by encoding the song with another code rate is 100KB, it is avoided that the audio data packet with the higher code rate is larger and the requirement on the network is larger, if the network transmission speed is 5KB/S, the transmission of the data packet with the code rate of 10KB needs 2 seconds to be completed, and the transmission of the data packet with the code rate of 100KB needs 20 seconds to be completed, and then, the data packet with the code rate of 10KB is more lost than the data packet with the code rate of 100KB, and the sound quality is worse.
Therefore, in the embodiment of the application, the stored duration of the audio data to be played can be considered by the target data capacity of the audio data to be played stored in the wireless earphone, and the unsent audio data is continuously transmitted during playing, so that the target code rate is set more reasonably.
Specifically, as shown in fig. 4, an embodiment of the present application provides a data transmission method, which is applied to the above-mentioned electronic device, where the electronic device is connected to a wireless audio playing device through a preset wireless network, for example, the wireless audio playing device may be a bluetooth headset, and the preset wireless network may be a bluetooth network, and specifically, the method includes: s401 to S407.
S401: and acquiring the first network transmission quality of the preset wireless network in the process that the wireless audio playing equipment plays the target audio data which is sent by the electronic equipment through the preset wireless network and is coded at the first code rate.
As an implementation manner, the wireless network is preset to be a bluetooth network, a bluetooth communication module of the electronic device monitors bluetooth transmission quality when the electronic device and the wireless audio playing device transmit data through the bluetooth network, the determination of the transmission quality does not depend on a single factor, including but not limited to bluetooth signal strength (RSSI), bluetooth retransmission rate, bluetooth packet loss rate, and a matrix formed by these parameters reflects the current bluetooth transmission quality together.
In this embodiment of the application, the first network transmission quality corresponds to a first code rate, that is, in a process that the electronic device transmits the target audio data encoded with the first code rate through the bluetooth network, the obtained bluetooth transmission quality is used as the first network transmission quality.
S402: and if the first network transmission quality is lower than a first specified threshold value, acquiring the target data capacity of the audio data to be played, which is currently stored in a data buffer area of the wireless audio playing device.
As an implementation manner, if the bluetooth transmission quality of the bluetooth network is less than the first specified threshold, it indicates that the quality of the current bluetooth network is poor, and it needs to pay close attention to the data amount of the stored audio data to be played in the data buffer of the wireless audio playing device, so as to avoid that the data amount in the data buffer decreases to cause the playing card pause due to the playing of the stored audio data to be played along with the wireless audio playing due to the poor network quality.
S403: and judging whether the target data capacity is smaller than a specified capacity threshold value.
S404: and determining a target code rate based on the target data capacity and a preset mapping relation.
S405: and taking the first code rate as a target code rate.
As an implementation manner, in the process of transmitting, by an electronic device, target audio data encoded with a first code rate through a bluetooth network, if it is detected that transmission quality of the bluetooth network is lower than a first specified threshold, a target data capacity of currently stored audio data to be played in a data buffer of the wireless audio playing device is obtained, then, a size relationship between the target data capacity and the specified capacity threshold is determined, and if the target data capacity is not smaller than the specified capacity threshold, it indicates that the data size of the currently stored audio data to be played in the data buffer of the wireless audio playing device can also meet smooth playing of the wireless audio playing device, so the first code rate may be used as the target code rate, that is, the unsent data in the target audio data is continuously transmitted using the first code rate.
If the target data capacity is smaller than the designated capacity threshold, it indicates that the data size of the currently stored audio data to be played in the data buffer of the wireless audio playing device is insufficient, and continuing to use the first code rate to transfer the target audio data may cause that the wireless audio playing device cannot smoothly play, so that the code rate of the target audio data needs to be adjusted based on the target data capacity of the data buffer of the wireless audio device. Specifically, a preset mapping relationship is obtained, where the mapping relationship includes a plurality of capacity threshold ranges and a code rate corresponding to each capacity threshold range, where each capacity threshold range in the mapping relationship is smaller than the specified capacity threshold and each code rate is lower than the first code rate, and the capacity threshold range is positively correlated with the code rate. Specifically, the electronic device and the wireless audio playing device may be adjusted to test the maximum code rate that the wireless audio playing device can use in different capacity threshold ranges under the condition that the bluetooth transmission quality is less than the first specified threshold, so as to enable the wireless audio playing device to play the audio without pause. As shown in fig. 5, the capacities of the first range, the second range, the nth range and the second range included in the mapping relationship are all smaller than a specified capacity threshold, where a code rate a corresponding to the first range indicates that when the data amount of the audio data to be played stored in the buffer of the wireless audio playing device is within the first range, it can be ensured that the wireless audio playing device is not jammed by using the code rate a, and the code rate a is a maximum code rate corresponding to the first range, that is, the data amount of the audio data to be played stored in the buffer is within the first range, and in order to ensure the fluency of playing, the maximum usable code rate is the code rate a, further, the network quality corresponding to the mapping relationship is the bluetooth transmission quality lower than the first specified threshold, and the meanings of the code rates corresponding to the other second ranges and the nth range are similar to those of the code rate a, and are not described herein again.
Therefore, by using the mapping table, when the network transmission quality is lower than a first specified threshold and the target data capacity is smaller than a specified capacity threshold, a target code rate corresponding to the target data capacity is determined, and specifically, a target capacity threshold matched with the target data capacity is searched in the mapping relation; and taking the code rate corresponding to the target capacity threshold as a target code rate.
It should be noted that, in the mapping relationship, the code rate corresponding to each capacity threshold range is used to represent that, when the data capacity of the data to be played, which is stored in the wireless audio playing device, is in the capacity threshold range, the playing fluency of the data to be played, which is played by the wireless audio playing device at the code rate, meets the use requirement, and the use requirement is that the playing is not stuck. That is, in the above mapping relationship, the capacity threshold range and the code rate are positively correlated, that is, the smaller the capacity threshold range, the smaller the corresponding code rate.
S406: and coding the unsent data in the target audio data at the target code rate to obtain the specified audio data.
S407: and sending the specified audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
Illustratively, after the target code rate is determined based on the foregoing manner, and the target audio data is transmitted based on the code rate, the network transmission quality of the preset wireless network is determined again, if the network transmission quality is still less than the first specified threshold, the data capacity of the currently stored target audio data in the data buffer of the wireless audio playing device is obtained again as a new target data capacity, that is, as the electronic device transmits the specified audio data encoded at the target code rate to the wireless audio playing device, the wireless audio playing device stores the received target audio data in the data buffer, and as the wireless audio playing device plays the audio data in the data buffer, the capacity of the audio data in the data buffer changes again, so if the new target data capacity is less than the specified capacity threshold, the target capacity threshold matching the target data capacity is searched in the mapping relationship again, and the code rate corresponding to the target capacity threshold is taken as the target code rate, until the target code rate is the minimum code rate or the network transmission quality of the preset wireless network is not less than the first specified threshold.
Specifically, if the network quality between the electronic device and the wireless audio playing device is not improved, that is, the network transmission quality is still less than the first specified threshold, the reduction speed of the transmitted data amount is greater than the consumption speed of the stored audio data to be played in the data buffer (that is, the played speed), and if the code rate is not changed, the audio data in the data buffer is consumed too fast, so that the target capacity threshold matching the target data capacity is searched again in the mapping relationship and the code rate corresponding to the target capacity threshold is taken as the target code rate, and then, the data capacity of the target audio data currently stored in the data buffer of the wireless audio playing device is obtained again to serve as a new target data capacity and subsequent operations until the target code rate is the minimum code rate, or the network transmission quality of the preset wireless network is improved, that is, the network transmission quality is not less than the first specified threshold.
In the embodiment of the application, if the target code rate is the minimum code rate, prompt information is output, and the prompt information is used for indicating that the preset wireless network cannot be applied to playing of the target audio data. The prompt message may be a voice prompt tone played through a wireless audio playing device. In some embodiments, when the target code rate is the minimum code rate, it may still cause a pause of audio playing, for example, when the network transmission quality is too poor and the capacity of the audio data to be played in the data buffer is too low, the standby audio stored in the wireless audio playing device may be obtained, where the stored audio is a specified memory stored in the wireless audio playing, and the audio data in the specified memory does not disappear due to power failure or being played, and the wireless audio playing device may input the standby audio in the specified memory into the data buffer to increase the audio data playable by the wireless audio playing device, and at this time, the wireless audio playing device stops sending a new target data capacity to the electronic device or still sends the minimum data capacity to the electronic device, where the minimum data capacity is within a capacity threshold range corresponding to the minimum code rate until the electronic device detects that the network transmission quality of the preset wireless network is improved, that is, that the network transmission quality is not less than the first specified threshold, and the electronic device actively changes, for example, the first code rate is used.
Specifically, as shown in fig. 6, an embodiment of the present application provides a data transmission method, which is applied to the above-mentioned electronic device, where the electronic device is connected to a wireless audio playing device through a preset wireless network, for example, the wireless audio playing device may be a bluetooth headset, and the preset wireless network may be a bluetooth network, and specifically, the method includes: s601 to S610.
S601: and acquiring the Bluetooth transmission quality of the Bluetooth network in the process that the wireless audio playing equipment plays the target audio data with the code rate of 1, which is sent by the electronic equipment through the Bluetooth network.
As an implementation manner, the code rate 1 is not the aforementioned first code rate, specifically, the code rate 1 may be used as a second code rate, where the code rate 1 may be a default code rate for the electronic device to send the audio data through a preset wireless network, that is, after the electronic device and the wireless audio playing device establish the preset wireless network and the electronic device obtains the playing request, the electronic device uses the code rate 1 (i.e., the second code rate) to code the audio data and then sends the audio data to the wireless audio playing through the preset network, so that the wireless audio playing device plays the audio data. Then, the bluetooth transmission quality corresponding to the code rate 1 is recorded as the second network transmission quality.
S602: whether the bluetooth transmission quality drops to threshold 1.
Specifically, the bluetooth transmission quality at this time is recorded as a second network transmission quality, and the threshold 1 may be recorded as a second specified threshold, and if the second network transmission quality is not lower than the second specified threshold, it indicates that the current network environment is good, S603 may be performed, that is, the original code rate 1 transmission is maintained, that is, the target audio data is continuously transmitted using the second code rate.
S603: the original rate 1 transmission is maintained.
S604: whether the bluetooth transmission quality drops to threshold 2.
If the second network transmission quality is lower than the second specified threshold, that is, the bluetooth transmission quality is decreased to the threshold 1, which indicates that the network environment is not good, and at this time, if the second bitrate is continuously used, smooth playing of the target audio data may be caused, at this time, it is determined that the bluetooth transmission quality is decreased to the threshold 2, that is, the first specified threshold, and the second specified threshold is greater than the first specified threshold, that is, the threshold 1 is greater than the threshold 2, and if the bluetooth transmission quality is less than the threshold 1 and greater than the threshold 2, it indicates that the current network environment is poor, but the fluency of audio playing may still be ensured by simply decreasing the bitrate, so if the determination result of S604 is not decreased to the threshold 2, S605 is performed.
S605: down to the original rate 2 transmission.
And reducing the second code rate (original code rate 1) to a first code rate (original code rate 2), encoding data which is not sent in the target audio data at the first code rate, sending the target audio data encoded at the first code rate to the wireless audio playing equipment through the preset wireless network, so that the wireless audio playing equipment plays the target audio data encoded at the first code rate, and continuously acquiring the first network transmission quality of the preset wireless network.
S606: whether the bluetooth headset buffer capacity reaches a capacity threshold 1.
If the result of the determination in S604 is not yes, that is, the rate is decreased to the threshold 2, the rate of decrease simply depending on the bluetooth transmission quality cannot represent a real situation, and may cause an early/excessive rate of decrease, so that it is necessary to pay close attention to the buffer capacity of the bluetooth headset, that is, to obtain the target data capacity of the currently stored audio data to be played in the data buffer of the wireless audio playing device; and determining a target code rate based on the target data capacity.
It should be noted that, in the embodiment of the present application, the threshold 2 and the code rate 2 are higher than the default threshold and the default code rate of the bluetooth transmission protocol, and therefore, the code rate or the sound quality is not sacrificed too much.
S607: the code rate 2 transmission is maintained.
The capacity threshold 1 is the designated capacity threshold, and whether the target data capacity is smaller than the designated capacity threshold is judged; and if the first code rate is not less than the specified capacity threshold, the first code rate is used as a target code rate, namely, the code rate 2 transmission is kept, and if the first code rate is less than the specified capacity threshold, the target code rate is determined through the mapping relation. Then, if the network transmission quality of the preset wireless network is still smaller than a first specified threshold, acquiring the data capacity of the currently stored target audio data in the data buffer of the wireless audio playing device again as a new target data capacity, and if the new target data capacity is smaller than the specified capacity threshold, searching a target capacity threshold matched with the target data capacity in the mapping relationship again and taking the code rate corresponding to the target capacity threshold as a target code rate. That is, N capacity thresholds may be set, where the minimum capacity threshold is the capacity threshold N.
S608: whether the buffer capacity of the Bluetooth headset reaches a capacity threshold value n.
And judging whether the data capacity of the buffer of the Bluetooth headset reaches a capacity threshold n, if so, executing S610, namely transmitting by using the minimum code rate, and if not, executing S609, namely determining the target code rate through the preset relation.
S609: and determining a code rate corresponding to the capacity, and transmitting by using the code rate.
S610: and (4) transmission is carried out down to the minimum code rate.
And after the minimum code rate is reduced, outputting prompt information, wherein the prompt information is used for indicating that the preset wireless network cannot be suitable for playing the target audio data.
As shown in fig. 7, an embodiment of the present application provides a data transmission method, which is applied to the above-mentioned electronic device, where the electronic device is connected to a wireless audio playing device through a preset wireless network, for example, the wireless audio playing device may be a bluetooth headset, and the preset wireless network may be a bluetooth network, and specifically, the method includes: s701 to S706.
S701: and in the process that the wireless audio playing equipment plays the target audio data sent by the electronic equipment through the preset wireless network, acquiring the target data capacity of the audio data to be played, which is currently stored in a data buffer area of the wireless audio playing equipment.
As an implementation manner, in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network, the target data capacity of the currently stored audio data to be played in the data buffer of the wireless audio playing device may be obtained when a specified condition is met. The specified condition may be a specified time interval, that is, in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network, the target data capacity of the audio data to be played, which is currently stored in the data buffer of the wireless audio playing device, is obtained according to the specified time interval. In addition, the specified condition may be that the current network is switched, or that the network quality changes and the amount of change is greater than a specified amount of change.
S702: and acquiring a preset mapping relation, wherein the mapping relation comprises a plurality of capacity threshold ranges and code rates corresponding to the capacity threshold ranges.
S703: and searching a target capacity threshold value matched with the target data capacity in the mapping relation.
S704: and taking the code rate corresponding to the target capacity threshold as a target code rate.
As an embodiment, the mapping relationship may be different from the mapping relationship shown in fig. 5, specifically, the mapping relationship shown in fig. 5 is named as a first mapping relationship, each capacity threshold range in the first mapping relationship is smaller than the specified capacity threshold, each code rate in the first mapping relationship is lower than the first code rate, and the network environment of the first mapping relationship is that the network transmission quality is lower than a first specified threshold. The mapping relationship used in S702 may be named as a second mapping relationship, and the capacity threshold range in the second mapping relationship may not necessarily be lower than the specified capacity threshold and the code rate may not necessarily be lower than the code rate used by the electronic device in performing the step of S701.
As another embodiment, considering that the highest bit rate that can be used under different network transmission qualities in the same capacity threshold range, that is, the bit rate corresponding to each capacity threshold may be different, as shown in fig. 8, the mapping relationship further includes the network transmission qualities, that is, the second mapping relationship includes a plurality of network transmission qualities, each network transmission quality corresponds to a plurality of capacity thresholds and the bit rate corresponding to each capacity threshold, specifically, as shown in fig. 8, the capacity threshold range and the bit rate corresponding to the first quality range are characterized in that, in the case that the network transmission quality between the electronic device and the wireless audio playing device is the first quality range, the bit rate corresponding to each different capacity range is the maximum bit rate that can be used by the electronic device in order to ensure the fluency of the audio playing by the wireless audio playing device, that is, the playing is not stuck, in the case that the audio data to be played stored in the data buffer of the wireless audio playing device is the capacity range. In addition, the method for determining the target bitrate based on the mapping relationship may refer to the foregoing embodiment, and is not described herein again.
Of course, the first mapping relationship may also include a plurality of network transmission qualities as shown in fig. 8, except that the plurality of network transmission qualities need to be lower than the first specified threshold.
S705: and encoding the data which is not transmitted in the target audio data at the target code rate.
S706: and sending the specified audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
Therefore, the code rate can be adaptively adjusted based on the capacity of the data buffer of the wireless audio playing device in the embodiment of the application, which not only can reduce the code rate due to the deterioration of the network quality, but also can increase the code rate under the condition that the network environment is good or the code rate is not reasonably set.
Referring to fig. 9, a block diagram of a data transmission apparatus 900 according to an embodiment of the present application is shown, where the apparatus may include: acquisition unit 901, determination unit 902, encoding unit 903, and transmission unit 904.
An obtaining unit 901, configured to obtain a target data capacity of currently stored audio data to be played in a data buffer of the wireless audio playing device in a process that the wireless audio playing device plays target audio data sent by the electronic device through the preset wireless network, where data in the data buffer is removed after being played.
Further, the obtaining unit 901 is further configured to obtain a first network transmission quality of the preset wireless network when the wireless audio playing device plays the target audio data encoded at the first code rate and sent by the electronic device through the preset wireless network; and if the first network transmission quality is lower than a first specified threshold value, acquiring the target data capacity of the audio data to be played, which is currently stored in a data buffer area of the wireless audio playing device.
Further, the obtaining unit 901 is further configured to obtain a second network transmission quality of the preset wireless network in a process that the wireless audio playing device plays the target audio data with the second code rate sent by the electronic device through the preset wireless network; if the second network transmission quality is lower than a second specified threshold, encoding data which is not sent in the target audio data at the first code rate, wherein the second code rate is higher than the first code rate, and the second specified threshold is higher than the first specified threshold; reducing the second code rate to a first code rate, and encoding data which is not sent in the target audio data at the first code rate; and sending the target audio data coded with the first code rate to the wireless audio playing equipment through the preset wireless network so that the wireless audio playing equipment plays the target audio data coded with the first code rate and obtains the first network transmission quality of the preset wireless network.
A determining unit 902, configured to determine a target code rate based on the target data capacity, where the target data capacity is positively correlated to the second code rate.
Further, the determining unit 902 is further configured to determine whether the target data capacity is smaller than a specified capacity threshold; and if the first code rate is not smaller than the designated capacity threshold, taking the first code rate as a target code rate. If the capacity threshold is smaller than the designated capacity threshold, obtaining a preset mapping relation, wherein the mapping relation comprises a plurality of capacity threshold ranges and code rates corresponding to the capacity threshold ranges, each capacity threshold range in the mapping relation is smaller than the designated capacity threshold, each code rate is lower than the first code rate, and the capacity threshold ranges are positively correlated with the code rates; searching a target capacity threshold value matched with the target data capacity in the mapping relation; and taking the code rate corresponding to the target capacity threshold as a target code rate.
Further, the determining unit 902 is further configured to obtain a preset mapping relationship, where the mapping relationship includes a plurality of capacity threshold ranges and a code rate corresponding to each capacity threshold range, where the capacity threshold ranges are positively correlated with the code rates; searching a target capacity threshold value matched with the target data capacity in the mapping relation; and taking the code rate corresponding to the target capacity threshold value as a target code rate.
In the mapping relationship, the code rate corresponding to each capacity threshold range is used for representing that the playing fluency of the data to be played at the code rate played by the wireless audio playing device meets the use requirement under the condition that the data capacity of the data to be played stored by the wireless audio playing device is within the capacity threshold range.
An encoding unit 903, configured to encode data that is not sent in the target audio data at the target code rate.
A transmission unit 904, configured to send the specified audio data encoded with the target code rate to the wireless audio playing device through the preset wireless network.
Further, the data transmission apparatus 900 further includes a processing unit, configured to output a prompt message if the target code rate is the minimum code rate, where the prompt message is used to indicate that the preset wireless network cannot be applied to playing the target audio data. The wireless audio playing device is also used for acquiring the data capacity of the currently stored target audio data in the data buffer area of the wireless audio playing device again as a new target data capacity if the network transmission quality of the preset wireless network is still smaller than a first specified threshold; if the new target data capacity is smaller than the designated capacity threshold, searching a target capacity threshold matched with the target data capacity in the mapping relation again, and taking the code rate corresponding to the target capacity threshold as a target code rate until the target code rate is the minimum code rate or the network transmission quality of the preset wireless network is not smaller than the first designated threshold.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
Referring to fig. 10, a block diagram of an electronic device provided in an embodiment of the present application is shown. The electronic device 100 may be a smart phone, a tablet computer, an electronic book, or other electronic devices capable of running an application. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more programs configured to perform a method as described in the aforementioned method embodiments.
Processor 110 may include one or more processing cores. The processor 110 interfaces with various components throughout the electronic device 100 using various interfaces and lines to perform various functions of the electronic device 100 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120 and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware using at least one of Digital Signal Processing (DSP), field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 110 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 110, but may be implemented by a communication chip.
The Memory 120 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 120 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
Referring to fig. 11, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 1100 has stored therein program code that can be called by a processor to perform the method described in the above-described method embodiments.
The computer-readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 1100 includes a non-volatile computer-readable storage medium. The computer readable storage medium 1100 has storage space for program code 1110 for performing any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 1110 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (13)

1. A data transmission method is applied to electronic equipment, wherein the electronic equipment is connected with wireless audio playing equipment through a preset wireless network, and the method comprises the following steps:
in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network, acquiring the target data capacity of the currently stored audio data to be played in a data buffer area of the wireless audio playing device;
determining a target code rate based on the target data capacity, wherein the target data capacity is in positive correlation with the target code rate, and the target code rate is used for representing that the playing fluency of the wireless audio playing device for playing the data to be played with the code rate meets the use requirement under the condition that the data capacity of the data to be played, which is stored by the wireless audio playing device, is the target data capacity;
coding unsent data in the target audio data at the target code rate to obtain specified audio data;
and sending the specified audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
2. The method according to claim 1, wherein the obtaining of the target data capacity of the audio data to be played, which is currently stored in a data buffer of the wireless audio playing device, during the playing of the target audio data sent by the electronic device through the preset wireless network by the wireless audio playing device comprises:
acquiring first network transmission quality of a preset wireless network in the process that the wireless audio playing device plays target audio data which is sent by the electronic device through the preset wireless network and is coded at a first code rate;
and if the first network transmission quality is lower than a first specified threshold value, acquiring the target data capacity of the currently stored audio data to be played in the data buffer area of the wireless audio playing device.
3. The method of claim 2, wherein determining a target code rate based on the target data capacity comprises:
judging whether the target data capacity is smaller than a specified capacity threshold value;
and if the first code rate is not smaller than the specified capacity threshold, taking the first code rate as the target code rate.
4. The method of claim 3, further comprising:
if the capacity threshold is smaller than the designated capacity threshold, obtaining a preset mapping relation, wherein the mapping relation comprises a plurality of capacity threshold ranges and code rates corresponding to the capacity threshold ranges, each capacity threshold range in the mapping relation is smaller than the designated capacity threshold, each code rate is lower than the first code rate, and the capacity threshold ranges are positively correlated with the code rates;
searching a target capacity threshold value matched with the target data capacity in the mapping relation;
and taking the code rate corresponding to the target capacity threshold value as the target code rate.
5. The method according to claim 4, wherein after the taking the code rate corresponding to the target capacity threshold as the target code rate, further comprising:
and if the target code rate is the minimum code rate, outputting prompt information, wherein the prompt information is used for indicating that the preset wireless network cannot meet the requirement of smooth playing of the target audio data.
6. The method of claim 4, wherein after sending the specified audio data encoded at the target code rate to the wireless audio playback device through the preset wireless network, the method further comprises:
if the network transmission quality of the preset wireless network is still smaller than a first specified threshold value, acquiring the data capacity of the currently stored target audio data in the data buffer area of the wireless audio playing device again to serve as a new target data capacity;
if the new target data capacity is smaller than the designated capacity threshold, searching a target capacity threshold matched with the target data capacity in the mapping relation again, and taking the code rate corresponding to the target capacity threshold as a target code rate until the target code rate is the minimum code rate or the network transmission quality of the preset wireless network is not smaller than the first designated threshold.
7. The method of claim 1, wherein determining a target code rate based on the target data capacity comprises:
acquiring a preset mapping relation, wherein the mapping relation comprises a plurality of capacity threshold ranges and code rates corresponding to the capacity threshold ranges, and the capacity threshold ranges are positively correlated with the code rates;
searching a target capacity threshold value matched with the target data capacity in the mapping relation;
and taking the code rate corresponding to the target capacity threshold as a target code rate.
8. The method according to claim 4 or 7, wherein in the mapping relationship, the code rate corresponding to each capacity threshold range is used to characterize that, when the data capacity of the data to be played, which is stored in the wireless audio playing device, is in the capacity threshold range, the playing fluency of the data to be played, which is played by the wireless audio playing device at the code rate, meets the use requirement.
9. The method according to any one of claims 2 to 6, wherein the obtaining of the first network transmission quality of the preset wireless network during the process that the wireless audio playing device plays the target audio data encoded at the first code rate and sent by the electronic device through the preset wireless network comprises:
acquiring second network transmission quality of the preset wireless network in the process that the wireless audio playing device plays the target audio data which is sent by the electronic device through the preset wireless network and is coded at a second code rate;
if the second network transmission quality is lower than a second specified threshold, encoding data which is not sent in the target audio data at the first code rate, wherein the second code rate is higher than the first code rate, and the second specified threshold is higher than the first specified threshold;
reducing the second code rate to a first code rate, and encoding data which is not sent in the target audio data at the first code rate;
and sending the target audio data coded with the first code rate to the wireless audio playing equipment through the preset wireless network so that the wireless audio playing equipment plays the target audio data coded with the first code rate and obtains the first network transmission quality of the preset wireless network.
10. The method according to any one of claims 1 to 7, wherein the type of the target audio data is an audio data type, and the predetermined wireless network is a Bluetooth network.
11. A data transmission device is applied to electronic equipment, wherein the electronic equipment is connected with wireless audio playing equipment through a preset wireless network, and the device comprises:
the acquisition unit is used for acquiring the target data capacity of the audio data to be played, which is currently stored in the data buffer area of the wireless audio playing device, in the process that the wireless audio playing device plays the target audio data sent by the electronic device through the preset wireless network;
the determining unit is configured to determine a target code rate based on the target data capacity, where the target data capacity is positively correlated with the target code rate, and the target code rate is used to indicate that, when the data capacity of the to-be-played data stored in the wireless audio playing device is the target data capacity, the playing fluency at which the wireless audio playing device plays the to-be-played data at the code rate meets a use requirement;
the coding unit is used for coding the data which is not sent in the target audio data at the target code rate to obtain the specified audio data;
and the transmission unit is used for transmitting the specified audio data coded with the target code rate to the wireless audio playing equipment through the preset wireless network.
12. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to perform the method of any of claims 1-10.
13. A computer-readable medium having stored program code executable by a processor, the program code causing the processor to perform the method of any one of claims 1-10 when executed by the processor.
CN202210772322.2A 2022-06-30 2022-06-30 Data transmission method and device, electronic equipment and computer readable medium Pending CN115174538A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210772322.2A CN115174538A (en) 2022-06-30 2022-06-30 Data transmission method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210772322.2A CN115174538A (en) 2022-06-30 2022-06-30 Data transmission method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN115174538A true CN115174538A (en) 2022-10-11

Family

ID=83488560

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210772322.2A Pending CN115174538A (en) 2022-06-30 2022-06-30 Data transmission method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN115174538A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016208215A (en) * 2015-04-21 2016-12-08 ソニー株式会社 Transmitter, transmission method and program
CN109150399A (en) * 2018-08-14 2019-01-04 Oppo广东移动通信有限公司 Data transmission method, device, electronic equipment and computer-readable medium
CN109461450A (en) * 2018-11-01 2019-03-12 恒玄科技(上海)有限公司 Transmission method, system, storage medium and the bluetooth headset of audio data
CN109600610A (en) * 2018-11-12 2019-04-09 深圳市景阳科技股份有限公司 A kind of data-encoding scheme and terminal
CN111417000A (en) * 2020-03-27 2020-07-14 北京奇艺世纪科技有限公司 Method, device, electronic equipment and medium for switching video code rate
CN112671742A (en) * 2020-12-17 2021-04-16 北京百度网讯科技有限公司 Audio card pause processing method and device, electronic equipment and storage medium
CN112822521A (en) * 2020-12-30 2021-05-18 百果园技术(新加坡)有限公司 Code rate control method, device and equipment for audio and video transmission and storage medium
CN114173426A (en) * 2021-11-30 2022-03-11 广州番禺巨大汽车音响设备有限公司 Wireless sound box playing control method, device and system based on wireless audio transmission

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016208215A (en) * 2015-04-21 2016-12-08 ソニー株式会社 Transmitter, transmission method and program
CN109150399A (en) * 2018-08-14 2019-01-04 Oppo广东移动通信有限公司 Data transmission method, device, electronic equipment and computer-readable medium
CN109461450A (en) * 2018-11-01 2019-03-12 恒玄科技(上海)有限公司 Transmission method, system, storage medium and the bluetooth headset of audio data
CN109600610A (en) * 2018-11-12 2019-04-09 深圳市景阳科技股份有限公司 A kind of data-encoding scheme and terminal
CN111417000A (en) * 2020-03-27 2020-07-14 北京奇艺世纪科技有限公司 Method, device, electronic equipment and medium for switching video code rate
CN112671742A (en) * 2020-12-17 2021-04-16 北京百度网讯科技有限公司 Audio card pause processing method and device, electronic equipment and storage medium
CN112822521A (en) * 2020-12-30 2021-05-18 百果园技术(新加坡)有限公司 Code rate control method, device and equipment for audio and video transmission and storage medium
CN114173426A (en) * 2021-11-30 2022-03-11 广州番禺巨大汽车音响设备有限公司 Wireless sound box playing control method, device and system based on wireless audio transmission

Similar Documents

Publication Publication Date Title
JP7302006B2 (en) Methods for operating Bluetooth devices
JP4426454B2 (en) Delay trade-off between communication links
US7680099B2 (en) Jitter buffer adjustment
US20160191181A1 (en) Audio broadcast retransmissions
JP4894476B2 (en) Voice transmitter and mobile communication terminal
CN110010139B (en) Audio input/output method, system and computer readable storage medium
US8977202B2 (en) Communication apparatus having a unit to determine whether a profile is operating
CN109461450B (en) Audio data transmission method, system, storage medium and Bluetooth headset
WO2014172689A1 (en) Asynchronously streaming high quality audio of a live event from a handheld device
CN111527733B (en) Control bimodulus bluetooth low energy consumption multimedia device
CN113453114B (en) Encoding control method, encoding control device, wireless headset and storage medium
CN109413525B (en) Encoding rate adjustment method, encoding rate adjustment device, electronic device, and storage medium
WO2021160040A1 (en) Audio transmission method and electronic device
CN111313984B (en) Testing device and method for various audio codes of Bluetooth headset
KR20110066083A (en) Method of objet transmission between devices with multiple wireless interface
WO2014154065A2 (en) Data transmission method, media acquisition device, video conference terminal and storage medium
EP3745813A1 (en) Method for operating a bluetooth device
US20210224024A1 (en) Bluetooth audio system with low latency, and audio source and audio sink thereof
EP2553914A1 (en) Transcoder bypass in mobile handset for voip call with bluetooth headsets
WO2020232631A1 (en) Voice frequency division transmission method, source terminal, playback terminal, source terminal circuit and playback terminal circuit
CN115174538A (en) Data transmission method and device, electronic equipment and computer readable medium
US11581002B2 (en) Communication method, apparatus, and system for digital enhanced cordless telecommunications (DECT) base station
JP4496755B2 (en) COMMUNICATION PROCESSING DEVICE, COMMUNICATION PROCESSING METHOD, AND COMPUTER PROGRAM
CN109150400B (en) Data transmission method and device, electronic equipment and computer readable medium
JP4432257B2 (en) Image / audio information communication system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination