CN109451339B - Audio transmission method, device, equipment and readable storage medium - Google Patents
Audio transmission method, device, equipment and readable storage medium Download PDFInfo
- Publication number
- CN109451339B CN109451339B CN201811631310.8A CN201811631310A CN109451339B CN 109451339 B CN109451339 B CN 109451339B CN 201811631310 A CN201811631310 A CN 201811631310A CN 109451339 B CN109451339 B CN 109451339B
- Authority
- CN
- China
- Prior art keywords
- wifi
- sound box
- audio
- sending
- sound
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/4302—Content synchronisation processes, e.g. decoder synchronisation
- H04N21/4307—Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/436—Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
- H04N21/43615—Interfacing a Home Network, e.g. for connecting the client to a plurality of peripherals
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The invention discloses an audio transmission method, which comprises the following steps: when playing videos, the PCM data packet of audio data in the video audio and video stream is acquired in real time, the PCM data packet is sent to a WiFi sound box which is wirelessly connected with local equipment, then whether the WiFi sound box is in a work ready state or not is detected, and finally if the WiFi sound box is in the work ready state, a preset sound delay value is sent to the WiFi sound box, so that the local equipment plays a video picture, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and then the video picture and the audio data corresponding to the PCM data packet are synchronized. The invention also discloses an audio transmission device, equipment and a readable storage medium. The invention avoids the problem of sound and picture asynchronism caused by sound delay caused by WiFi transmission, thereby improving the efficiency of sound and picture synchronization.
Description
Technical Field
The present invention relates to the field of audio transmission, and in particular, to an audio transmission method, apparatus, device, and readable storage medium.
Background
With the continuous improvement of the transmission performance and stability of the WIFI and the advantages of the WIFI sound box such as the operation of the one-to-many connection design and the super-strong transmission capability of the WIFI sound box compared with the 2.4G sound boxes such as the bluetooth and the like, the WIFI sound box will be more and more concerned and welcomed in the audio terminal product market, and the television is used as the center of the home audio-video equipment, and the WIFI sound box is likely to become a necessary device for sharing and listening to the peripheral audio.
At present, smart televisions generally have a WIFI connection function, television WIFI is used and is connected to a family WIFI router, a user only needs to connect a WIFI sound box to the WIFI router, the WIFI sound box and a television are in the same family WiFi local area network, audio data in television audio and video are intercepted and transmitted through a television software system, and finally the audio data are played at a WIFI sound box end, so that the transmission framework of the WIFI sound box matched with all existing intelligent products is provided. However, the biggest problem of the transmission architecture of the audio transmission is the sound delay caused by WiFi transmission (television audio data must be forwarded through a WiFi router), and especially when the WiFi interference condition is large or the home WiFi is used under an excessive load, the sound and the picture of the smart television cannot be synchronized.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide an audio transmission method, an audio transmission device, audio transmission equipment and a readable storage medium, and aims to solve the problem that a smart television cannot synchronize sound and pictures due to sound delay caused by WiFi transmission in the existing audio transmission method.
To achieve the above object, the present invention provides an audio transmission method, including the steps of:
when a video is played, obtaining a PCM data packet of audio data in audio and video streams of the video in real time, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment;
detecting whether the WiFi loudspeaker box is in a work ready state or not;
if the WiFi sound box is in a working ready state, a preset sound delay value is sent to the WiFi sound box, so that when the local equipment plays the video picture, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further synchronization of the video picture and the audio data corresponding to the PCM data packet is achieved.
Optionally, when playing a video, the step of acquiring a PCM data packet of audio data in the audio and video stream of the video in real time, and sending the PCM data packet to a WiFi sound box wirelessly connected to the local device includes:
when a video is played, acquiring the IP of the WiFi sound box and PCM data which are not subjected to delay processing by an audio driver in the audio and video stream in real time;
and packaging the PCM data to obtain a PCM data packet, and sending the PCM data packet to a WiFi router, wherein the WiFi router sends the PCM data to the WiFi loudspeaker box.
Optionally, the step of detecting whether the WiFi speaker is in a ready state includes:
sending a broadcast data packet to the WiFi sound box, and monitoring whether confirmation information returned by the WiFi sound box is received or not;
and if the confirmation information returned by the WiFi sound box is received, judging that the WiFi sound box is in a work ready state.
Optionally, if the WiFi speaker is in a ready state, the step of sending a preset sound delay value to the WiFi speaker includes:
if the WiFi sound box is in a working ready state, acquiring a change state of a television information source, and determining whether the television information source is switched into a signal mode or not based on the change state;
and if the television signal source is switched to the signal mode, acquiring the current signal mode of the television signal source, and sending a sound delay value corresponding to the current signal mode to a WiFi sound box.
Optionally, after the step of acquiring the current signal mode of the television signal source and sending the sound delay value corresponding to the current signal mode to the WiFi sound box if the television signal source has switched the signal mode, the audio transmission method further includes:
determining whether confirmation information sent by the WiFi loudspeaker box is received within a preset time period;
and if the confirmation information sent by the WiFi sound box is received within a preset time period, executing the step of acquiring the change state of the television information source.
Optionally, after the step of determining whether the confirmation information sent by the WiFi loudspeaker box is received within a preset time period, the audio transmission method includes:
if the confirmation information sent by the WiFi sound box is not received within a preset time period, repeatedly sending a sound delay value to the WiFi sound box, and detecting whether the sending times of the sound delay value reach preset times or not;
and if the sending times reach the preset times, executing a step of detecting whether the WiFi loudspeaker box is in a work ready state.
Optionally, after the step of continuously sending confirmation information to the WiFi loudspeaker box and detecting whether the sending times reaches the preset times if the confirmation information sent by the WiFi loudspeaker box is not received within the preset time period, the audio transmission method further includes:
and if the sending times do not reach the preset times, executing a step of sending the sound delay value corresponding to the current signal mode to the WiFi loudspeaker box.
Further, to achieve the above object, the present invention also provides an audio transmission device including:
the acquisition module is used for acquiring a PCM data packet of audio data in audio and video streams of a video in real time when the video is played, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment;
the detection module is used for detecting whether the WiFi loudspeaker box is in a work ready state or not;
and the sending module is used for sending a preset sound delay value to the WiFi sound box if the WiFi sound box is in a work ready state so that when the local equipment plays the video picture, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and then the video picture and the audio data corresponding to the PCM data packet are synchronized.
Furthermore, to achieve the above object, the present invention also provides an audio transmission device, which includes a processor, a memory, and an audio transmission program stored on the memory and executable by the processor, wherein the audio transmission program, when executed by the processor, implements the steps of the audio transmission method as described above.
In addition, to achieve the above object, the present invention further provides a readable storage medium, which stores an audio transmission program, wherein the audio transmission program, when executed by a processor, implements the steps of the audio transmission method as described above.
The invention provides an audio transmission method, audio transmission equipment, an audio transmission device and a readable storage medium, wherein a PCM data packet of audio data in audio and video streams of a video is acquired in real time when the video is played, the PCM data packet is sent to a WiFi sound box wirelessly connected with local equipment, then whether the WiFi sound box is in a work ready state or not is detected, and finally if the WiFi sound box is in the work ready state, a preset sound delay value is sent to the WiFi sound box, so that when the local equipment plays a video picture of the video, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further the video picture and the audio data corresponding to the PCM data packet are synchronized; the problem of sound picture asynchronism caused by sound delay caused by WiFi transmission is solved, and therefore the efficiency of sound picture synchronization is improved.
Drawings
Fig. 1 is a schematic structural diagram of a terminal to which an audio transmission apparatus belongs in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of an audio transmission method according to the present invention;
FIG. 3 is a flowchart illustrating an audio transmission method according to a second embodiment of the present invention;
FIG. 4 is a functional block diagram of a first embodiment of an audio transmission method according to the present invention;
fig. 5 is a diagram illustrating a data packet format in the audio transmission method according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a terminal to which an audio transmission device belongs in a hardware operating environment according to an embodiment of the present invention.
The terminal of the embodiment of the invention can be a PC. As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the terminal may further include a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WiFi module, and the like. Such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display screen according to the brightness of ambient light, and a proximity sensor that may turn off the display screen and/or the backlight when the mobile terminal is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in a direction (generally, three axes), detect the magnitude and direction of gravity when the mobile terminal is stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer and tapping) and the like for recognizing the attitude of the mobile terminal; of course, the mobile terminal may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which are not described herein again.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operation server, a network communication module, a user interface module, and an audio transmission program.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be used to invoke an audio transfer program stored in the memory 1005.
In this embodiment, the audio transmission device includes: a memory 1005, a processor 1001 and an audio transmission program stored on the memory 1005 and operable on the processor 1001, wherein when the processor 1001 calls the audio transmission program stored in the memory 1005, the following operations are performed:
when a video is played, obtaining a PCM data packet of audio data in audio and video streams of the video in real time, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment;
detecting whether the WiFi loudspeaker box is in a work ready state or not;
if the WiFi sound box is in a working ready state, a preset sound delay value is sent to the WiFi sound box, so that when the local equipment plays the video picture, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further synchronization of the video picture and the audio data corresponding to the PCM data packet is achieved.
Further, the processor 1001 may call the audio transmission program stored in the memory 1005, and also perform the following operations:
when a video is played, acquiring the IP of the WiFi sound box and PCM data which are not subjected to delay processing by an audio driver in the audio and video stream in real time;
and packaging the PCM data to obtain a PCM data packet, and sending the PCM data packet to a WiFi router, wherein the WiFi router sends the PCM data to the WiFi loudspeaker box.
Further, the processor 1001 may call the audio transmission program stored in the memory 1005, and also perform the following operations:
sending a broadcast data packet to the WiFi sound box, and monitoring whether confirmation information returned by the WiFi sound box is received or not;
and if the confirmation information returned by the WiFi sound box is received, judging that the WiFi sound box is in a work ready state.
Further, the processor 1001 may call the audio transmission program stored in the memory 1005, and also perform the following operations:
if the WiFi sound box is in a working ready state, acquiring a change state of a television information source, and determining whether the television information source is switched into a signal mode or not based on the change state;
and if the television signal source is switched to the signal mode, acquiring the current signal mode of the television signal source, and sending a sound delay value corresponding to the current signal mode to a WiFi sound box.
Further, the processor 1001 may call the audio transmission program stored in the memory 1005, and also perform the following operations:
determining whether confirmation information sent by the WiFi loudspeaker box is received within a preset time period;
and if the confirmation information sent by the WiFi sound box is received within a preset time period, executing the step of acquiring the change state of the television information source.
Further, the processor 1001 may call the audio transmission program stored in the memory 1005, and also perform the following operations:
if the confirmation information sent by the WiFi sound box is not received within a preset time period, repeatedly sending a sound delay value to the WiFi sound box, and detecting whether the sending times of the sound delay value reach preset times or not;
and if the sending times reach the preset times, executing a step of detecting whether the WiFi loudspeaker box is in a work ready state.
Further, the processor 1001 may call the audio transmission program stored in the memory 1005, and also perform the following operations:
and if the sending times do not reach the preset times, executing a step of sending the sound delay value corresponding to the current signal mode to the WiFi loudspeaker box.
The invention further provides an audio transmission method. Referring to fig. 2, fig. 2 is a flowchart illustrating an audio transmission method according to a first embodiment of the invention.
In this embodiment, the main execution body of the present invention is an Audio parameter device, and the present invention creates an Audio _ Handle module running in the background in a television software system, where the Audio _ Handle module includes a Handle _ Data thread submodule and a Handle _ Control thread submodule, where the Handle _ Data thread submodule is used to capture PCM Data from a PCM node of a sound card before an Audio driver processes Audio delay processing of Audio-video synchronization, send the PCM Data to a television WiFi network interface, a WiFi network card of a television transmits the PCM Data to a WiFi router, and then the PCM Data is forwarded to a WiFi speaker end by the WiFi router, and the Handle _ Control thread is used to dynamically send an Audio delay value corresponding to a television source where the television is currently located to the WiFi speaker end after the WiFi speaker is connected to the WiFi router, so that Audio output is performed at a time point when the Audio delay value reaches the WiFi speaker end, thereby achieving real Audio-required Audio-video synchronization, the problem of sound picture asynchronism caused by sound delay caused by WiFi transmission is avoided.
The audio transmission method comprises the following steps:
step S10, when playing video, obtaining a PCM data packet of audio data in audio and video stream of the video in real time, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment;
in this embodiment, a Handle _ Data thread submodule in the audio transmission device acquires a PCM (Pulse Code Modulation) Data packet of audio Data in the audio stream number in real time, and sends the acquired PCM Data packet to the WiFi sound box.
When the video is played, a PCM data packet of audio data in the video audio and video stream is acquired in real time, and the PCM data packet is sent to a WiFi sound box wirelessly connected with the local equipment, and the method comprises the following steps:
step S11, when playing video, obtaining PCM data packet of audio data in audio and video stream in real time, and sending the PCM data packet to WiFi sound box;
in this embodiment, the audio transmission device sends a broadcast request to the WiFi loudspeaker, and when receiving the broadcast request, the WiFi loudspeaker obtains an IP of the WiFi loudspeaker, where the IP is a formulated address for sending PCM Data to the WiFi loudspeaker in real time by a Handle _ Data thread, and intercepts PCM Data that is not delayed by an audio driver from an audio/video stream at a local end or a network end of the television software system in real time, for example, intercepts PCM Data that is not delayed by the audio driver from a PCM node of the sound card through an API interface at an upper layer driven by alsa.
In the embodiment, four information types of the UDP packet interaction format are provided, referring to fig. 5, where fig. 5 is a schematic diagram of the Data packet format, Probe _ IP, Check _ WiFi _ Status, Set _ Latency, and PCM _ Send, where the Probe _ IP is used to indicate that a television software requests to obtain an IP of a WiFi loudspeaker, and after receiving the information type, the WiFi loudspeaker returns a UDP unicast packet to which an IP address value is added in a Data field to a television Handle _ thread Data sub-module.
Step S12, encapsulating the PCM data to obtain a PCM data packet, and sending the PCM data to a WiFi router, wherein the WiFi router sends the PCM data to the WiFi sound box.
In this embodiment, the PCM data is encapsulated in a UDP packet format, so as to obtain a PCM data packet, and the PCM data packet is sent to the WiFi router, and the WiFi router sends the encapsulated PCM data packet to the WiFi loudspeaker box.
The method for encapsulating the PCM data to obtain the PCM data packet may be as follows:
the PCM Data exists in the audio Data stream in a unicast Data packet, the IP of the WiFi sound box is added to the obtained IP and added to a UDP Header (Data head in a UDP format) of the unicast Data packet, and the intercepted PCM Data is added to a Data field of a UDP payload (payload in a UDP format), so that the encapsulated PCM Data packet is obtained.
Step S20, detecting whether the WiFi sound box is in a work ready state;
in this embodiment, the Handle _ Control thread sub-module can detect the working state of the WiFi loudspeaker box, and determine whether the WiFi loudspeaker box is in a working ready state. Specifically, this step of detecting whether wiFi audio amplifier is in the ready state of work includes:
step S21, sending a broadcast data packet to the WiFi sound box, and monitoring whether confirmation information returned by the WiFi sound box is received;
and step S22, if the confirmation information returned by the WiFi sound box is received, determining that the WiFi sound box is in a work ready state.
In this embodiment, the Handle _ Control thread sub-module sends a broadcast Data packet in a UDP format to the WiFi loudspeaker, where the message type may be Check _ WiFi _ Status, and when the WiFi loudspeaker receives the broadcast Data packet of the message type, a unicast Data is returned to the Handle _ Control thread sub-module, where the returned unicast Data includes a Data field containing acknowledgement information. If the Handle _ Control thread submodule receives the confirmation information, the WiFi sound box is in a work ready state, if the Handle _ Control thread submodule does not receive the confirmation information, the WiFi sound box is not in the work ready state, and the Handle _ Control thread submodule monitors the work state of the WiFi sound box in real time.
Step S30, if the WiFi sound box is in a work ready state, a preset sound delay value is sent to the WiFi sound box, so that when the local device plays the video picture, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further synchronization of the video picture and the audio data corresponding to the PCM data packet is achieved.
In this embodiment, the Handle _ Control thread submodule of the audio transmission device monitors the operating state of the WiFi sound box, and if it is monitored that the WiFi sound box is in a ready state, a preset sound delay value is sent to the WiFi sound box, and the WiFi sound box performs delay Control on the output time of the PCM data packet according to the sound delay value, so that a video frame is synchronized with audio data corresponding to the PCM packet, and sound and picture synchronization is achieved.
In the audio transmission method provided in this embodiment, when a video is played, a PCM data packet of audio data in audio and video streams of the video is obtained in real time, and the PCM data packet is sent to a WiFi sound box wirelessly connected to a local device, and then whether the WiFi sound box is in a working ready state is detected, and finally, if the WiFi sound box is in the working ready state, a preset sound delay value is sent to the WiFi sound box, so that when the local device plays a video picture of the video, the WiFi sound box performs delay control on output time of the PCM data packet according to the sound delay value, and further, synchronization of the video picture and the audio data corresponding to the PCM data packet is achieved; the problem of sound picture asynchronism caused by sound delay caused by WiFi transmission is solved, and therefore the efficiency of sound picture synchronization is improved.
Based on the first embodiment, a second embodiment of the audio transmission method of the present invention is proposed, in this embodiment, step S30 includes:
step S31, if the WiFi sound box is in a work ready state, acquiring a change state of a television signal source, and determining whether the television signal source is switched into a signal mode or not based on the change state;
in this embodiment, a user may switch a television signal source of a television through a controller (e.g., a remote controller, a mobile phone), when the user switches the television signal source, a signal mode of the television signal source may be changed, and sound delay values corresponding to the television signal sources of different signal modes may be different, so that when detecting that the WiFi sound box is in a ready state, a change state of the television signal source is monitored, wherein when the state of the television signal source changes, a notification event is sent to a Handle _ Control sub-module, the Handle _ Control sub-module may monitor the signal source television notification event in real time, and when monitoring the notification event, a current signal mode of the television is obtained, and whether the signal mode changes is determined, where the signal mode includes HDMI, USB (including a television UI operation interface), ATV (analog television signal), and the like.
Step S32, if the signal mode of the television signal source has been switched, acquiring a current signal mode of the television signal source, and sending a sound delay value corresponding to the current signal mode to a WiFi sound box.
In this embodiment, when the television signal source is in a state when the television is started for the first time or the signal source has been switched to a different mode, the Handle _ Control thread sub-module sends a sound delay value of the television signal source to the WiFi sound box, where the sound delay value exists in a UDP format packet, and when the television signal source is in a state when the television is started for the first time or the signal source has been switched to a different mode, the current signal mode of the television signal source is obtained, and the sound delay value corresponding to the current signal mode is sent to the WiFi sound box, specifically, the Handle _ Control thread sub-module sends a packet whose message type is Set _ Latency and Data field is the sound delay value of the television signal source to the WiFi sound box, where, for example, the HDMI delay value is 170ms, the USB delay value is 230ms, and the ATV delay value is 100 ms. And the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value and carries out synchronous processing so as to synchronize sound and picture, the longer the time is, the more the time for processing WiFi packet loss and buffer processing is, and the more stable and continuous the transmission of WiFi audio is.
In the audio transmission method provided in this embodiment, if the WiFi sound box is in a ready state, a change state of a television signal source is obtained, whether the television signal source switches a signal mode is determined based on the change state, then if the television signal source has switched the signal mode, a current signal mode of the television signal source is obtained, and a sound delay value corresponding to the current signal mode is sent to the WiFi sound box; the problem of sound and picture asynchronism caused by sound delay caused by WiFi transmission is solved when television information sources are switched, and therefore the efficiency of sound and picture synchronization is improved.
Based on the second embodiment, a third embodiment of the audio transmission method of the present invention is proposed, and referring to fig. 3, after step S32, the method further includes:
step S33, determining whether confirmation information sent by the WiFi sound box is received within a preset time period;
and step S34, if the confirmation information sent by the WiFi sound box is received within a preset time period, executing the step of acquiring the change state of the television information source.
In this embodiment, the confirmation information is used to detect whether the WiFi sound box receives the sound delay value, if the confirmation information sent by the WiFi sound box is received within the preset time period, it represents that the WiFi sound box has received the sound delay value, and if the confirmation information sent by the WiFi sound box is received within the preset time period, the step of obtaining the change state of the television signal source is executed, and the change state of the television signal source is continuously detected.
After step S33, the method further includes:
step S35, if the confirmation information sent by the WiFi sound box is not received within the preset time period, the sound delay value is repeatedly sent to the WiFi sound box, and whether the sending times of the sound delay value reaches the preset times or not is detected;
and step S36, if the sending times reach the preset times, executing the step of detecting whether the WiFi sound box is in a work ready state.
In this embodiment, if the audio transmission device does not receive the confirmation information sent by the WiFi speaker within the preset time period, then the voice delay value is continuously sent to the WiFi sound box, the timing is re-timed, whether the confirmation information sent by the WiFi sound box is received in the preset time period is judged again, if the confirmation information sent by the WiFi sound box is not received within the preset time period, the sound delay value is continuously sent to the WiFi sound box, the process is analogized, the sending times of the sound delay value sent to the WiFi sound box is recorded, whether the sending times is greater than the preset times or not is judged, if the sending times is greater than the preset times, if it is likely that the WiFi speaker is disconnected, indicating that the WiFi speaker is not in a ready-to-operate state, performing a step of detecting whether the WiFi speaker is in a ready-to-operate state, therefore, when the WiFi sound box is not in a work ready state, the situation that a sound delay value is sent to the WiFi sound box all the time can be avoided.
After step S35, the method further includes:
and step S37, if the sending times does not reach the preset times, executing the step of sending the sound delay value corresponding to the current signal mode to the WiFi sound box.
In this embodiment, the audio transmission device sends a sound delay value once to the WiFi sound box, records the current sending frequency, and determines whether the current sending frequency reaches the preset frequency, if not, executes a step of sending the sound delay value of the television signal source to the WiFi sound box, and continues to send the sound delay value to the WiFi sound box until receiving the confirmation information sent by the WiFi sound box, or detects that the sending frequency reaches the preset frequency.
In the audio transmission method provided in this embodiment, whether confirmation information sent by the WiFi sound box is received within a preset time period is determined, if the confirmation information sent by the WiFi sound box is received within the preset time period, the step of obtaining a change state of a television signal source is performed, if the confirmation information sent by the WiFi sound box is not received within the preset time period, a sound delay value is repeatedly sent to the WiFi sound box, whether the sending frequency of the sent sound delay value reaches a preset frequency is detected, if the sending frequency reaches the preset frequency, the step of detecting whether the WiFi sound box is in a work ready state is performed, and if the sending frequency does not reach the preset frequency, the step of sending the sound delay value corresponding to the current signal mode to the WiFi sound box is performed; whether the confirmation information sent by the WiFi loudspeaker box is received or not is monitored, so that whether the WiFi loudspeaker box receives the sound delay value or not is determined, the condition that sound and picture are not synchronous due to sound delay caused by instable WiFi transmission is avoided, and the sound and picture synchronization efficiency is improved.
In addition, the embodiment of the invention also provides an audio transmission device.
Referring to fig. 4, fig. 4 is a functional block diagram of an audio transmission device according to a first embodiment of the present invention.
The audio transmission apparatus of the present invention is a virtual apparatus, stored in the memory 1005 of the audio transmission device shown in fig. 1, and is used for implementing all functions of an audio transmission program: when a video is played, obtaining a PCM data packet of audio data in audio and video streams of the video in real time, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment; detecting whether the WiFi loudspeaker box is in a work ready state or not; if the WiFi sound box is in a working ready state, a preset sound delay value is sent to the WiFi sound box, so that when the local equipment plays the video picture, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further synchronization of the video picture and the audio data corresponding to the PCM data packet is achieved.
Specifically, in this embodiment, the audio transmission device includes:
the acquisition module 101 is configured to acquire a PCM data packet of audio data in audio and video streams in real time when a video is played, and send the PCM data packet to a WiFi sound box;
the detection module 102 is configured to detect whether the WiFi loudspeaker box is in a working ready state;
and the sending module 103 is configured to send a preset sound delay value to the WiFi sound box if the WiFi sound box is in a work ready state, so that the WiFi sound box performs delay control on the output time of the PCM data packet according to the sound delay value, and performs synchronization processing to synchronize sound and pictures.
Further, the obtaining module 101 is further configured to:
when a video is played, acquiring the IP of the WiFi sound box and PCM data which are not subjected to delay processing by an audio driver in the audio and video stream in real time;
and packaging the PCM data to obtain a PCM data packet, and sending the PCM data packet to a WiFi router, wherein the WiFi router sends the PCM data to the WiFi loudspeaker box.
Further, the detection module 102 is further configured to:
sending a broadcast data packet to the WiFi sound box, and monitoring whether confirmation information returned by the WiFi sound box is received or not;
and if the confirmation information returned by the WiFi sound box is received, judging that the WiFi sound box is in a work ready state.
Further, the sending module 103 is also used for
If the WiFi sound box is in a working ready state, acquiring a change state of a television information source, and determining whether the television information source is switched into a signal mode or not based on the change state;
and if the television signal source is switched to the signal mode, acquiring the current signal mode of the television signal source, and sending a sound delay value corresponding to the current signal mode to a WiFi sound box.
Further, the audio transmission apparatus further includes:
the determining module is used for determining whether the confirmation information sent by the WiFi loudspeaker box is received within a preset time period;
and if the confirmation information sent by the WiFi sound box is received within a preset time period, executing the step of acquiring the change state of the television information source.
Further, the audio transmission apparatus further includes:
the monitoring module is used for repeatedly sending a sound delay value to the WiFi loudspeaker box if the confirmation information sent by the WiFi loudspeaker box is not received within a preset time period, and detecting whether the sending times of the sound delay value reaches preset times or not;
and if the sending times reach the preset times, executing a step of detecting whether the WiFi loudspeaker box is in a work ready state.
Further, the monitoring module is further configured to:
and if the sending times do not reach the preset times, executing a step of sending the sound delay value corresponding to the current signal mode to the WiFi loudspeaker box.
The function implementation of each module in the audio transmission device corresponds to each step in the audio transmission method embodiment, and the function and implementation process are not described in detail here.
In addition, the embodiment of the invention also provides a storage medium.
The storage medium of the present invention stores an audio transmission program, wherein the audio transmission program, when executed by a processor, implements the steps of the audio transmission method as described above.
The method for implementing the audio transmission program when executed may refer to various embodiments of the audio transmission method of the present invention, and will not be described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
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.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. 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 (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (9)
1. An audio transmission method, characterized in that the audio transmission method comprises the steps of:
when a video is played, obtaining a PCM data packet of audio data in audio and video streams of the video in real time, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment;
detecting whether the WiFi loudspeaker box is in a work ready state or not;
if the WiFi sound box is in a working ready state, sending a preset sound delay value to the WiFi sound box, so that when the local equipment plays the video picture of the video, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further the video picture and the audio data corresponding to the PCM data packet are synchronized;
wherein, if the wiFi audio amplifier is in the ready state of work, then send the step of predetermined sound delay value to the wiFi audio amplifier and include:
if the WiFi sound box is in a working ready state, acquiring a change state of a television information source, and determining whether the television information source is switched into a signal mode or not based on the change state;
if the television signal source is switched to the signal mode, acquiring the current signal mode of the television signal source, and sending a sound delay value corresponding to the current signal mode to a WiFi sound box, wherein the signal mode comprises HDMI, USB and ATV.
2. The audio transmission method according to claim 1, wherein the step of acquiring a PCM data packet of audio data in audio/video stream of the video in real time while playing the video, and sending the PCM data packet to a WiFi sound box wirelessly connected to the local device comprises:
when a video is played, acquiring the IP of the WiFi sound box and PCM data which are not subjected to delay processing by an audio driver in the audio and video stream in real time;
and packaging the PCM data to obtain a PCM data packet, and sending the PCM data packet to a WiFi router, wherein the WiFi router sends the PCM data to the WiFi loudspeaker box.
3. The audio transmission method according to claim 1, wherein the step of detecting whether the WiFi speaker is in a ready state comprises:
sending a broadcast data packet to the WiFi sound box, and monitoring whether confirmation information returned by the WiFi sound box is received or not;
and if the confirmation information returned by the WiFi sound box is received, judging that the WiFi sound box is in a work ready state.
4. The audio transmission method according to claim 3, wherein after the step of obtaining the current signal mode of the television signal source and sending the sound delay value corresponding to the current signal mode to the WiFi speaker if the television signal source has switched the signal mode, the audio transmission method further comprises:
determining whether confirmation information sent by the WiFi loudspeaker box is received within a preset time period;
and if the confirmation information sent by the WiFi sound box is received within a preset time period, executing the step of acquiring the change state of the television information source.
5. The audio transmission method according to claim 4, wherein after the step of determining whether the confirmation message sent by the WiFi sound box is received within a preset time period, the audio transmission method comprises:
if the confirmation information sent by the WiFi sound box is not received within a preset time period, repeatedly sending a sound delay value to the WiFi sound box, and detecting whether the sending times of the sound delay value reach preset times or not;
and if the sending times reach the preset times, executing a step of detecting whether the WiFi loudspeaker box is in a work ready state.
6. The audio transmission method according to claim 5, wherein if the confirmation message sent by the WiFi speaker is not received within a preset time period, the audio transmission method further comprises, after the step of continuing to send the confirmation message to the WiFi speaker and detecting whether the sending times reaches a preset number, the step of:
and if the sending times do not reach the preset times, executing a step of sending the sound delay value corresponding to the current signal mode to the WiFi loudspeaker box.
7. An audio transmission apparatus, characterized in that the audio transmission apparatus comprises:
the acquisition module is used for acquiring a PCM data packet of audio data in audio and video streams of a video in real time when the video is played, and sending the PCM data packet to a WiFi sound box wirelessly connected with local equipment;
the detection module is used for detecting whether the WiFi loudspeaker box is in a work ready state or not;
the sending module is used for sending a preset sound delay value to the WiFi sound box if the WiFi sound box is in a working ready state, so that when the local equipment plays the video picture of the video, the WiFi sound box carries out delay control on the output time of the PCM data packet according to the sound delay value, and further the video picture and the audio data corresponding to the PCM data packet are synchronized;
wherein the sending module is further configured to,
if the WiFi sound box is in a working ready state, acquiring a change state of a television information source, and determining whether the television information source is switched into a signal mode or not based on the change state;
if the television signal source is switched to the signal mode, acquiring the current signal mode of the television signal source, and sending a sound delay value corresponding to the current signal mode to a WiFi sound box, wherein the signal mode comprises HDMI, USB and ATV.
8. An audio transmission device, characterized in that the audio transmission device comprises a processor, a memory, and an audio transmission program stored on the memory and executable by the processor, wherein the audio transmission program, when executed by the processor, implements the steps of the audio transmission method as claimed in any one of claims 1 to 6.
9. A readable storage medium, having an audio transmission program stored thereon, wherein the audio transmission program, when executed by a processor, implements the steps of the audio transmission method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811631310.8A CN109451339B (en) | 2018-12-28 | 2018-12-28 | Audio transmission method, device, equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811631310.8A CN109451339B (en) | 2018-12-28 | 2018-12-28 | Audio transmission method, device, equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109451339A CN109451339A (en) | 2019-03-08 |
CN109451339B true CN109451339B (en) | 2021-10-01 |
Family
ID=65538736
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811631310.8A Active CN109451339B (en) | 2018-12-28 | 2018-12-28 | Audio transmission method, device, equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109451339B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110062311A (en) * | 2019-06-01 | 2019-07-26 | 厦门市思芯微科技有限公司 | A kind of intelligent sound box system by the more room music playback functions of local area network |
CN111935595A (en) * | 2020-08-03 | 2020-11-13 | 诠航科技有限公司 | Audio output control method and device and distributed sound control device |
CN112004146A (en) * | 2020-08-18 | 2020-11-27 | 深圳创维-Rgb电子有限公司 | Audio playing method and system, television and storage medium |
CN113517901A (en) * | 2021-04-13 | 2021-10-19 | 深圳市太美亚电子科技有限公司 | Intelligent bracelet of solar intelligent household system and control method thereof |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104184894A (en) * | 2014-08-21 | 2014-12-03 | 深圳市比巴科技有限公司 | Karaoke implementation method and system |
CN104640013A (en) * | 2015-01-29 | 2015-05-20 | 广东欧珀移动通信有限公司 | Voice box control method and system |
CN104955168A (en) * | 2015-05-18 | 2015-09-30 | 乐视致新电子科技(天津)有限公司 | Audio data transmitting method, receiving method and device |
CN105376628A (en) * | 2014-08-27 | 2016-03-02 | 深圳Tcl新技术有限公司 | Method and device for synchronizing audio-video signals |
CN105898502A (en) * | 2016-04-11 | 2016-08-24 | 深圳Tcl新技术有限公司 | Audio and video playing synchronization method and synchronization device |
CN106210842A (en) * | 2016-07-18 | 2016-12-07 | 乐视控股(北京)有限公司 | Control method for playing back and device |
CN106301403A (en) * | 2015-06-03 | 2017-01-04 | 博通集成电路(上海)有限公司 | Method in wireless device and wireless device |
CN108054605A (en) * | 2017-12-06 | 2018-05-18 | 嘉兴职业技术学院 | A kind of multifunctional internet of things socket |
US10080061B1 (en) * | 2009-12-18 | 2018-09-18 | Joseph F. Kirley | Distributing audio signals for an audio/video presentation |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101765243B (en) * | 2009-12-16 | 2012-10-10 | 中兴通讯股份有限公司 | CDMA and GSM bimodule digital mobile communication terminal |
CN108111997B (en) * | 2017-12-15 | 2020-12-08 | 珠海市杰理科技股份有限公司 | Bluetooth device audio synchronization method and system |
-
2018
- 2018-12-28 CN CN201811631310.8A patent/CN109451339B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10080061B1 (en) * | 2009-12-18 | 2018-09-18 | Joseph F. Kirley | Distributing audio signals for an audio/video presentation |
CN104184894A (en) * | 2014-08-21 | 2014-12-03 | 深圳市比巴科技有限公司 | Karaoke implementation method and system |
CN105376628A (en) * | 2014-08-27 | 2016-03-02 | 深圳Tcl新技术有限公司 | Method and device for synchronizing audio-video signals |
CN104640013A (en) * | 2015-01-29 | 2015-05-20 | 广东欧珀移动通信有限公司 | Voice box control method and system |
CN104955168A (en) * | 2015-05-18 | 2015-09-30 | 乐视致新电子科技(天津)有限公司 | Audio data transmitting method, receiving method and device |
CN106301403A (en) * | 2015-06-03 | 2017-01-04 | 博通集成电路(上海)有限公司 | Method in wireless device and wireless device |
CN105898502A (en) * | 2016-04-11 | 2016-08-24 | 深圳Tcl新技术有限公司 | Audio and video playing synchronization method and synchronization device |
CN106210842A (en) * | 2016-07-18 | 2016-12-07 | 乐视控股(北京)有限公司 | Control method for playing back and device |
CN108054605A (en) * | 2017-12-06 | 2018-05-18 | 嘉兴职业技术学院 | A kind of multifunctional internet of things socket |
Non-Patent Citations (1)
Title |
---|
《实时音频处理模块的设计与数据恢复机制的研究》;黄津;《中国优秀硕士学位论文全文数据库》;20060615;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN109451339A (en) | 2019-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109451339B (en) | Audio transmission method, device, equipment and readable storage medium | |
CN108184164B (en) | Audio playing method, smart television and computer readable storage medium | |
EP2720435B1 (en) | Media share control system and method of providing user interface for media sharing thereof | |
WO2022089088A1 (en) | Display device, mobile terminal, screen-casting data transmission method, and transmission system | |
CN107332976B (en) | Karaoke method, device, equipment and system | |
CN103391473B (en) | Method and device for providing and acquiring audio and video | |
CN103702436B (en) | Miracast Reverse Turning Control method and system | |
CN113986167A (en) | Screen projection control method and device, storage medium and display equipment | |
TW201340695A (en) | Remote monitor method, associated apparatus and system for smart TV | |
CN112423076A (en) | Audio screen projection synchronous control method and device and computer readable storage medium | |
WO2023142389A1 (en) | Screen mirroring method and apparatus, and electronic device and storage medium | |
CN104796308A (en) | Method and system for network interconnection of devices | |
KR102105168B1 (en) | Display apparatus and control method of the same | |
CN109729061B (en) | Message processing method, device, equipment and readable storage medium | |
CN109495769B (en) | Video communication method, terminal, smart television, server and storage medium | |
CN107948904B (en) | Sound box aging test method and device and computer readable storage medium | |
CN113438747A (en) | Processing method, processing apparatus, and storage medium | |
KR20220164017A (en) | Gateway access method and electronic device | |
CN110505279B (en) | Method and device for setting time delay | |
CN112565204A (en) | Control method and device for video data transmission and computer readable storage medium | |
CN110958710A (en) | Channel access method, configuration method, terminal and network side equipment | |
CN109120993B (en) | Voice recognition method, intelligent terminal, voice recognition system and readable storage medium | |
CN114501089B (en) | Screen-throwing communication method and device, electronic equipment and storage medium | |
KR102454655B1 (en) | Random access resource selection method and terminal device | |
CN107396334B (en) | Wireless sound box and method for connecting multiple intelligent devices |
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 |