Detailed Description
The following description of the embodiments of the present application will be made more apparent and fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments of the application are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
The embodiment of the application provides a data transmission method, a data transmission device, electronic equipment and a storage medium. Specifically, the embodiment of the application provides a data transmitting device suitable for electronic equipment, wherein the electronic equipment can be a terminal or a server and other equipment. The terminal can be equipment with a voice broadcasting function, such as an air conditioner, a smart phone, a smart television, a sound box, a loudspeaker and the like. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs, content Delivery Network), basic cloud computing services such as big data and artificial intelligent platforms, and the servers may be directly or indirectly connected through wired or wireless communication modes.
It may be understood that the data transmission method in the embodiment of the present application may be performed on a terminal, may be performed on a server, or may be performed jointly by the terminal and the server.
For example, referring to fig. 1, in the embodiment of the present application, a method for jointly executing a data transmission by a terminal and a server is taken as an example, where other devices may be added to assist in completing the data transmission method on the basis of the terminal and the server, and the types of the other devices are not limited herein, and the specific execution process between the terminal and the server is as follows:
the main control chip in the terminal equipment A acquires the audio data from the server B, decodes the acquired audio data and then sends the decoded audio data to the voice chip of the terminal equipment A, and the voice chip broadcasts the decoded audio data.
When the main control chip sends the decoded audio data, the decoded audio data is sent to the voice chip (playing end) according to the data packet with the preset playing time length and the preset time interval in the first stage, and then the second stage is sent after the modified node is reached, wherein when the second stage is sent, the time interval for sending the data packet is adjusted to be the same as the playing time length corresponding to the data packet, so that the time length for the voice chip to receive the audio data and the time length for playing the audio data in the second stage are balanced, and the audio data sending in the second stage is maintained until all the data packets are sent.
The time interval for sending the audio data in the first stage is smaller than the playing time corresponding to the data packet, and the audio data with fixed playing time length is sequentially stored in the voice chip, so that the voice chip is ensured to continuously store the audio data in the whole broadcasting process, and the fluency of audio broadcasting is ensured.
After continuously storing the audio data with a fixed playing duration, the available storage space in the voice chip is smaller and smaller, so as to avoid the overflow of the data in the storage space and further cause the abnormality such as noise and the like in the audio data broadcasting, the modification node of the time interval can be determined according to the capacity of the storage space of the voice chip, for example, when the storage space is full is determined according to the transmission time interval and the playing duration of the first stage and the memory of the storage space, and the full time is the modification node corresponding to the transmission time interval.
The time interval for transmitting the audio data, the playing time of the data packet and the memory of the voice chip in the first stage are determined, so that the modification node can be predetermined, the time interval for transmitting the audio data is automatically triggered after the modification node is reached, the control process for transmitting the audio data is automatically completed, real-time transmission of the available capacity of the buffer space is not needed in the process, the control complexity of the transmission process is reduced, and the transmission bandwidth is saved.
The embodiment of the application divides the audio data transmission into a first stage and a second stage, in the first stage, the time interval for transmitting the audio is set to be smaller than the playing time length of each data packet, so that the playing end can still store the audio data with a certain playing time length after playing the data in each time interval, the phenomenon of blocking caused by the lack of the data of the playing end is avoided, in the second stage, the modifying node of the time interval is determined according to the total storage time length of the caching space of the playing end and the time interval and the playing time length of the data packet in the first stage, and in the modifying node, the time interval and the playing time length are adjusted to be the same, so that the playing end receives and plays the audio data to reach the balance of input and output, the overflow of the caching space data is prevented, the audio data is stored in the caching space is ensured, and the smooth playing of the audio of the playing end is realized.
The following will describe in detail. It should be noted that the following description order of embodiments is not a limitation of the priority order of embodiments.
Referring to fig. 2, fig. 2 is a flowchart of a data transmission method according to an embodiment of the application. The specific flow of the data transmission method can be as follows:
101. And sending the decoded audio data to a playing end according to the data packet with the preset playing duration and the preset initial time interval, wherein the preset initial time interval is smaller than the preset playing duration.
The method comprises the steps that a data packet with preset playing time length refers to audio data to be transmitted according to the fixed playing time length, and the audio data with the fixed playing time length is sequentially sent to a playing end based on a preset initial time interval, wherein the playing end can broadcast the decoded audio data after receiving the decoded audio data.
The preset playing duration and the preset initial time interval can be flexibly set according to actual needs, and are not limited herein, wherein in the embodiment of the application, the preset initial time interval is set to be smaller than the preset playing duration, so that the playing duration of the playing end is smaller than the playing duration of the received audio data in each time interval, the playing end can still store part of the audio data to be played with the remaining duration after receiving the data each time and playing the audio data in the time interval, and the playing end can continuously and stably superimpose the audio data with the fixed playing duration, so that the playing end can smoothly play.
In the embodiment of the application, the audio data is transmitted according to the data segments (data packets) with fixed playing time length, the sequence of the audio data broadcasting frames is not broken, and the audio data is still transmitted according to the sequence, and the playing end also broadcasts according to the broadcasting frames of the audio data when broadcasting the audio data, that is, the audio data received in each interval is not broadcast in real time, for example, the audio data output mode of the broadcasting end is similar to the first-in first-out mode in the queue.
Wherein, since the audio data consumes a part of time on the transmission link during the transmission process, the time interval for actually starting to transmit the data needs to be actually adjusted for the consumed time on the transmission link, that is, optionally, in some embodiments, the method further includes:
acquiring consumed time of audio data in the transmission process of the audio data on a data transmission link;
determining an actual transmission time interval for actually transmitting the audio data according to a preset initial time interval and consumed time;
The step of transmitting the decoded audio data to the playing end according to the data packet with the preset playing duration and the preset initial time interval may specifically include:
and transmitting the decoded audio data to a playing end according to the data packet with the preset playing duration, the actual transmitting time interval and the data transmission link.
In the embodiment of the application, the preset initial time interval is set according to the time when the playing end receives the audio data, and the preset initial time interval and the preset playing time length reach a certain balance according to the preset initial time interval, but after the sending end sends the data, the audio data can be transmitted on the data transmission link for a certain time in the transmission process, so that the time actually received by the receiving end is influenced by the transmission time of the audio data.
102. And determining the total storage time length of the audio data which can be stored in the cache space of the playing end.
Because the time interval of audio data transmission is smaller than the playing time length, audio data with a certain playing time length can be continuously overlapped and accumulated in the buffer space of the playing end, but the memory of the buffer space is fixed, so that when the buffer space is full of audio data (modifying nodes), the audio data is required to be adjusted and sent, and overflow of the audio data in the buffer space is prevented.
Because the audio data is transmitted according to a fixed time interval and a fixed playing time length, the total storage time length capable of storing the audio data in the buffer memory space of the playing end is required to be determined, the time interval for transmitting the audio data is adjusted according to the total storage time length, and a reference basis is provided for the subsequent balance of the audio data receiving and the audio data broadcasting of the playing end.
The playing time length of the audio data that can be stored in the buffer space is different for the audio data with different data formats and code rates, so that the playing time length that the buffer space can buffer the audio data can be determined according to the formats and the code rates of the audio data, that is, optionally, in some embodiments, the step of determining the total storage time length of the audio data that can be stored in the buffer space of the playing end includes:
acquiring a data format and a code rate of audio data and a memory of a cache space;
and determining the total storage duration of the audio data stored in the buffer memory space according to the memory, the data format and the code rate.
The data format and the code rate of the audio data are important parameters for judging the time length of the buffer space capable of storing the audio data, but the method is not limited to the fact that the total storage time length is judged only through the data format and the code rate, wherein corresponding judging conditions or factors can be added for achieving higher accuracy of the total storage time length.
Among them, the data format of the audio data includes moving picture experts compression standard audio layer 3 (MP 3, moving Picture Experts Group Audio Layer III), moving picture experts group (MPEG, moving Pictures Experts Group), or window media audio (WMA, windows Media Audio), etc.
103. And determining a modification node for modifying the preset initial time interval according to the preset initial time interval, the preset playing time length and the total storage time length.
The modification node is a node which is to be full of audio data in the cache space, and after the node is reached, the modification node can prevent the overflow of the audio data in the cache space by triggering the adjustment of the preset initial time interval, so that the playing end can smoothly broadcast the audio data.
The specific node where the audio data is stored in the buffer space can be determined by the time interval for sending the audio data, the playing time of the data packet and the total storage time of the buffer space.
Specifically, in the embodiment of the present application, by sending the time interval of the audio data and the playing duration of the data packet, the single accumulated and overlapped audio data playing duration in the buffer space in each time interval may be determined, and by overlapping the playing duration and the total storage duration of the buffer space, the node full of the audio data in the buffer space may be determined, where the node is a modification node that is expected to adjust the time interval of sending the audio data in the embodiment of the present application, that is, optionally, in some embodiments, the step of "determining a modification node for modifying the preset initial time interval" includes:
determining the superposition playing time length of superposition of the audio data to be played in the buffer space in each preset initial time interval according to the preset initial time interval and the preset playing time length;
And determining a modification node for modifying the preset initial time interval according to the superimposed playing time length and the total storage time length.
The overlapping playing duration can be obtained by calculating a difference value between a preset playing duration and a preset initial time interval, for example, the audio data is sent at 30ms intervals, the playing duration corresponding to the data packet is 60ms, the audio data is broadcasted for 30ms in each interval time, and the audio data with the duration of 30ms is overlapped in the buffer space.
The node full of the buffer space can be determined by superposing the playing time length of each time interval and the total storage time length of the buffer space, and the node is the modification node expected to be adjusted in the embodiment of the application.
Wherein, the modifying node may be a number of times of sending the audio data, that is, the number of times of sending the audio data according to the preset initial time interval, that is, optionally, in some embodiments, the step of "determining a modifying node for modifying the preset initial time interval" includes:
determining the critical sending times of the data packet according to the overlapped playing time length and the total storage time length;
And determining the target transmission times of the data packet according to the critical transmission times, wherein the target transmission times are smaller than or equal to the critical transmission times.
After the overlapping playing time length and the total storage time length are determined, the maximum sending times (critical sending times) of the audio data which can be sent can be determined, namely, when the maximum sending times are reached, the buffer space is full of the audio data because of the overlapping playing time length, therefore, the target sending times can be determined according to the critical sending times, the condition that the audio data overflows in the buffer space after the audio data are sent according to the target sending times cannot occur, namely, the target sending times are selected to be smaller than or equal to the critical sending times.
Therefore, after the audio data is sent according to the preset initial time interval and the preset playing time length, the preset initial time interval can be adjusted after the number of times of sending the audio data reaches the target sending number of times, so that overflow of the audio data in the buffer space is prevented, and smooth playing of the audio data at the playing end is ensured.
In the embodiment of the application, the transmission times only need to be recorded, and the transmission is controlled according to the recording result, and the available space data of the buffer space transmitted by the playing end does not need to be received in the transmission process, so that the occupation of the transmission bandwidth of the audio data is reduced, and meanwhile, the complexity of the transmission control of the audio data is also reduced.
The memory size of the buffer space is fixed, and the playing time length corresponding to the audio data sent by each time interval is also fixed, so that the total time length of the audio data sent by the sending end can be determined when the buffer space is about to be full of data, and the total time length of the audio data sent by the sending end can be used as a modification node for adjusting the preset initial time interval when the buffer space is about to be full;
That is, the modification node may also be an audio data total duration corresponding to the audio data sent by the sending end, and when the audio data total duration sent by the sending end reaches a certain value, the adjustment and modification of the preset initial time interval are performed, that is, optionally, in some embodiments, the step of "determining a modification node for modifying the preset initial time interval" includes:
determining the critical sending times of the data packet according to the overlapped playing time length and the total storage time length;
Determining critical accumulated sending duration for sending the data packet according to the critical sending times and the preset playing duration;
And determining the total time length of the transmittable data according to the critical accumulated transmission time length, wherein the total time length of the transmittable data is smaller than or equal to the critical accumulated transmission time length.
The total transmittable data duration (i.e., the total transmittable data duration) may be determined according to the number of times of transmission of the audio data and the playing duration of the audio data transmitted each time when the buffer space is full, for example, the product of the number of times of transmission and the playing duration of the audio data transmitted each time is taken as the total transmittable data duration (total transmittable data duration) of the transmitting end when the buffer space is full, which is understood as that after the transmitting end transmits the audio data of the total transmittable data duration to the playing end, the buffer space of the playing end will be full of the audio data.
The total time length of the transmittable data can be determined according to the preset playing time length of the data packet and the total storage time of the buffer space before the audio data is transmitted, so that the time interval for transmitting the audio data can be adjusted and controlled according to the actual time length of the transmitting end for transmitting the audio data, adjustment judgment is not needed according to feedback of the playing end, and transmission bandwidth occupied by the feedback process is saved.
104. And at the modification node, modifying the preset initial time interval into a preset playing duration.
The node is modified, namely, the node with the full cache space of the playing end is adjusted to be the same as the preset playing time length, so that the playing end can realize the balance of receiving audio data and playing the audio data, namely, the playing time length of the audio data added by the playing end in one time interval is equal to the playing time length corresponding to the audio data played in the time interval, and the smoothness of audio broadcasting is achieved while the overflow of the audio data is prevented.
The balance of receiving and broadcasting by the broadcasting terminal can be achieved only by adjusting the preset initial time interval to be the same as the preset broadcasting time length, so in the embodiment of the application, the preset broadcasting time length can be adjusted at the modification node, that is, optionally, in some embodiments, the method further comprises:
Modifying the preset playing time length to obtain a preset playing modification time length, wherein the preset playing modification time length is longer or shorter than the preset playing time length;
Then, the step of "determining a modification node for modifying the preset initial time interval" includes:
And modifying the preset initial time interval into a preset play modification time length.
The preset playing duration may be adjusted to be the same as the preset initial time interval, or the preset playing duration may be adjusted to be other values, and then the preset initial time interval is correspondingly adjusted.
The above adjustment method for the preset initial time interval increases flexibility of realization of fluency of the audio data.
105. And sending the data packets to the playing end according to the modified preset initial time interval until all the data packets are sent completely.
According to the adjusted preset initial time interval, audio data are sent to the playing end, so that the playing end can achieve balance of input and output during audio data receiving and playing and time reporting, overflow of the audio data is prevented, and fluency of the audio data playing and reporting of the playing end is improved.
The embodiment of the application divides the audio data transmission into a first stage and a second stage, in the first stage, the time interval for transmitting the audio is set to be smaller than the playing time length of each data packet, so that the playing end can still store the audio data with a certain playing time length after playing the data in each time interval, the phenomenon of blocking caused by the lack of the data by the playing end is avoided, in the second stage, the modifying node of the time interval is determined according to the total storage time length of the caching space of the playing end and the time interval and the playing time length of the data packet in the first stage, and in the modifying node, the time interval and the playing time length are adjusted to be the same, so that the playing end receives and plays the audio data to reach the balance of input and output, the overflow of the caching space data is prevented, the audio data is stored in the caching space is ensured, the smooth playing of the audio of the playing end is realized, the determining of the modifying node is not required to be determined according to the real-time feedback of the playing end, and the occupation of the audio data transmission bandwidth is reduced.
In order to facilitate better implementation of the data transmission method, the application also provides a data transmission device based on the data transmission method. Wherein the meaning of the nouns is the same as in the data transmission method, and specific implementation details can refer to the description in the method embodiment.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a data transmission device provided by the present application, where the data transmission device may include an initial transmission module 201, a duration determination module 202, a node determination module 203, a modification interval module 204, and a target transmission module 205, and may specifically be as follows:
The initial sending module 201 is configured to send the decoded audio data to the playing end according to a data packet with a preset playing duration and a preset initial time interval, where the preset initial time interval is smaller than the preset playing duration.
The method comprises the steps that a data packet with preset playing time length refers to audio data to be transmitted according to the fixed playing time length, and the audio data with the fixed playing time length is sequentially sent to a playing end based on a preset initial time interval, wherein the playing end can broadcast the decoded audio data after receiving the decoded audio data.
The preset playing duration and the preset initial time interval can be flexibly set according to actual needs, and are not limited herein, wherein in the embodiment of the application, the preset initial time interval is set to be smaller than the preset playing duration, so that the playing duration of the playing end is smaller than the playing duration of the received audio data in each time interval, the playing end can still store part of the audio data to be played with the remaining duration after receiving the data each time and playing the audio data in the time interval, and the playing end can continuously and stably superimpose the audio data with the fixed playing duration, so that the playing end can smoothly play.
Optionally, in some embodiments of the present invention, the apparatus further comprises:
The first acquisition unit is used for acquiring the consumed time of the audio data in the transmission process of the data transmission link;
A third determining unit, configured to determine an actual transmission time interval in which audio data is actually required to be transmitted according to a preset initial time interval and a consumed time;
An initial transmission module, comprising:
and the sending unit is used for sending the decoded audio data to the playing end according to the data packet with the preset playing time length, the actual sending time interval and the data transmission link.
In the embodiment of the application, the preset initial time interval is set according to the time when the playing end receives the audio data, and the preset initial time interval and the preset playing time length reach a certain balance according to the preset initial time interval, but after the sending end sends the data, the audio data can be transmitted on the data transmission link for a certain time in the transmission process, so that the time actually received by the receiving end is influenced by the transmission time of the audio data.
The duration determining module 202 is configured to determine a total storage duration of storable audio data in a buffer space of the playing end.
Because the time interval of audio data transmission is smaller than the playing time length, audio data with a certain playing time length can be continuously overlapped and accumulated in the buffer space of the playing end, but the memory of the buffer space is fixed, so that when the buffer space is full of audio data (modifying nodes), the audio data is required to be adjusted and sent, and overflow of the audio data in the buffer space is prevented.
Because the audio data is transmitted according to a fixed time interval and a fixed playing time length, the total storage time length capable of storing the audio data in the buffer memory space of the playing end is required to be determined, the time interval for transmitting the audio data is adjusted according to the total storage time length, and a reference basis is provided for the subsequent balance of the audio data receiving and the audio data broadcasting of the playing end.
Optionally, in some embodiments of the present invention, the duration determination module:
The second acquisition unit is used for acquiring the data format and the code rate of the audio data and the memory of the cache space;
and the fourth determining unit is used for determining the total storage duration of the audio data which can be stored in the buffer memory space according to the memory, the data format and the code rate.
The playing time length of the audio data which can be stored in the buffer space is different for the audio data with different data formats and code rates, so that the playing time length of the audio data which can be buffered in the buffer space can be determined according to the formats and the code rates of the audio data.
The node determining module 203 is configured to determine a modification node for modifying the preset initial time interval according to the preset initial time interval, the preset playing duration, and the total storage duration.
The modification node is a node which is to be full of audio data in the cache space, and after the node is reached, the modification node can prevent the overflow of the audio data in the cache space by triggering the adjustment of the preset initial time interval, so that the playing end can smoothly broadcast the audio data.
The specific node where the audio data is stored in the buffer space can be determined by the time interval for sending the audio data, the playing time of the data packet and the total storage time of the buffer space.
Optionally, in some embodiments of the present invention, the node determining module includes:
The first determining unit is used for determining the superposition playing time length of the superposition of the audio data to be played in the buffer space in each preset initial time interval according to the preset initial time interval and the preset playing time length;
And the second determining unit is used for determining a modification node for modifying the preset initial time interval according to the overlapped playing time length and the total storage time length.
The overlapping playing duration can be obtained by calculating a difference value between a preset playing duration and a preset initial time interval, for example, the audio data is sent at 30ms intervals, the playing duration corresponding to the data packet is 60ms, the audio data is broadcasted for 30ms in each interval time, and the audio data with the duration of 30ms is overlapped in the buffer space.
The node full of the buffer space can be determined by superposing the playing time length of each time interval and the total storage time length of the buffer space, and the node is the modification node expected to be adjusted in the embodiment of the application.
Optionally, in some embodiments of the present invention, the modifying node includes accumulating a target number of transmissions of the transmitted data packet, and the second determining unit includes:
The first determining subunit is used for determining the critical sending times of the data packet according to the overlapped playing time length and the total storage time length;
And the second determining subunit is used for determining the target sending times of sending the data packet according to the critical sending times, wherein the target sending times are smaller than or equal to the critical sending times.
After the overlapping playing time length and the total storage time length are determined, the maximum sending times (critical sending times) of the audio data which can be sent can be determined, namely, when the maximum sending times are reached, the buffer space is full of the audio data because of the overlapping playing time length, therefore, the target sending times can be determined according to the critical sending times, the condition that the audio data overflows in the buffer space after the audio data are sent according to the target sending times cannot occur, namely, the target sending times are selected to be smaller than or equal to the critical sending times.
Therefore, after the audio data is sent according to the preset initial time interval and the preset playing time length, the preset initial time interval can be adjusted after the number of times of sending the audio data reaches the target sending number of times, so that overflow of the audio data in the buffer space is prevented, and smooth playing of the audio data at the playing end is ensured.
In the embodiment of the application, the transmission times only need to be recorded, and the transmission is controlled according to the recording result, and the available space data of the buffer space transmitted by the playing end does not need to be received in the transmission process, so that the occupation of the transmission bandwidth of the audio data is reduced, and meanwhile, the complexity of the transmission control of the audio data is also reduced.
Optionally, in some embodiments of the present invention, the modification node includes a total transmittable data duration corresponding to transmittable audio data, and the second determining unit includes:
A third determining subunit, configured to determine a critical sending number of times that the data packet can be sent according to the overlapping playing duration and the total storage duration;
a fourth determining subunit, configured to determine a critical cumulative sending duration that the data packet can be sent according to the critical sending times and a preset playing duration;
And the fifth determining subunit is used for determining the total time length of the transmittable data according to the critical accumulated transmission time length, wherein the total time length of the transmittable data is smaller than or equal to the critical accumulated transmission time length.
The total transmittable data duration (i.e., the total transmittable data duration) may be determined according to the number of times of transmission of the audio data and the playing duration of the audio data transmitted each time when the buffer space is full, for example, the product of the number of times of transmission and the playing duration of the audio data transmitted each time is taken as the total transmittable data duration (total transmittable data duration) of the transmitting end when the buffer space is full, which is understood as that after the transmitting end transmits the audio data of the total transmittable data duration to the playing end, the buffer space of the playing end will be full of the audio data.
The total time length of the transmittable data can be determined according to the preset playing time length of the data packet and the total storage time of the buffer space before the audio data is transmitted, so that the time interval for transmitting the audio data can be adjusted and controlled according to the actual time length of the transmitting end for transmitting the audio data, adjustment judgment is not needed according to feedback of the playing end, and transmission bandwidth occupied by the feedback process is saved.
The modification interval module 204 is configured to modify, at the modification node, the preset initial time interval to a preset play duration.
The node is modified, namely, the node with the full cache space of the playing end is adjusted to be the same as the preset playing time length, so that the playing end can realize the balance of receiving audio data and playing the audio data, namely, the playing time length of the audio data added by the playing end in one time interval is equal to the playing time length corresponding to the audio data played in the time interval, and the smoothness of audio broadcasting is achieved while the overflow of the audio data is prevented.
Optionally, in some embodiments of the present invention, the apparatus further comprises:
The first modification unit is used for modifying the preset playing time length to obtain a preset playing modification time length, wherein the preset playing modification time length is longer than or smaller than the preset playing time length;
the modification interval module includes:
and the second modification unit is used for modifying the preset initial time interval into a preset play modification duration.
The preset playing duration may be adjusted to be the same as the preset initial time interval, or the preset playing duration may be adjusted to be other values, and then the preset initial time interval is correspondingly adjusted.
The above adjustment method for the preset initial time interval increases flexibility of realization of fluency of the audio data.
The target sending module 205 is configured to send data packets to the playing end according to the modified preset initial time interval until all the data packets are sent completely.
According to the adjusted preset initial time interval, audio data are sent to the playing end, so that the playing end can achieve balance of input and output during audio data receiving and playing and time reporting, overflow of the audio data is prevented, and fluency of the audio data playing and reporting of the playing end is improved.
In the embodiment of the application, the initial sending module 201 sends the decoded audio data to the playing end according to the data packet with the preset playing time length and the preset initial time interval, the time length determining module 202 obtains the total storage time length capable of storing the audio data in the buffer space of the playing end, the node determining module 203 determines the modification node for modifying the preset initial time interval according to the preset initial time interval, the preset playing time length and the total storage time length, the modification interval module 204 modifies the preset initial time interval at the modification node to keep the preset initial time interval identical with the preset playing time length, and finally the target sending module 205 sends the data packet to the playing end according to the modified preset initial time interval until all the data packets are completely sent.
The embodiment of the application divides the audio data transmission into a first stage and a second stage, in the first stage, the time interval for transmitting the audio is set to be smaller than the playing time length of each data packet, so that the playing end can still store the audio data with a certain playing time length after playing the data in each time interval, the phenomenon of blocking caused by the lack of the data of the playing end is avoided, in the second stage, the modifying node of the time interval is determined according to the total storage time length of the caching space of the playing end and the time interval and the playing time length of the data packet in the first stage, and in the modifying node, the time interval and the playing time length are adjusted to be the same, so that the playing end receives and plays the audio data to achieve the balance of input and output, the overflow of the caching space data is prevented, the audio data is stored in the caching space is ensured, the smooth playing of the audio of the playing end is realized, the determining of the modifying node is not required to be determined according to the real-time feedback of the playing end, and the occupation of the transmission bandwidth of the audio data is reduced.
In addition, the application further provides an electronic device, as shown in fig. 4, which shows a schematic structural diagram of the electronic device according to the application, specifically:
The electronic device may include one or more processing cores 'processors 401, one or more computer-readable storage media's memory 402, power supply 403, and input unit 404, among other components. Those skilled in the art will appreciate that the electronic device structure shown in fig. 4 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components. Wherein:
The processor 401 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 402, and calling data stored in the memory 402, thereby performing overall monitoring of the electronic device. Optionally, the processor 401 may include one or more processing cores, and preferably the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, an application program, etc., and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by executing the software programs and modules stored in the memory 402. The memory 402 may mainly include a storage program area that may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), etc., and a storage data area that may store data created according to the use of the electronic device, etc. In addition, memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
The electronic device further comprises a power supply 403 for supplying power to the various components, preferably the power supply 403 may be logically connected to the processor 401 by a power management system, so that functions of managing charging, discharging, and power consumption are performed by the power management system. The power supply 403 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may further comprise an input unit 404, which input unit 404 may be used for receiving input digital or character information and generating keyboard, mouse, joystick, optical or trackball signal inputs in connection with user settings and function control.
Although not shown, the electronic device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 401 in the electronic device loads executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 executes the application programs stored in the memory 402, so as to implement various functions as follows:
The method comprises the steps of sending decoded audio data to a playing end according to a data packet with preset playing time length and a preset initial time interval, determining the total storage time length of the audio data which can be stored in a buffer space of the playing end, determining a modifying node for modifying the preset initial time interval according to the preset initial time interval, the preset playing time length and the total storage time length, modifying the preset initial time interval to the preset playing time length at the modifying node, and sending the data packet to the playing end according to the modified preset initial time interval until all data packets are sent completely.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
The embodiment of the application divides the audio data transmission into a first stage and a second stage, in the first stage, the time interval for transmitting the audio is set to be smaller than the playing time length of each data packet, so that the playing end can still store the audio data with a certain playing time length after playing the data in each time interval, the phenomenon of blocking caused by the lack of the data by the playing end is avoided, in the second stage, the modifying node of the time interval is determined according to the total storage time length of the caching space of the playing end and the time interval and the playing time length of the data packet in the first stage, and in the modifying node, the time interval and the playing time length are adjusted to be the same, so that the playing end receives and plays the audio data to reach the balance of input and output, the overflow of the caching space data is prevented, the audio data is stored in the caching space is ensured, the smooth playing of the audio of the playing end is realized, the determining of the modifying node is not required to be determined according to the real-time feedback of the playing end, and the occupation of the audio data transmission bandwidth is reduced.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer readable storage medium having stored thereon a computer program that can be loaded by a processor to perform the steps of any of the data transmission methods provided by the present application. For example, the instructions may perform the steps of:
The method comprises the steps of sending decoded audio data to a playing end according to a data packet with preset playing time length and a preset initial time interval, determining the total storage time length of the audio data which can be stored in a buffer space of the playing end, determining a modifying node for modifying the preset initial time interval according to the preset initial time interval, the preset playing time length and the total storage time length, modifying the preset initial time interval to the preset playing time length at the modifying node, and sending the data packet to the playing end according to the modified preset initial time interval until all data packets are sent completely.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
The storage medium may include a Read Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or the like.
The instructions stored in the storage medium can execute any step in the data transmission provided by the present application, so that the beneficial effects of any data transmission method provided by the present application can be achieved, and detailed descriptions of the foregoing embodiments are omitted herein.
The foregoing describes a data transmission method, apparatus, electronic device and storage medium in detail, and specific examples are provided herein to illustrate the principles and embodiments of the present application, and the above examples are provided to assist in understanding the method and core ideas of the present application, and meanwhile, to those skilled in the art, according to the ideas of the present application, there are various changes in the specific embodiments and application scope, so that the disclosure should not be construed as limiting the present application.