CN109584889B - Audio transmission method and device and storage medium - Google Patents

Audio transmission method and device and storage medium Download PDF

Info

Publication number
CN109584889B
CN109584889B CN201811626607.5A CN201811626607A CN109584889B CN 109584889 B CN109584889 B CN 109584889B CN 201811626607 A CN201811626607 A CN 201811626607A CN 109584889 B CN109584889 B CN 109584889B
Authority
CN
China
Prior art keywords
audio data
target
data packet
size
current
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.)
Active
Application number
CN201811626607.5A
Other languages
Chinese (zh)
Other versions
CN109584889A (en
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.)
Miaozhen Information Technology Co Ltd
Original Assignee
Miaozhen Information Technology Co 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 Miaozhen Information Technology Co Ltd filed Critical Miaozhen Information Technology Co Ltd
Priority to CN201811626607.5A priority Critical patent/CN109584889B/en
Publication of CN109584889A publication Critical patent/CN109584889A/en
Application granted granted Critical
Publication of CN109584889B publication Critical patent/CN109584889B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L19/00Speech or audio signals analysis-synthesis techniques for redundancy reduction, e.g. in vocoders; Coding or decoding of speech or audio signals, using source filter models or psychoacoustic analysis
    • G10L19/002Dynamic bit allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0006Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Computational Linguistics (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Quality & Reliability (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses an audio transmission method and device and a storage medium. Wherein, the method comprises the following steps: acquiring the size of audio data of a current audio data packet to be transmitted, wherein the audio data packet is obtained by splitting a target audio to be transmitted in real time; detecting the size of target data allowed to be transmitted by a current transmission network in a unit time period; determining a target compression ratio required for compressing the audio data packet according to the comparison result of the audio data size and the target data size; compressing the audio data packet according to the target compression ratio to obtain a compressed audio data packet; and transmitting the compressed audio data packet through the current transmission network. The invention solves the technical problem of low audio transmission efficiency in the method provided by the related technology.

Description

Audio transmission method and device and storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to an audio transmission method and apparatus, and a storage medium.
Background
Many recording devices with networking capability need to upload recorded audio to a server in real time, so that the server can process the audio in time. At present, in the process of audio transmission, if the audio to be transmitted is compressed by adopting a low compression ratio, although better tone quality can be kept, during transmission, recorded audio cannot be uploaded to a server in time due to poor network transmission condition. If the high compression ratio is adopted for audio compression, the sound quality is damaged greatly, and a part of the recorded content is lost.
That is, in the audio transmission method provided in the related art, only a single compression method can be used for compressing the audio to be transmitted, and the flexibility of audio compression is poor, so that the audio cannot be transmitted in time, thereby causing a problem of low audio transmission efficiency.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides an audio transmission method, an audio transmission device and a storage medium, which are used for at least solving the technical problem of low audio transmission efficiency in the methods provided by the related technologies.
According to an aspect of an embodiment of the present invention, there is provided an audio transmission method including: acquiring the size of audio data of a current audio data packet to be transmitted, wherein the audio data packet is obtained by splitting a target audio to be transmitted in real time; detecting the size of target data allowed to be transmitted by a current transmission network in a unit time period; determining a target compression ratio required for compressing the audio data packet according to a comparison result of the size of the audio data and the size of the target data; compressing the audio data packet according to the target compression ratio to obtain the compressed audio data packet; and transmitting the compressed audio data packet through the current transmission network.
As an optional example, the determining a target compression ratio required for compressing the audio data packet according to the comparison result between the audio data size and the target data size includes: under the condition that the size of the audio data is larger than that of the target data, acquiring a target transmission proportion between the size of the audio data and the size of the target data; and determining the target compression ratio of the audio data packet according to the target transmission ratio.
As an optional example, the determining the target compression ratio of the audio data packet according to the target transmission ratio includes: repeatedly executing the following steps until the size of the audio data of the compressed audio data packet is smaller than or equal to the size of the target data: acquiring a current compression ratio; determining the current audio data size of the audio data packet obtained after the current compression proportion is adopted for compression; acquiring the current ratio between the current audio data size and the target data size; when the current ratio is larger than the target transmission ratio, determining that the size of the compressed audio data of the audio data packet is still larger than the target data size, and adjusting the current compression ratio according to a target step length to obtain a next compression ratio as the current compression ratio; and determining the current compression ratio as the target compression ratio when determining that the audio data size of the compressed audio data packet is smaller than or equal to the target data size under the condition that the current ratio is smaller than or equal to the target transmission ratio.
As an optional example, before the obtaining the audio data size of the audio data packet to be currently transmitted, the method further includes: recording the target audio to be transmitted in real time; and splitting the target audio to obtain a plurality of audio data packets to be transmitted.
As an optional example, before the transmitting the compressed audio data packet through the current transmission network, the method further includes: distributing data packet identification for the audio data packet; and adding the data packet identifier into the audio data packet so that the server decompresses the received audio data packet and merges the audio data packet according to the data packet identifier to obtain the target audio.
As an optional example, after the transmitting the compressed audio data packet through the current transmission network, the method further includes: the server decompresses the received audio data packet; and the server merges the decompressed audio data packets to obtain the target audio.
According to another aspect of the embodiments of the present invention, there is also provided an audio transmission apparatus, including: the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the size of audio data of an audio data packet to be transmitted currently, wherein the audio data packet is obtained by splitting a target audio to be transmitted in real time; the detection unit is used for detecting the size of target data allowed to be transmitted by a current transmission network in a unit time period; a determining unit, configured to determine a target compression ratio required for compressing the audio data packet according to a comparison result between the size of the audio data and the size of the target data; a compressing unit, configured to compress the audio data packet according to the target compression ratio to obtain a compressed audio data packet; and the transmission unit is used for transmitting the compressed audio data packet through the current transmission network.
As an optional example, the determining unit includes: an obtaining module, configured to obtain a target transmission ratio between the size of the audio data and the size of the target data when the size of the audio data is larger than the size of the target data; and the determining module is used for determining the target compression ratio of the audio data packet according to the target transmission ratio.
As an optional example, the determining module includes: a processing submodule, configured to repeatedly execute the following steps until the size of the compressed audio data of the audio data packet is smaller than or equal to the size of the target data: acquiring a current compression ratio; determining the current audio data size of the audio data packet obtained after the current compression proportion is adopted for compression; acquiring the current ratio between the current audio data size and the target data size; when the current ratio is larger than the target transmission ratio, determining that the size of the compressed audio data of the audio data packet is still larger than the target data size, and adjusting the current compression ratio according to a target step length to obtain a next compression ratio as the current compression ratio; and determining the current compression ratio as the target compression ratio when determining that the audio data size of the compressed audio data packet is smaller than or equal to the target data size under the condition that the current ratio is smaller than or equal to the target transmission ratio.
As an optional example, the apparatus further includes: a recording unit, configured to record the target audio to be transmitted in real time before the size of the audio data of the current audio data packet to be transmitted is obtained; and the splitting unit is used for splitting the target audio to obtain a plurality of audio data packets to be transmitted.
As an optional example, the apparatus further includes: a distribution unit, configured to distribute a packet identifier to the audio data packet before the compressed audio data packet is transmitted through the current transmission network; and the adding unit is used for adding the data packet identifier into the audio data packet so that the server decompresses the received audio data packet and merges the audio data packet according to the data packet identifier to obtain the target audio.
According to yet another aspect of the embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-mentioned audio transmission method when running.
In the embodiment of the invention, the recorded target audio is split to obtain the audio data packet, and then the audio data packet is compressed according to the target compression ratio according to the condition of the current transmission network (such as the size of target data allowed to be transmitted in a unit time period), so that the compression ratio of the audio data packet to be transmitted is dynamically adjusted according to the transmission condition of the current network, the flexibility of audio transmission is improved, a plurality of audio data in the target audio can be transmitted in time, the efficiency of audio transmission is improved, the aim of balancing the quality and the real-time performance of audio transmission is fulfilled, and the technical problem of low audio transmission efficiency in the method provided by the related technology is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of an alternative audio transmission method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of an alternative audio transmission method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an alternative audio transmission arrangement according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another alternative audio transmission device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiments of the present invention, there is provided an audio transmission method, optionally, as an optional implementation manner, as shown in fig. 1, the audio transmission method includes:
s102, acquiring the size of audio data of a current audio data packet to be transmitted, wherein the audio data packet is obtained by splitting a target audio to be transmitted in real time;
s104, detecting the size of target data allowed to be transmitted by the current transmission network in a unit time period;
s106, determining a target compression ratio required for compressing the audio data packet according to the comparison result of the audio data size and the target data size;
s108, compressing the audio data packet according to the target compression ratio to obtain a compressed audio data packet;
and S110, transmitting the compressed audio data packet through the current transmission network.
Optionally, in this embodiment, the audio transmission method may be applied, but not limited to, an audio recording device with networking capability. The method provided by the embodiment splits the recorded target audio to obtain the audio data packet, and then compresses the audio data packet according to the target compression ratio according to the condition of the current transmission network (such as the size of target data allowed to be transmitted in a unit time period), so that the compression ratio of the audio data packet to be transmitted is dynamically adjusted according to the transmission condition of the current network, the flexibility of audio transmission is improved, a plurality of audio data in the target audio can be transmitted in time, the efficiency of audio transmission is improved, the purpose of balancing the quality and the real-time performance of audio transmission is achieved, and the problem of low audio transmission efficiency in the related technology is solved.
Optionally, in this embodiment, before obtaining the size of the audio data of the current audio data packet to be transmitted, the target audio to be transmitted in real time may be recorded, but is not limited to being recorded; and splitting the target audio to obtain a plurality of audio data packets to be transmitted.
It should be noted that, in this embodiment, the recorded target audio may be, but is not limited to, original lossless audio recorded in real time for an audio recording device with a networking function. Wherein, the audio recording device may further include but is not limited to: communication interface, memory and processor. The memory may be, but is not limited to, used for buffering the recorded original lossless audio, and the processor may be, but is not limited to, used for splitting the original lossless audio into a plurality of audio data packets, and may also be, but is not limited to, used for performing compression processing on the audio data packets. The communication interface may be, but is not limited to, for transmitting the compressed audio data packet to the server through the current transmission network.
Optionally, in this embodiment, determining the target compression ratio required for compressing the audio data packet according to the comparison result between the audio data size and the target data size may include, but is not limited to:
1) under the condition that the size of the audio data is smaller than or equal to the size of the target data, the audio data packet to be transmitted is not compressed;
2) and under the condition that the size of the audio data is larger than that of the target data, acquiring a target transmission proportion between the size of the audio data and the size of the target data, and determining a target compression proportion according to the target transmission proportion.
It should be noted that, in the scheme provided in this embodiment, the target compression ratio adapted to the audio data packet is determined by comparing the size of the audio data packet to be transmitted with the size of the target data allowed to be transmitted by the current transmission network in a unit time period. Therefore, after the target compression ratio is adopted for compression, the audio data packet which has a certain balance between the tone quality and the data size can be obtained. In other words, the determined target compression ratio can control the size of the audio data of the compressed audio data packet to be as close to the size of the target data as possible, so that the transmission capacity of the current transmission network is fully utilized, and the purpose of real-time transmission can be achieved on the basis of ensuring certain tone quality.
Further, in the present embodiment, the target compression ratio may be, but not limited to, a compression ratio for instructing to compress the audio packet to satisfy the network condition of the current transmission network. It should be noted that different compression ratios may correspond to different compression formats, but are not limited to the different compression formats. That is, the corresponding compression ratio may be determined by determining the compression format used to transmit the audio data packets. The above is merely an example, and this is not limited in this embodiment.
Optionally, in this embodiment, for the multiple audio data packets obtained after the target audio splitting, the target compression ratio of the corresponding audio data packet may be determined, but is not limited to, according to a target transmission ratio of a transmission network when each audio data packet is transmitted. In other words, the target compression of different audio packets may be determined to be different values, but not limited to, according to different network conditions.
Optionally, in this embodiment, transmitting the compressed audio data packet may include, but is not limited to:
1) under the condition that the current transmission network adopts long connection transmission, the server receives the compressed audio data packets in sequence, so that the target audio can be obtained by combining the audio data packets in sequence after the received audio data packets are analyzed.
2) Under the condition that the current transmission network does not adopt long connection transmission, a data packet identifier (such as a serial number) needs to be added in the audio data packet, so that after the server receives the audio data packet, whether the packet is lost or not can be detected according to the data packet identifier, and the received audio data packet can be combined according to the data packet identifier to obtain the target audio.
According to the embodiment provided by the application, the recorded target audio is split to obtain the audio data packet, and then the audio data packet is compressed according to the target compression ratio according to the condition of the current transmission network (such as the size of target data allowed to be transmitted in a unit time period), so that the compression ratio of the audio data packet to be transmitted is dynamically adjusted according to the transmission condition of the current network, the flexibility of audio transmission is improved, a plurality of audio data in the target audio can be transmitted in time, the efficiency of audio transmission is improved, the purpose of balancing the audio transmission quality and the transmission real-time performance is achieved, and the problem of low audio transmission efficiency in the related technology is solved.
As an optional scheme, determining a target compression ratio required for compressing the audio data packet according to a comparison result between the audio data size and the target data size includes:
s1, under the condition that the size of the audio data is larger than that of the target data, acquiring a target transmission proportion between the size of the audio data and the size of the target data;
and S2, determining the target compression ratio of the audio data packet according to the target transmission ratio.
Optionally, in this embodiment, determining the target compression ratio of the audio data packet according to the target transmission ratio includes: repeatedly executing the following steps until the size of the audio data of the compressed audio data packet is smaller than or equal to the size of the target data:
s11, acquiring the current compression ratio;
s12, determining the current audio data size of the audio data packet obtained by compression according to the current compression ratio;
s13, acquiring the current ratio between the current audio data size and the target data size;
s14, when the current proportion is larger than the target transmission proportion, determining that the audio data size of the compressed audio data packet is still larger than the target data size, and adjusting the current compression proportion according to the target step length to obtain the next compression proportion as the current compression proportion;
and S15, determining the current compression ratio as the target compression ratio when determining that the audio data size of the compressed audio data packet is smaller than or equal to the target data size under the condition that the current ratio is smaller than or equal to the target transmission ratio.
It should be noted that, in order to balance the sound quality and the real-time performance of audio data packet transmission, the scheme provided in this embodiment may, but is not limited to, sequentially adjust the compression ratio according to a predetermined step size through the above-mentioned loop process. After the current ratio between the current audio data size and the target data size obtained after the audio data packet is compressed by the current compression ratio is obtained, the target compression ratio matched with the audio data packet to be transmitted is determined by comparing the current ratio with the target transmission ratio. Therefore, the distortion problem caused by the audio compression process is reduced as much as possible on the basis of ensuring the real-time performance of audio transmission.
Optionally, in this embodiment, the compression ratio may correspond to, but is not limited to, one compression format. In other words, in the process of determining the target compression ratio through the loop step, the compression format used may be adjusted, but not limited to, when the current compression ratio is adjusted, so as to determine the target compression format (having the target compression ratio) whose compression ratio is adapted to the network condition of the current transmission network by adopting a different compression format.
According to the embodiment provided by the application, the current compression ratio is repeatedly obtained to determine whether the size of the audio data packet compressed by the current compression ratio is smaller than or equal to the size of the target data, so that the distortion problem caused by the audio compression process can be reduced as much as possible on the basis of ensuring the real-time performance of transmission of the audio data packet.
As an optional scheme, before transmitting the compressed audio data packet through the current transmission network, the method further includes:
s1, distributing data packet identification for the audio data packet;
and S2, adding the data packet identifier to the audio data packet, so that the server decompresses the received audio data packet and then merges the audio data packet according to the data packet identifier to obtain the target audio.
It should be noted that the packet identifier may include, but is not limited to: the serial number of the audio data packet, the ID of the audio data packet, the random code, etc. The above is merely an example, and the identifier for uniquely distinguishing the audio data packet is applicable to the present embodiment, and is not limited herein.
Optionally, in this embodiment, after the compressed audio data packet is transmitted through the current transmission network, the server decompresses the received audio data packet, and combines the decompressed audio data packets to obtain the target audio.
The description is made with reference to the example shown in fig. 2:
step 1: the target audio (original lossless audio) to be transmitted in real time is recorded by the audio recording module and stored in the audio recording device.
Step 2: and splitting the target audio into a plurality of audio data packets to be transmitted through an audio unpacking module.
And step 3: and the network speed detection module is used for detecting the size of target data allowed to be transmitted in a unit time period by the current transmission network at regular time, namely the network speed. The network speed is detected at predetermined intervals. Before updating the detected wire speed, the audio data packet to be transmitted may be compressed, but not limited to, with the newly determined target compression ratio.
And 4, step 4: and determining a target compression ratio matched with the current audio data packet to be transmitted according to the network speed of the current transmission network through an audio compression module. And compressing the audio data packet by adopting the target compression ratio to obtain the compressed audio data packet.
It should be noted that, the target audio is divided into a plurality of audio data packets, and the target compression ratio of different audio data packets may be, but is not limited to, flexibly and dynamically adjusted according to the current network speed of the transmission network. In other words, the target compression of different audio packets may be determined to be different values, but not limited to, according to different network conditions.
For example, it is assumed that in order to realize real-time transmission of audio data, it is necessary to transmit audio data having a duration of at least 1 second in 1 second through the network. Further, assume that the network speed (the size of the target data allowed to be transmitted in a unit time period) of the current transmission network is: n Kbytes/s, and the audio data size of 1 second lossless audio is: m Kbytes.
And further comparing the size of the audio data with the network speed, and not compressing the audio data when M is less than or equal to n. And under the condition that M is larger than n, acquiring a target transmission ratio between the audio data size and the network speed: m/n. In order to meet the requirement of real-time transmission, the ratio between the size of the compressed audio data and the network speed is less than or equal to the target transmission ratio M/n.
Therefore, when M is larger than n, the compression ratio needs to be adjusted in sequence according to the predetermined step size, so as to finally and accurately determine the target compression ratio. The ratio between the size of the audio data compressed by the target compression ratio and the network speed is not only less than or equal to the target transmission ratio M/n, but also as close to the target transmission ratio M/n as possible. Therefore, the requirement of real-time transmission is guaranteed, the tone quality loss of the audio caused by compression is reduced, and the balance between the audio quality and the real-time performance of audio transmission is achieved.
And 5: and sending the compressed audio data packet through a network transmission module.
When the current transmission network does not use a long connection (e.g., UDP) for transmission, the audio data packets need to be added with packet identifiers (e.g., sequence numbers) to ensure that the servers can receive the audio data packets in sequence and combine the audio data packets to obtain the target audio. In addition, whether packet loss occurs in the transmission process can be detected through the data packet identification. However, when the current transmission network uses a long connection (e.g., UDP) for transmission, there is no out-of-order transmission, and the audio data packet may not be added with a packet identifier (e.g., a sequence number). The transmission control procedure is an example, and the present embodiment does not limit this.
The steps 1 to 5 and the corresponding modules may be, but are not limited to, applied to a terminal device, where the terminal device is configured to obtain a recorded target audio, such as an audio recording device. Such as a voice pen, a voice recorder, etc.
Step 6: and the audio merging module of the server side merges the decompressed audio data packets after receiving the compressed audio data packets so as to obtain complete target audio. Further, the decompressed audio data packets may be subjected to unified format conversion, such as unified conversion into wav format audio, and then combined to obtain wav format target audio. This is not limited in this embodiment.
It should be noted that the audio data packet may or may not carry the target compression ratio corresponding thereto, and the server-side decompression algorithm automatically determines the target compression ratio according to the compressed data format.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiment of the present invention, there is also provided an audio transmission apparatus for implementing the audio transmission method described above. As shown in fig. 3, the apparatus includes:
1) an obtaining unit 302, configured to obtain the size of audio data of a current audio data packet to be transmitted, where the audio data packet is obtained by splitting a target audio that is transmitted in real time;
2) a detecting unit 304, configured to detect a size of target data that is allowed to be transmitted by a current transmission network in a unit time period;
3) a determining unit 306, configured to determine a target compression ratio required for compressing the audio data packet according to a comparison result between the size of the audio data and the size of the target data;
4) the compressing unit 308 is configured to compress the audio data packet according to the target compression ratio to obtain a compressed audio data packet;
5) a transmission unit 310, configured to transmit the compressed audio data packet through the current transmission network.
Optionally, in this embodiment, the audio transmission apparatus may be applied, but not limited to, an audio recording device with networking capability. The device provided in this embodiment splits the recorded target audio to obtain an audio data packet, and then compresses the audio data packet according to a target compression ratio according to the condition of the current transmission network (for example, the size of target data allowed to be transmitted in a unit time period), thereby implementing dynamic adjustment of the compression ratio of the audio data packet to be transmitted according to the transmission condition of the current network, thereby improving the flexibility of audio transmission, so that a plurality of audio data in the target audio can be transmitted in time, improving the efficiency of audio transmission, achieving the purpose of balancing the quality and real-time performance of audio transmission, and further overcoming the problem of low audio transmission efficiency in the related art.
Optionally, in this embodiment, the apparatus further includes: the recording unit is used for recording target audio to be transmitted in real time before the size of the audio data of the current audio data packet to be transmitted is acquired; and the splitting unit is used for splitting the target audio to obtain a plurality of audio data packets to be transmitted.
It should be noted that, in this embodiment, the recorded target audio may be, but is not limited to, original lossless audio recorded in real time for an audio recording device with a networking function. Wherein, the audio recording device may further include but is not limited to: communication interface, memory and processor. The memory may be, but is not limited to, used for buffering the recorded original lossless audio, and the processor may be, but is not limited to, used for splitting the original lossless audio into a plurality of audio data packets, and may also be, but is not limited to, used for performing compression processing on the audio data packets. The communication interface may be, but is not limited to, for transmitting the compressed audio data packet to the server through the current transmission network.
Optionally, in this embodiment, determining the target compression ratio required for compressing the audio data packet according to the comparison result between the audio data size and the target data size may include, but is not limited to:
1) under the condition that the size of the audio data is smaller than or equal to the size of the target data, the audio data packet to be transmitted is not compressed;
2) and under the condition that the size of the audio data is larger than that of the target data, acquiring a target transmission proportion between the size of the audio data and the size of the target data, and determining a target compression proportion according to the target transmission proportion.
It should be noted that, in the scheme provided in this embodiment, the target compression ratio adapted to the audio data packet is determined by comparing the size of the audio data packet to be transmitted with the size of the target data allowed to be transmitted by the current transmission network in a unit time period. Therefore, after the target compression ratio is adopted for compression, the audio data packet which has a certain balance between the tone quality and the data size can be obtained. In other words, the determined target compression ratio can control the size of the audio data of the compressed audio data packet to be as close to the size of the target data as possible, so that the transmission capacity of the current transmission network is fully utilized, and the purpose of real-time transmission can be achieved on the basis of ensuring certain tone quality.
Further, in the present embodiment, the target compression ratio may be, but not limited to, a compression ratio for instructing to compress the audio packet to satisfy the network condition of the current transmission network. It should be noted that different compression ratios may correspond to different compression formats, but are not limited to the different compression formats. That is, the corresponding compression ratio may be determined by determining the compression format used to transmit the audio data packets. The above is merely an example, and this is not limited in this embodiment.
Optionally, in this embodiment, for the multiple audio data packets obtained after the target audio splitting, the target compression ratio of the corresponding audio data packet may be determined, but is not limited to, according to a target transmission ratio of a transmission network when each audio data packet is transmitted. In other words, the target compression of different audio packets may be determined to be different values, but not limited to, according to different network conditions.
Optionally, in this embodiment, transmitting the compressed audio data packet may include, but is not limited to:
1) under the condition that the current transmission network adopts long connection transmission, the server receives the compressed audio data packets in sequence, so that the target audio can be obtained by combining the audio data packets in sequence after the received audio data packets are analyzed.
2) Under the condition that the current transmission network does not adopt long connection transmission, a data packet identifier (such as a serial number) needs to be added in the audio data packet, so that after the server receives the audio data packet, whether the packet is lost or not can be detected according to the data packet identifier, and the received audio data packet can be combined according to the data packet identifier to obtain the target audio.
According to the embodiment provided by the application, the recorded target audio is split to obtain the audio data packet, and then the audio data packet is compressed according to the target compression ratio according to the condition of the current transmission network (such as the size of target data allowed to be transmitted in a unit time period), so that the compression ratio of the audio data packet to be transmitted is dynamically adjusted according to the transmission condition of the current network, the flexibility of audio transmission is improved, a plurality of audio data in the target audio can be transmitted in time, the efficiency of audio transmission is improved, the purpose of balancing the audio transmission quality and the transmission real-time performance is achieved, and the problem of low audio transmission efficiency in the related technology is solved.
As an alternative, as shown in fig. 4, the determining unit 306 includes:
1) an obtaining module 402, configured to obtain a target transmission ratio between the size of the audio data and the size of the target data when the size of the audio data is larger than the size of the target data;
2) a determining module 404, configured to determine a target compression ratio of the audio data packet according to the target transmission ratio.
Optionally, in this embodiment, the determining module includes:
(1) the processing submodule is used for repeatedly executing the following steps until the size of the audio data of the compressed audio data packet is smaller than or equal to the size of the target data:
s1, acquiring the current compression ratio;
s2, determining the current audio data size of the audio data packet obtained by compression according to the current compression ratio;
s3, acquiring the current ratio between the current audio data size and the target data size;
s4, when the current proportion is larger than the target transmission proportion, determining that the audio data size of the compressed audio data packet is still larger than the target data size, and adjusting the current compression proportion according to the target step length to obtain the next compression proportion as the current compression proportion;
and S5, determining the current compression ratio as the target compression ratio when determining that the audio data size of the compressed audio data packet is smaller than or equal to the target data size under the condition that the current ratio is smaller than or equal to the target transmission ratio.
It should be noted that, in order to balance the sound quality and the real-time performance of audio data packet transmission, the scheme provided in this embodiment may, but is not limited to, sequentially adjust the compression ratio according to a predetermined step size through the above-mentioned loop process. After the current ratio between the current audio data size and the target data size obtained after the audio data packet is compressed by the current compression ratio is obtained, the target compression ratio matched with the audio data packet to be transmitted is determined by comparing the current ratio with the target transmission ratio. Therefore, the distortion problem caused by the audio compression process is reduced as much as possible on the basis of ensuring the real-time performance of audio transmission.
Optionally, in this embodiment, the compression ratio may correspond to, but is not limited to, one compression format. In other words, in the process of determining the target compression ratio through the loop step, the compression format used may be adjusted, but not limited to, when the current compression ratio is adjusted, so as to determine the target compression format (having the target compression ratio) whose compression ratio is adapted to the network condition of the current transmission network by adopting a different compression format.
According to the embodiment provided by the application, the current compression ratio is repeatedly obtained to determine whether the size of the audio data packet compressed by the current compression ratio is smaller than or equal to the size of the target data, so that the distortion problem caused by the audio compression process can be reduced as much as possible on the basis of ensuring the real-time performance of transmission of the audio data packet.
As an optional solution, the apparatus further includes:
1) the distribution unit is used for distributing data packet identification for the audio data packet before the compressed audio data packet is transmitted through the current transmission network;
2) and the adding unit is used for adding the data packet identifier into the audio data packet so that the server decompresses the received audio data packet and then merges the audio data packet according to the data packet identifier to obtain the target audio.
It should be noted that the packet identifier may include, but is not limited to: the serial number of the audio data packet, the ID of the audio data packet, the random code, etc. The above is merely an example, and the identifier for uniquely distinguishing the audio data packet is applicable to the present embodiment, and is not limited herein.
Optionally, in this embodiment, after the compressed audio data packet is transmitted through the current transmission network, the server decompresses the received audio data packet, and combines the decompressed audio data packets to obtain the target audio.
Each functional unit in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
According to a further aspect of embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, obtaining the size of the audio data of the current audio data packet to be transmitted, wherein the audio data packet is obtained by splitting a target audio to be transmitted in real time;
s2, detecting the size of the target data allowed to be transmitted by the current transmission network in unit time period;
s3, determining a target compression ratio needed by compressing the audio data packet according to the comparison result of the audio data size and the target data size;
s4, compressing the audio data packet according to the target compression ratio to obtain a compressed audio data packet;
and S5, transmitting the compressed audio data packet through the current transmission network.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (12)

1. An audio transmission method, comprising:
acquiring the size of audio data of a current audio data packet to be transmitted, wherein the audio data packet is obtained by splitting a target audio to be transmitted in real time;
detecting the size of target data allowed to be transmitted by a current transmission network in a unit time period;
according to the comparison result of the audio data size and the target data size, adjusting the current compression ratio according to a target step length to determine a target compression ratio, wherein the target step length is a preset step length used for adjusting the compression ratio in sequence;
calling a target compression format corresponding to the target compression ratio, and compressing the audio data packet according to the target compression ratio to obtain the compressed audio data packet;
and transmitting the compressed audio data packet through the current transmission network.
2. The method of claim 1, wherein adjusting the current compression ratio by the target step size to determine the target compression ratio required for compressing the audio data packet comprises:
under the condition that the size of the audio data is larger than that of the target data, acquiring a target transmission proportion between the size of the audio data and the size of the target data;
and determining the target compression ratio of the audio data packet according to the target transmission ratio.
3. The method of claim 2, wherein the determining the target compression ratio for the audio data packets according to the target transmission ratio comprises:
repeatedly executing the following steps until the audio data size of the compressed audio data packet is smaller than or equal to the target data size:
acquiring the current compression ratio;
determining the current audio data size of the audio data packet obtained after the current compression proportion is adopted for compression;
acquiring the current ratio between the current audio data size and the target data size;
when the current proportion is larger than the target transmission proportion, determining that the size of the audio data of the compressed audio data packet is still larger than the size of the target data, and adjusting the current compression proportion according to a target step length to obtain a next compression proportion as the current compression proportion;
and under the condition that the current proportion is smaller than or equal to the target transmission proportion, determining that the size of the audio data of the compressed audio data packet is smaller than or equal to the target data size, and determining the current compression proportion as the target compression proportion.
4. The method according to claim 1, wherein before the obtaining the audio data size of the audio data packet to be currently transmitted, the method further comprises:
recording the target audio to be transmitted in real time;
and splitting the target audio to obtain a plurality of audio data packets to be transmitted.
5. The method of claim 1, further comprising, prior to said transmitting the compressed audio data packet over the current transport network:
distributing a data packet identifier for the audio data packet;
and adding the data packet identification into the audio data packet so that the server merges the audio data packet according to the data packet identification to obtain the target audio after decompressing the received audio data packet.
6. The method of claim 1, further comprising, after said transmitting the compressed audio data packet over the current transport network:
the server decompresses the received audio data packet;
and the server merges the decompressed audio data packets to obtain the target audio.
7. An audio transmission device, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the size of audio data of an audio data packet to be transmitted currently, and the audio data packet is obtained by splitting a target audio to be transmitted in real time;
the detection unit is used for detecting the size of target data allowed to be transmitted by a current transmission network in a unit time period;
a determining unit, configured to adjust a current compression ratio according to a target step size according to a comparison result between the size of the audio data and the size of the target data to determine a target compression ratio required for compressing the audio data packet, where the target step size is a preset step size used for sequentially adjusting the compression ratio;
the compression unit is used for calling a target compression format corresponding to the target compression ratio and compressing the audio data packet according to the target compression ratio to obtain the compressed audio data packet;
and the transmission unit is used for transmitting the compressed audio data packet through the current transmission network.
8. The apparatus of claim 7, wherein the determining unit comprises:
the acquisition module is used for acquiring a target transmission proportion between the size of the audio data and the size of the target data under the condition that the size of the audio data is larger than the size of the target data;
a determining module, configured to determine the target compression ratio of the audio data packet according to the target transmission ratio.
9. The apparatus of claim 8, wherein the determining module comprises:
a processing submodule, configured to repeatedly execute the following steps until the size of the audio data of the compressed audio data packet is smaller than or equal to the size of the target data:
acquiring the current compression ratio;
determining the current audio data size of the audio data packet obtained after the current compression proportion is adopted for compression;
acquiring the current ratio between the current audio data size and the target data size;
when the current proportion is larger than the target transmission proportion, determining that the size of the audio data of the compressed audio data packet is still larger than the size of the target data, and adjusting the current compression proportion according to a target step length to obtain a next compression proportion as the current compression proportion;
and under the condition that the current proportion is smaller than or equal to the target transmission proportion, determining that the size of the audio data of the compressed audio data packet is smaller than or equal to the target data size, and determining the current compression proportion as the target compression proportion.
10. The apparatus of claim 7, further comprising:
the recording unit is used for recording the target audio to be transmitted in real time before the size of the audio data of the current audio data packet to be transmitted is obtained;
and the splitting unit is used for splitting the target audio to obtain a plurality of audio data packets to be transmitted.
11. The apparatus of claim 7, further comprising:
a distribution unit, configured to distribute a packet identifier to the audio data packet before the compressed audio data packet is transmitted through the current transmission network;
and the adding unit is used for adding the data packet identifier into the audio data packet so that the server decompresses the received audio data packet and then merges the audio data packet according to the data packet identifier to obtain the target audio.
12. A storage medium comprising a stored program, wherein the program when executed performs the method of any of claims 1 to 6.
CN201811626607.5A 2018-12-28 2018-12-28 Audio transmission method and device and storage medium Active CN109584889B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811626607.5A CN109584889B (en) 2018-12-28 2018-12-28 Audio transmission method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811626607.5A CN109584889B (en) 2018-12-28 2018-12-28 Audio transmission method and device and storage medium

Publications (2)

Publication Number Publication Date
CN109584889A CN109584889A (en) 2019-04-05
CN109584889B true CN109584889B (en) 2021-07-20

Family

ID=65933391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811626607.5A Active CN109584889B (en) 2018-12-28 2018-12-28 Audio transmission method and device and storage medium

Country Status (1)

Country Link
CN (1) CN109584889B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111432384B (en) * 2020-03-18 2023-05-09 合肥讯飞读写科技有限公司 Large-data-volume audio Bluetooth real-time transmission method for equipment with recording function
CN112887429A (en) * 2021-03-08 2021-06-01 深圳市车宝信息科技有限公司 Data transmission method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105139859A (en) * 2015-08-18 2015-12-09 杭州士兰微电子股份有限公司 Audio data decoding method, audio data decoding device and SOC using audio data decoding method
CN106209773A (en) * 2016-06-24 2016-12-07 深圳羚羊极速科技有限公司 The method that the sampling transmission of a kind of audio packet is recombinated again

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459616A (en) * 2009-01-04 2009-06-17 成都市华为赛门铁克科技有限公司 Method, customer terminal and access system for network access
EP3063916B1 (en) * 2013-10-29 2020-01-22 Telefonaktiebolaget LM Ericsson (publ) Dynamic compression coverage
KR102244612B1 (en) * 2014-04-21 2021-04-26 삼성전자주식회사 Appratus and method for transmitting and receiving voice data in wireless communication system
CN106161633B (en) * 2016-07-20 2020-05-05 柏科数据技术(深圳)股份有限公司 Transmission method and system for packed files based on cloud computing environment
CN108738006B (en) * 2018-05-31 2021-06-25 出门问问信息科技有限公司 Data transmission method and device based on Bluetooth

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105139859A (en) * 2015-08-18 2015-12-09 杭州士兰微电子股份有限公司 Audio data decoding method, audio data decoding device and SOC using audio data decoding method
CN106209773A (en) * 2016-06-24 2016-12-07 深圳羚羊极速科技有限公司 The method that the sampling transmission of a kind of audio packet is recombinated again

Also Published As

Publication number Publication date
CN109584889A (en) 2019-04-05

Similar Documents

Publication Publication Date Title
CN107819828B (en) Data transmission method and device, computer equipment and storage medium
CN101616181B (en) Method, system and equipment for uploading and downloading subtitle files
CN110535869B (en) Data transmission method based on compression algorithm, terminal equipment and storage medium
CN104519090A (en) Method and device for file transfer
CN104572966A (en) Zip file unzipping method and device
CN109584889B (en) Audio transmission method and device and storage medium
CN105025391A (en) Video playing method and apparatus
CN106791889A (en) A kind of method for processing video frequency and system, distributed objects storage system
CN109214855B (en) Material receiving method, device and system
CN110875897B (en) Data transmission method, device, server and storage medium
CN111327921A (en) Video data processing method and device
CN102857547B (en) The method and apparatus of distributed caching
CN110719526B (en) Video playing method and device
CN104572964A (en) Zip file unzipping method and device
CN106385627B (en) video encoding method and apparatus
CN105163136A (en) Method and device for providing video file in P2P mode
US20190182304A1 (en) Universal messaging protocol for limited payload size
CN113138969A (en) Data transmission method and device, electronic equipment and computer readable storage medium
US9286365B2 (en) Data synchronizing system and method thereof
CN102999626B (en) A kind of data compression/decompression compression apparatus and method, system
CN104038307A (en) Data stream transmission system and method
CN108124183B (en) Method for synchronously acquiring video and audio to perform one-to-many video and audio streaming
CN115190352A (en) Video data storage method and device, computer readable storage medium and electronic equipment
CN111131512B (en) Equipment information processing method and device, storage medium and processor
CN103313093A (en) Method and index system for distributed video on demand

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
GR01 Patent grant
GR01 Patent grant