CN-122002073-A - Audio playing method, related device, equipment and storage medium
Abstract
The application discloses an audio playing method, a related device, equipment and a storage medium. The method comprises the steps of receiving N audio streams sent by a server, carrying out audio playing on the N audio streams in a first time period according to an audio stream number threshold corresponding to the first time period, obtaining the total number of the blocking times of the N audio streams in the first time period, determining an audio stream number threshold corresponding to a second time period according to the total number of the blocking times of the first time period, and carrying out audio playing on M audio streams in the N audio streams in the second time period according to the audio stream number threshold corresponding to the second time period. The application not only can fully exert the performance advantage of the terminal, but also can play more audio streams at the same time as much as possible, thereby improving the user experience.
Inventors
- LI HAORAN
Assignees
- 腾讯科技(深圳)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241101
Claims (17)
- 1. A method of audio playback, comprising: Receiving N audio streams sent by a server, wherein N is an integer greater than 1; According to an audio stream number threshold corresponding to a first time period, audio playing is carried out on the N audio streams in the first time period, wherein the audio stream number threshold corresponding to the first time period represents the maximum number of playable audio streams of a terminal in the first time period; acquiring the total number of blocking times of the N audio streams in the first time period; Determining an audio stream number threshold corresponding to a second time period according to the total number of the blocking times of the first time period, wherein the audio stream number threshold corresponding to the second time period represents the maximum number of playable audio streams of the terminal in the second time period; And according to the audio stream number threshold value corresponding to the second time period, performing audio playing on M audio streams in the N audio streams in the second time period, wherein M is an integer greater than or equal to 1 and less than or equal to N.
- 2. The method of claim 1, wherein the obtaining the total number of campaigns of the N audio streams for the first time period comprises: Respectively obtaining the blocking times of each audio stream in the N audio streams in the first time period through N cache threads, wherein the blocking times are integers which are larger than or equal to 0; summing the blocking times of each audio stream in the first time period to obtain the total blocking times of the N audio streams in the first time period; Or alternatively The obtaining the total number of the blocking times of the N audio streams in the first time period includes: And obtaining the total number of the blocking times of the N audio streams in the first time period through a target cache thread, wherein the total number of the blocking times is an integer greater than or equal to 0.
- 3. The method according to claim 1 or 2, wherein determining the threshold number of audio streams corresponding to the second time period according to the total number of times of the first time period comprises: If the total number of the blocking times is larger than the number threshold, reducing the audio stream number threshold corresponding to the first time period to obtain the audio stream number threshold corresponding to the second time period; If the total number of the blocking times is smaller than or equal to the number threshold, increasing or maintaining the audio stream number threshold corresponding to the first time period to obtain the audio stream number threshold corresponding to the second time period.
- 4. The method of claim 3, wherein the reducing the audio stream number threshold corresponding to the first time period to obtain the audio stream number threshold corresponding to the second time period comprises: Calculating to obtain average reading time according to the actual reading time of the N audio streams in the first time period, wherein the actual reading time is longer than the basic reading time; obtaining a target value by calculating a quotient of the basic reading time length and the average reading time length; And determining an audio stream number threshold corresponding to the second time period according to the target value, wherein the audio stream number threshold corresponding to the second time period is smaller than the audio stream number threshold corresponding to the first time period.
- 5. The method of claim 3, wherein the reducing the audio stream number threshold corresponding to the first time period to obtain the audio stream number threshold corresponding to the second time period comprises: And obtaining the audio stream number threshold corresponding to the second time period by differentiating the audio stream number threshold corresponding to the first time period from a preset number, wherein the preset number is an integer greater than or equal to 1.
- 6. The method of claim 3, wherein the increasing or maintaining the audio stream number threshold corresponding to the first time period to obtain the audio stream number threshold corresponding to the second time period includes: calculating an average reading time length according to the actual reading time lengths of the N audio streams in the first time period, wherein the actual reading time length is smaller than a basic reading time length; obtaining a target value by calculating a quotient of the basic reading time length and the average reading time length; And determining and obtaining an audio stream number threshold corresponding to the second time period according to the target value, wherein the audio stream number threshold corresponding to the second time period is greater than or equal to the audio stream number threshold corresponding to the first time period.
- 7. The method of claim 3, wherein the increasing or maintaining the audio stream number threshold corresponding to the first time period to obtain the audio stream number threshold corresponding to the second time period includes: And summing the audio stream number threshold corresponding to the first time period with a preset number to obtain the audio stream number threshold corresponding to the second time period, wherein the preset number is an integer greater than or equal to 1.
- 8. The method according to any one of claims 1 to 7, wherein the audio playing of M audio streams of the N audio streams in the second time period according to the audio stream number threshold corresponding to the second time period includes: acquiring average audio energy corresponding to each audio stream in the N audio streams; The N audio streams are ranked in importance according to an audio stream ranking rule, so that N audio streams with high importance from high importance to low importance are obtained, wherein the audio stream ranking rule is that the N audio streams are ranked in order of average audio energy from high importance to low importance, and the N audio streams are ranked in order of audio duration from high importance to low importance under the condition that the average audio energy is similar; acquiring first M audio streams from N audio streams with the importance being sequenced from high to low, wherein M is equal to an audio stream number threshold corresponding to the second time period; And audio playing is carried out on the M audio streams in the second time period.
- 9. The method of claim 8, wherein the audio playing of the M audio streams during the second time period comprises: Decoding each audio stream acquired in the second time period through an M cache thread respectively to obtain M decoded audio streams; Storing the decoded M audio streams into corresponding cache spaces respectively through the M cache threads; Mixing the decoded M audio streams stored in the M cache spaces to obtain a target audio stream; And playing the audio frequency of the target audio frequency stream.
- 10. The method of claim 8, wherein the audio playing of the M audio streams during the second time period comprises: Decoding each audio stream acquired in the second time period through a target cache thread to obtain M decoded audio streams; storing the decoded M audio streams to a cache space through the target cache thread; mixing the decoded M audio streams stored in the buffer space to obtain a target audio stream; And playing the audio frequency of the target audio frequency stream.
- 11. The method according to any one of claims 1 to 10, further comprising: In the process of audio playing, when audio data is read from a cache space, a playing callback interval is determined according to the current time and the previous time of reading the audio data, wherein the playing callback interval is the difference value between the current time and the previous time of reading the audio data; obtaining interval multiples to be updated by obtaining quotient of the play callback interval and a preset basic value; acquiring the current statistics times corresponding to each interval multiple of K interval multiples according to the interval multiple to be updated, wherein the K interval multiples comprise the interval multiple to be updated; determining a target interval multiple according to the current statistical times corresponding to each interval multiple, wherein the frequency accumulation proportion corresponding to the target interval multiple is greater than or equal to a proportion threshold, and the frequency accumulation proportion is the ratio of the sum of the current statistical times corresponding to each interval multiple less than or equal to the target interval multiple to the total statistical times; And obtaining the size of the buffer space by integrating the target interval multiple with the preset basic value, wherein the buffer space is used for buffering the decoded audio stream for audio playing.
- 12. The method of claim 11, wherein the obtaining, according to the interval multiples to be updated, the current statistics corresponding to each of the K interval multiples includes: acquiring the cycle statistics times corresponding to each interval multiple of the K interval multiples, wherein the cycle statistics times are statistics times in a preset time period; And adding 1 to the period statistics times corresponding to the interval multiples to be updated to obtain the current statistics times corresponding to each of the K interval multiples.
- 13. The method of claim 11, wherein the obtaining, according to the interval multiples to be updated, the current statistics corresponding to each of the K interval multiples includes: acquiring historical statistics times corresponding to each interval multiple of the K interval multiples; Under the condition that the historical statistics time length is greater than or equal to the attenuation time length, multiplying the historical statistics times corresponding to each interval multiple by an attenuation coefficient to obtain attenuation statistics times corresponding to each interval multiple in the K interval multiples; Adding 1 to the attenuation statistics times corresponding to the interval multiple to be updated to obtain the current statistics times corresponding to the interval multiple to be updated; and taking the attenuation statistics times corresponding to each interval multiple except the interval multiple to be updated in the K interval multiples as the current statistics times.
- 14. An audio playback apparatus, comprising: The receiving module is used for receiving N audio streams sent by the server, wherein N is an integer greater than 1; The playing module is used for playing the N audio streams in the first time period according to an audio stream number threshold value corresponding to the first time period, wherein the audio stream number threshold value corresponding to the first time period represents the maximum number of playable audio streams of the terminal in the first time period; The acquisition module is used for acquiring the total number of the blocking times of the N audio streams in the first time period; the determining module is used for determining an audio stream number threshold corresponding to a second time period according to the total number of the blocking times of the first time period, wherein the audio stream number threshold corresponding to the second time period represents the maximum number of the playable audio streams of the terminal in the second time period; The playing module is further configured to perform audio playing on M audio streams in the N audio streams in the second time period according to the audio stream number threshold corresponding to the second time period, where M is an integer greater than or equal to 1 and less than or equal to N.
- 15. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 13 when the computer program is executed.
- 16. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 13.
- 17. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 13.
Description
Audio playing method, related device, equipment and storage medium Technical Field The present application relates to the field of multimedia technologies, and in particular, to a method, a related device, an apparatus, and a storage medium for playing audio. Background With the rapid development of computer and internet technologies, online audio communication has become a common entertainment mode. In practical use, if the number of audio streams exceeds the threshold, play-out jamming occurs because the processing of the play-out data does not keep up with the consumption of the data, and the jamming is more obvious when the device load is higher or the device performance is worse. To avoid play-over to some extent, a method commonly used in the industry is to add a routing strategy. That is, the user receives audio streams from multiple remote users while connecting with the wheat. Then, the audio streams are selected based on a preset threshold value of the number of audio streams allowed to be played simultaneously. These selected audio streams are then decoded and played. However, the inventors have found that at least the following problems exist in the current scheme, and in order to compromise the performance of different devices, the threshold value of the number of audio streams allowed to be played simultaneously is set to a smaller value. Thus, the advantages of high performance devices are not fully utilized, resulting in a poor listening experience for the user. For this reason, an effective method is needed to solve such problems. Disclosure of Invention The embodiment of the application provides an audio playing method, a related device, equipment and a storage medium, which not only can fully play the performance advantages of a terminal, but also can play more audio streams at the same time as much as possible, thereby improving the user experience. In view of this, the present application provides, in one aspect, a method for audio playback, including: Receiving N audio streams sent by a server, wherein N is an integer greater than 1; According to an audio stream number threshold corresponding to a first time period, audio playing is carried out on N audio streams in the first time period, wherein the audio stream number threshold corresponding to the first time period represents the maximum number of playable audio streams of the terminal in the first time period; Acquiring the total number of blocking times of N audio streams in a first time period; Determining an audio stream number threshold corresponding to a second time period according to the total number of the blocking in the first time period, wherein the audio stream number threshold corresponding to the second time period represents the maximum number of playable audio streams of the terminal in the second time period; And according to the audio stream number threshold value corresponding to the second time period, performing audio playing on M audio streams in the N audio streams in the second time period, wherein M is an integer greater than or equal to 1 and less than or equal to N. Another aspect of the present application provides an audio playing device, including: the receiving module is used for receiving N audio streams sent by the server, wherein N is an integer greater than 1; The playing module is used for playing the N audio streams in the first time period according to the audio stream number threshold value corresponding to the first time period, wherein the audio stream number threshold value corresponding to the first time period represents the maximum number of the audio streams which can be played by the terminal in the first time period; The acquisition module is used for acquiring the total number of blocking times of the N audio streams in the first time period; The determining module is used for determining an audio stream number threshold corresponding to a second time period according to the total number of the blocking times of the first time period, wherein the audio stream number threshold corresponding to the second time period represents the maximum number of playable audio streams of the terminal in the second time period; and the playing module is also used for playing the audio of M audio streams in the N audio streams in the second time period according to the audio stream number threshold value corresponding to the second time period, wherein M is an integer which is greater than or equal to 1 and less than or equal to N. In one possible design, in another implementation of another aspect of the embodiments of the present application, The device comprises an acquisition module, a control module and a control module, wherein the acquisition module is specifically used for respectively acquiring the blocking times of each audio stream in N audio streams in a first time period through N cache threads, wherein the blocking times are integers which are larger than or equal to 0; summing the bloc