Media stream processing method and device, equipment and medium

By determining the time difference and buffering information of the audio and video streams, and adjusting the size of the media stream buffer, the problem of out-of-synchronization of audio and video is solved, synchronous playback of audio and video in streaming media applications is realized, and performance overhead is reduced.

CN118678129APending Publication Date: 2024-09-20BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410644864.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

In streaming media applications, the independent transmission of audio and video leads to the problem of out-of-synchronization of audio and video, and existing technologies such as modifying the client player code or using the SetRemoteSdp interface of WebRTC have high performance consumption or limitations.

Method used

By receiving the time difference between the audio stream and the video stream in the media stream, obtaining the buffer information of the media stream, and adjusting the buffer size of the media stream to achieve synchronous playback of audio and video.

Benefits of technology

It effectively achieves audio and video synchronization without incurring large performance overhead, and is suitable for scenarios such as video conferencing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118678129A
    Figure CN118678129A
Patent Text Reader

Abstract

The invention provides a media stream processing method and device, equipment and a medium. A specific embodiment of the method comprises the following steps: receiving a media stream; the media stream comprises an audio stream and a video stream which are transmitted through different channels; in response to triggering of a preset event, determining a time difference between the audio stream and the video stream included in the media stream; acquiring buffer information of the media stream; and adjusting the size of a buffer area of the media stream based on the time difference and the buffer information, so that the audio stream and the video stream included in the media stream are synchronously played. According to the implementation mode, the effect of sound and picture synchronization is efficiently realized on the premise of not generating relatively large performance overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a media stream processing method, device, equipment and medium. Background Art

[0002] With the continuous development of streaming media technology, streaming media is increasingly widely used in people's work, study and life. For example, in the scenario of online video conferencing or live broadcast, users need to hear both sound and picture, so audio and video need to be transmitted simultaneously. However, users have different requirements for audio and video. For example, users need to hear all sounds or need to hear the sound with the loudest volume, while the picture can be selectively viewed by the user. Therefore, audio and video are transmitted independently through different channels. The independent transmission of audio and video will cause the problem of audio and video being out of sync during playback. In addition, since users can switch between different pictures in the same scene, or the server can switch between different audios in the same scene as needed, it is necessary to adjust the synchronization relationship between audio and video according to the switching of audio or video. At present, a solution for audio and video synchronization is needed. Summary of the invention

[0003] The present disclosure provides a media stream processing method, apparatus, device and medium.

[0004] According to a first aspect, a media stream processing method is provided, the method comprising:

[0005] Receiving a media stream; the media stream includes an audio stream and a video stream transmitted through different channels;

[0006] In response to triggering of a preset event, determining a time difference between the audio stream and the video stream included in the media stream;

[0007] Obtaining buffer information of the media stream;

[0008] Based on the time difference and the buffering information, the size of the buffer of the media stream is adjusted so that the audio stream and the video stream included in the media stream are played synchronously.

[0009] According to a second aspect, a device for training a target model is provided, the device comprising:

[0010] A receiving module, used for receiving a media stream; the media stream includes an audio stream and a video stream transmitted through different channels;

[0011] A determination module, configured to determine a time difference between the audio stream and the video stream included in the media stream in response to a trigger of a preset event;

[0012] An acquisition module, used to acquire buffer information of the media stream;

[0013] The adjustment module is used to adjust the size of the buffer of the media stream based on the time difference and the buffer information, so that the audio stream and the video stream included in the media stream are played synchronously.

[0014] According to a third aspect, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of the above-mentioned first aspects is implemented.

[0015] According to a fourth aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of the first aspects is implemented.

[0016] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0017] The embodiments of the present disclosure provide a method and device for processing a media stream, which determines the time difference between the audio stream and the video stream included in the received media stream, obtains the buffer information of the media stream, and adjusts the size of the media stream buffer according to the time difference and the buffer information, so that the audio stream and the video stream included in the media stream can be played synchronously. The effect of audio and video synchronization is efficiently achieved without generating a large performance overhead.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0020] Figure 1 is a schematic diagram of an application scenario of media stream processing according to an exemplary embodiment of the present disclosure;

[0021] Figure 2 is a flow chart of a media stream processing method according to an exemplary embodiment of the present disclosure;

[0022] Figure 3 is a block diagram of a media stream processing device according to an exemplary embodiment of the present disclosure;

[0023] Figure 4is a schematic block diagram of an electronic device provided by some embodiments of the present disclosure;

[0024] Figure 5 is a schematic block diagram of another electronic device provided by some embodiments of the present disclosure;

[0025] Figure 6 is a schematic diagram of a storage medium provided in some embodiments of the present disclosure. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0027] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims.

[0028] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "the" and "the" used in this disclosure are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0030] With the continuous development of streaming media technology, streaming media is increasingly widely used in people's work, study and life. For example, in the scenario of online video conferencing or live broadcast, users need to hear both sound and picture, so audio and video need to be transmitted simultaneously. However, users have different requirements for audio and video. For example, users need to hear all sounds or need to hear the sound with the loudest volume, while the picture can be selectively viewed by the user. Therefore, audio and video are transmitted independently through different channels. The independent transmission of audio and video will cause the problem of audio and video being out of sync during playback. In addition, since users can switch between different pictures in the same scene, or the server can switch between different audios in the same scene as needed, it is necessary to adjust the synchronization relationship between audio and video according to the switching of audio or video.

[0031] In related technologies, audio and video synchronization is usually performed by modifying the code inside the client player. However, there are certain limitations to performing audio and video synchronization by modifying the client player code. For example, for a web player, namely WebRTC (Web Real-Time Communications), it is not possible to perform audio and video synchronization by modifying the code. In other related technologies, for WebRTC, the synchronization relationship between audio and video can be set through the SetRemoteSdp interface it provides to perform audio and video synchronization. However, this operation incurs a large performance consumption.

[0032] The present disclosure provides a media stream processing method, which determines the time difference between the audio stream and the video stream included in the received media stream, obtains the buffer information of the media stream, and adjusts the size of the media stream buffer according to the time difference and the buffer information, so that the audio stream and the video stream included in the media stream can be played synchronously. The effect of audio and video synchronization is efficiently achieved without generating a large performance overhead.

[0033] See also Figure 1 , is a schematic diagram of an application scenario of media stream processing according to an exemplary embodiment.

[0034] like Figure 1As shown, taking the application scenario of video conferencing as an example, device 101 is a media server held by the service provider, and device 102 is a client device held by the user. The client device establishes a communication connection with the media server through the network, and each client device can upload its collected video data and audio data to the media server respectively. After the media server receives the multi-channel audio data and multi-channel video data uploaded by each client device, it analyzes and summarizes and sends at least one audio stream to each client device respectively. And according to different requests of different users, the corresponding video stream is sent to the client device held by each user. After each client device receives the video stream and audio stream, it can perform audio and video synchronization operations so that the video stream and audio stream can be played synchronously.

[0035] In addition, the strength and other characteristics of the audio uploaded by each client device will change over time, and users will also switch videos according to their needs. Therefore, the media server will also continuously update the audio and video streams sent according to actual conditions. Each time the sent audio or video stream is updated, the client device needs to synchronize the audio and video so that the updated video and audio streams can be played synchronously.

[0036] The present disclosure will be described in detail below in conjunction with specific embodiments.

[0037] Figure 2 1 is a flowchart of a media stream processing method according to an exemplary embodiment. The method can be applied to a terminal device. In this embodiment, for ease of understanding, an example is given in conjunction with a terminal device capable of installing a media data playback client. Those skilled in the art can understand that the terminal device can include but is not limited to a mobile terminal device such as a smart phone, a tablet computer, a laptop computer, and a desktop computer. The method may include the following steps:

[0038] like Figure 2 As shown, in step 201, a media stream is received.

[0039] In this embodiment, the terminal device can receive a media stream sent by a media server, and the media stream may include an audio stream and a video stream, wherein the audio stream and the video stream are transmitted through different channels. For example, taking a video conference as an example, the client of the participating users can collect their own video data and audio data respectively, and upload the video data and audio data to the media server. The media server can send at least one audio stream to each client device uniformly based on characteristics such as the sound intensity of the audio through analysis and summary. When the characteristics such as the intensity of the audio uploaded by the user change, the media server will readjust the audio stream sent to the client device.

[0040] For example, the media server receives audio stream Y1 uploaded by user A through the client, audio stream Y2 uploaded by user B through the client, and audio stream Y3 uploaded by user C through the client. The media server can determine that the sound intensity corresponding to audio stream Y1 is the largest by analyzing the audio streams, so the media server can send audio stream Y1 to each client. At a certain moment, the sound intensity corresponding to audio stream Y2 becomes the largest, then the media server can switch audio stream Y1 to audio stream Y2, and send audio stream Y2 to each client.

[0041] In addition, the media server can send the video corresponding to the audio with the highest sound intensity to each client by default based on the audio data. The client user can also choose to request the media server to play the video he wants to play. The media server can send the selected video stream to the client held by the user based on the user's request.

[0042] For example, when the media server sends the audio stream Y1 to each client, the video stream S1 uploaded by user A through the client is also sent to each client by default. When the media server switches the audio stream Y1 to the audio stream Y2 and sends the audio stream Y2 to each client, the video stream S2 uploaded by user B through the client is also sent to each client by default. In addition, if user A selects the video stream S3 uploaded by C through the client through the client request, the media server can send the video stream S3 to the client of user A alone.

[0043] In step 202, in response to the triggering of a preset event, a time difference between an audio stream and a video stream included in a media stream is determined.

[0044] In this embodiment, under the triggering of a preset event, the client can determine the time difference between the audio stream and the video stream included in the media stream. The preset event may be that the media server updates the sent audio stream. For example, the media server first sends the audio stream Y1 corresponding to user A to each client. The preset event may be that the media server updates the audio stream Y1 sent to the client to the audio stream Y2 corresponding to user B.

[0045] The preset event may also be that the media server updates the sent video stream. For example, the media server first sends the video stream S1 corresponding to user A to the client of user B. The preset event may be that the media server updates the video stream S1 sent to the client of user B to the video stream S3 corresponding to user C.

[0046] The preset event may also be the arrival time of every preset period, for example, every n seconds, and the arrival time of n seconds is used as the time when the preset event is sent. It can be understood that the specific setting of the preset event is not limited in this embodiment.

[0047] In this embodiment, in response to the triggering of a preset event, the time difference between the audio stream and the video stream included in the media stream can be determined. Specifically, first, the first data packet of the current audio stream and the second data packet of the video stream can be determined. For example, the client can use the last audio data packet received before the current as the first data packet of the current audio stream. Use the last video data packet received before the current as the second data packet of the current video stream.

[0048] Then, the first collection time corresponding to the first data packet and the second collection time corresponding to the second data packet can be obtained. And the first receiving time corresponding to the first data packet and the second receiving time corresponding to the second data packet can be obtained. Specifically, the collection time can be obtained from the preset field of the data packet, and the receiving time can be obtained through the interface provided by the client. Optionally, the method can be applied to a player on the web side, so that the first collection time can be obtained from the extended field of the first data packet through the first interface provided by the web side, and the second collection time can be obtained from the extended field of the second data packet. At the same time, the first receiving time and the second receiving time are obtained through the second interface provided by the web side.

[0049] For example, when the media server sends a data packet (audio data packet or video data packet) to the client, an extension field for recording the acquisition time can be added to the sent data packet. After the web-side player receives the data packet, the interface RTCRtpReceiver.getSynchronizationSources can be used as the first interface to obtain the acquisition time recorded in the extension field of the data packet through the first interface. At the same time, the reception time when the data packet is received by the client can also be obtained through the first interface.

[0050] Next, the time difference may be calculated based on the first acquisition moment, the second acquisition moment, the first receiving moment, and the second receiving moment. Specifically, a first time interval between the first acquisition moment and the first receiving moment may be calculated, a second time interval between the second acquisition moment and the second receiving moment may be calculated, a first difference between the first time interval and the second time interval may be determined, and the first difference may be used as the time difference.

[0051] For example, the first acquisition time can be recorded as tc1, the second acquisition time can be recorded as tc2, the first receiving time can be recorded as tr1, the second receiving time can be recorded as tr2, and the time difference can be recorded as Δt. The following relationship can be obtained:

[0052] Δt=(tr1-tc1)-(tr2-tc2)

[0053] In step 203, buffer information of the media stream is obtained, and in step 204, the size of the buffer of the media stream is adjusted based on the time difference and the buffer information, so that the audio stream and the video stream included in the media stream are played synchronously.

[0054] In this embodiment, the buffer information of the media stream can be obtained, and the size of the buffer of the media stream can be adjusted by combining the buffer information and the above time difference. Specifically, in one implementation, the buffer of the video stream can be used as a reference to achieve audio and video synchronization by controlling the size of the buffer of the audio stream.

[0055] In another implementation, the audio stream buffer can be used as a reference to control the size of the video stream buffer to achieve audio and video synchronization. Specifically, if the method is applied to a player on the web side, the buffering time of multiple data packets corresponding to the audio stream in the media stream in the buffer within a preset period of time can be obtained through the second interface provided by the web side, and the average buffering time of multiple data packets in the buffer can be calculated as the buffering information of the media stream.

[0056] For example, the interface RTCRtpReceive.getStat provided by the web side can be used as the second interface, and the buffering information of the media stream can be determined through the second interface. Specifically, the RTCInboundRtpStreamStats structure of the media stream can be obtained through the second interface, and the structure includes the jitterBufferDelay field and the jitterBufferEmittedCount field. When the client receives the audio data packet, it puts the audio data packet into the buffer, and after a period of time, the audio data packet is taken out of the buffer. The length of time the audio data packet is stored in the buffer can be recorded in the jitterBufferDelay field, and the value in the jitterBufferEmittedCount field can be increased by one. The total length of time T from audio data packet m to audio data packet n stored in the buffer can be obtained from the jitterBufferDelay field through the second interface, and then the jitterBufferDelay field can be used to obtain the total length of time T from audio data packet m to audio data packet n stored in the buffer.

[0057] The jitterBufferEmittedCount field obtains the total number N of packets from audio packet m to audio packet n. Based on the total duration T and the total number N, the average buffering time of each audio packet in the buffer is calculated as the buffering information of the media stream.

[0058] Finally, the size of the buffer of the media stream can be adjusted according to the time difference and the buffer information so that the audio stream and the video stream included in the media stream are played synchronously. For example, the size of the buffer of the video stream can be adjusted based on the time difference and the average buffer time of the audio stream. Specifically, the sum of the average buffer time and the time difference can be calculated as an adjustment parameter, and the size of the buffer corresponding to the video stream in the media stream can be adjusted using the adjustment parameter.

[0059] For example, the average buffer time may be denoted as δ, the time difference may be denoted as Δt, and the adjustment parameter may be denoted as K. The following relationship may be obtained:

[0060] K=Δt+δ

[0061] K can be used to adjust the size of the buffer corresponding to the video stream in the media stream, so that K+(tr2-tc2)=(tr1-tc1)+δ, where K can be the average buffering time of each video packet in the buffer.

[0062] Specifically, the size of the buffer of the media stream can be set through the third interface provided by the web end. For example, the interface RTCRtpReceiver.playoutDelayHint provided by the web end can be used as the third interface, and K can be set in the third interface, so that the size of the buffer of the video stream can be controlled.

[0063] The present disclosure provides a media stream processing method, which determines the time difference between the audio stream and the video stream included in the received media stream, obtains the buffer information of the media stream, and adjusts the size of the media stream buffer according to the time difference and the buffer information, so that the audio stream and the video stream included in the media stream can be played synchronously. The effect of audio and video synchronization is efficiently achieved without generating a large performance overhead.

[0064] It should be noted that although the operations of the method of the disclosed embodiment are described in a specific order in the above embodiments, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flowchart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.

[0065] Corresponding to the aforementioned media stream processing method embodiment, the present disclosure also provides an embodiment of a media stream processing device.

[0066] like Figure 3 As shown, Figure 3It is a block diagram of a media stream processing device according to an exemplary embodiment of the present disclosure. The device may include: a receiving module 301, a determining module 302, an acquiring module 303 and an adjusting module 304.

[0067] The receiving module 301 is used to receive a media stream, where the media stream includes an audio stream and a video stream transmitted through different channels.

[0068] The determination module 302 is configured to determine the time difference between the audio stream and the video stream included in the media stream in response to the triggering of a preset event.

[0069] The acquisition module 303 is used to acquire buffer information of the media stream.

[0070] The adjustment module 304 is used to adjust the size of the buffer of the media stream based on the time difference and the buffer information, so that the audio stream and the video stream included in the media stream are played synchronously.

[0071] In some embodiments, the determination module 302 is configured to: determine the first data packet of the current audio stream and the second data packet of the video stream, obtain the first acquisition time corresponding to the first data packet and the second acquisition time corresponding to the second data packet, obtain the first receiving time corresponding to the first data packet and the second receiving time corresponding to the second data packet, and calculate the time difference based on the first acquisition time, the second acquisition time, the first receiving time, and the second receiving time.

[0072] In other embodiments, the method is applied to a web side, wherein the determination module 302 can obtain the first collection time corresponding to the first data packet and the second collection time corresponding to the second data packet in the following manner: through a first interface provided by the web side, obtain the first collection time from an extended field of the first data packet, and obtain the second collection time from the extended field of the second data packet.

[0073] The determination module 302 may obtain the first receiving time corresponding to the first data packet and the second receiving time corresponding to the second data packet in the following manner: obtaining the first receiving time and the second receiving time through the first interface.

[0074] In other embodiments, the determination module 302 can calculate the time difference based on the first acquisition moment, the second acquisition moment, the first receiving moment, and the second receiving moment in the following manner: calculate the first time interval between the first acquisition moment and the first receiving moment, calculate the second time interval between the second acquisition moment and the second receiving moment, and determine the difference between the first time interval and the second time interval as the time difference.

[0075] In other embodiments, the method is applied to a web side, wherein the acquisition module 303 is configured to: obtain the buffering time of multiple data packets corresponding to the audio stream in the media stream within a preset time period in the buffer through a second interface provided by the web side, and calculate the average buffering time of the multiple data packets in the buffer as buffering information.

[0076] In some other implementations, the adjustment module 304 is configured to: calculate the sum of the average buffering time and the time difference as an adjustment parameter, and use the adjustment parameter to adjust the size of the buffer corresponding to the video stream in the media stream.

[0077] In other implementations, the adjustment module 304 may use the adjustment parameters to adjust the size of the buffer corresponding to the video stream in the media stream in the following manner: using the adjustment parameters to set the size of the buffer of the media stream through a third interface provided by the web end.

[0078] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment scheme of the present disclosure. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0079] Figure 4 A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Figure 4 As shown, the electronic device 910 includes a processor 911 and a memory 912, which can be used to implement a client or a server. The memory 912 is used to store computer executable instructions (e.g., one or more computer program modules) non-transiently. The processor 911 is used to run the computer executable instructions, and when the computer executable instructions are run by the processor 911, one or more steps in the media stream processing method described above can be executed, thereby implementing the media stream processing method described above. The memory 912 and the processor 911 can be interconnected through a bus system and / or other forms of connection mechanisms (not shown).

[0080] For example, the processor 911 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) may be an X86 or ARM architecture, etc. The processor 911 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 910 to perform desired functions.

[0081] For example, the memory 912 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 911 may run one or more computer program modules to implement various functions of the electronic device 910. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.

[0082] It should be noted that, in the embodiments of the present disclosure, the specific functions and technical effects of the electronic device 910 can refer to the above description of the media stream processing method, which will not be repeated here.

[0083] Figure 5 A schematic block diagram of another electronic device provided for some embodiments of the present disclosure. The electronic device 920 is suitable for implementing the media stream processing method provided in the embodiments of the present disclosure, for example. The electronic device 920 may be a terminal device, etc., and may be used to implement a client or a server. The electronic device 920 may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. It should be noted that Figure 5 The electronic device 920 shown is only an example and does not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0084] like Figure 5As shown, the electronic device 920 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 921, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 922 or a program loaded from a storage device 928 into a random access memory (RAM) 923. In the RAM 923, various programs and data required for the operation of the electronic device 920 are also stored. The processing device 921, the ROM 922, and the RAM 923 are connected to each other via a bus 924. An input / output (I / O) interface 925 is also connected to the bus 924.

[0085] Typically, the following devices may be connected to the I / O interface 925: an input device 926 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 927 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 928 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 929. The communication device 929 may allow the electronic device 920 to communicate with other electronic devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 920 is shown to have various devices, but it should be understood that it is not required to implement or possess all of the devices shown, and the electronic device 920 may alternatively implement or possess more or fewer devices.

[0086] For example, according to an embodiment of the present disclosure, the above-mentioned media stream processing method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned media stream processing method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 929, or installed from the storage device 928, or installed from the ROM 922. When the computer program is executed by the processing device 921, the functions defined in the media stream processing method provided in the embodiment of the present disclosure can be implemented.

[0087] Figure 6 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Figure 6 As shown, the storage medium 930 may be a non-transitory computer-readable storage medium, which is used to store non-transitory computer-executable instructions 931. When the non-transitory computer-executable instructions 931 are executed by a processor, the media stream processing method described in the embodiment of the present disclosure may be implemented. For example, when the non-transitory computer-executable instructions 931 are executed by a processor, one or more steps in the media stream processing method described above may be executed.

[0088] For example, the storage medium 930 may be applied to the above-mentioned electronic device. For example, the storage medium 930 may include a memory in the electronic device.

[0089] For example, the storage medium may include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), flash memory, or any combination of the above storage media, or other applicable storage media.

[0090] For example, the description of the storage medium 930 can refer to the description of the memory in the embodiment of the electronic device, and the repeated parts are not repeated. The specific functions and technical effects of the storage medium 930 can refer to the description of the media stream processing method above, and are not repeated here.

[0091] It should be noted that in the context of the present disclosure, a computer-readable medium may be a tangible medium that may contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. A computer-readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by an instruction execution system, device or device or used in combination with it. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0092] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0093] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A media stream processing method, the method comprising: Receive media streams; The media streams include audio streams and video streams transmitted through different channels; In response to triggering of a preset event, determining a time difference between the audio stream and the video stream included in the media stream; Obtaining buffer information of the media stream; Based on the time difference and the buffering information, the size of the buffer of the media stream is adjusted so that the audio stream and the video stream included in the media stream are played synchronously.

2. The method according to claim 1, wherein: The determining the time difference between the audio stream and the video stream included in the media stream comprises: Determine a first data packet of the current audio stream and a second data packet of the video stream; Obtaining a first collection time corresponding to the first data packet and a second collection time corresponding to the second data packet; Obtaining a first receiving time corresponding to the first data packet and a second receiving time corresponding to the second data packet; The time difference is calculated based on the first collection time, the second collection time, the first receiving time, and the second receiving time.

3. The method according to claim 2, wherein: The method is applied to a web terminal, wherein obtaining a first collection time corresponding to the first data packet and a second collection time corresponding to the second data packet includes: Acquire the first collection time from the extension field of the first data packet through the first interface provided by the web terminal, and acquire the second collection time from the extension field of the second data packet; The obtaining of a first receiving time corresponding to the first data packet and a second receiving time corresponding to the second data packet includes: The first receiving time and the second receiving time are obtained through the first interface.

4. The method according to claim 2, wherein: The calculating the time difference based on the first acquisition time, the second acquisition time, the first receiving time, and the second receiving time includes: Calculating a first time interval between the first acquisition moment and the first receiving moment; Calculating a second time interval between the second acquisition moment and the second receiving moment; A difference between the first time interval and the second time interval is determined as the time difference.

5. The method according to claim 1, wherein: The method is applied to a web end, wherein obtaining the buffer information of the media stream includes: Obtaining, through a second interface provided by the web terminal, buffering time of multiple data packets corresponding to the audio stream in the media stream in a buffer within a preset time period; The average buffering time of the multiple data packets in the buffer is calculated as the buffering information.

6. The method according to claim 5, wherein: The adjusting the size of the buffer of the media stream based on the time difference and the buffer information includes: Calculate the sum of the average buffer time and the time difference as an adjustment parameter; The size of the buffer corresponding to the video stream in the media stream is adjusted using the adjustment parameter.

7. The method according to claim 6, wherein: The adjusting the size of the buffer corresponding to the video stream in the media stream by using the adjustment parameter includes: The adjustment parameter is used to set the size of the buffer of the media stream through a third interface provided by the web terminal.

8. A media stream processing device, the device comprising: A receiving module, used for receiving a media stream; the media stream includes an audio stream and a video stream transmitted through different channels; A determination module, configured to determine a time difference between the audio stream and the video stream included in the media stream in response to a trigger of a preset event; An acquisition module, used to acquire buffer information of the media stream; The adjustment module is used to adjust the size of the buffer of the media stream based on the time difference and the buffer information, so that the audio stream and the video stream included in the media stream are played synchronously.

9. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.