Playback processing method, device, electronic device and computer storage medium
Controlling the decoding of the decoding thread through the rendering thread solves the synchronization problem between the decoding thread and the rendering thread, improves the smoothness and system performance of multimedia data playback, and solves the problems of out-of-sync and stuck audio and video in traditional hard decoding technology. .
Patent Information
- Application Number
- CN202311862580.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-12-29
AI Technical Summary
The post-processing operations of traditional hard decoding technology consume a large amount of computing resources, resulting in out-of-synchronization and stuttering of audio and video, and the inability to provide a smooth multimedia playback experience, resulting in poor smoothness of multimedia data playback.
By controlling the decoding of the decoding thread through the rendering thread, the synchronization problem between the decoding thread and the rendering thread is solved, the system performance is improved, and the smoothness of multimedia data playback is improved.
By controlling the decoding rhythm of the decoding thread through the rendering thread, the synchronization problem between the decoding thread and the rendering thread is solved, and the fluency and system performance of multimedia data playback are significantly improved.
Smart Images

Figure CN117812332B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a playback processing method, device, electronic device and computer storage medium. Background Art
[0002] The post-processing operation of traditional hard decoding technology usually consumes a lot of computing resources, which easily leads to problems such as audio and video asynchrony and freezes. Therefore, the current player architecture performs poorly when handling post-processing operations and cannot provide a smooth multimedia playback experience, resulting in poor smoothness of multimedia data playback. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application embodiment provides a playback processing method, device, electronic device and computer storage medium, which can solve the synchronization problem between the decoding thread and the rendering thread and improve the smoothness of multimedia data playback.
[0004] In a first aspect, an embodiment of the present application provides a playback processing method, including:
[0005] In response to multimedia playback events, the decoder is started based on the rendering thread according to the multimedia scene;
[0006] Based on the rendering thread and according to the multimedia quality parameter of each multimedia data channel, each multimedia data channel is allocated to a target decoding thread corresponding to the decoder, so that each target decoding thread decodes the multimedia data therein;
[0007] After receiving the decoding completion signal of each target decoding thread, performing content recognition on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data;
[0008] Based on the rendering thread, post-processing parameter information is acquired according to the media content information of each channel of the decoded multimedia data, and data rendering is performed on each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data;
[0009] Based on the rendering thread, each channel of the multimedia content is synthesized according to the multimedia scene, and multimedia playback data is output.
[0010] In a second aspect, an embodiment of the present application provides a playback processing device, including:
[0011] A startup module is used to respond to multimedia playback events and start the decoder based on the rendering thread according to the multimedia scene;
[0012] A calling module, configured to allocate each channel of multimedia data to a target decoding thread corresponding to the decoder based on the rendering thread according to the multimedia quality parameter of each channel of multimedia data, so that each target decoding thread decodes the multimedia data therein;
[0013] A content identification module is used to, after receiving a decoding completion signal from each target decoding thread, perform content identification on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data;
[0014] A data rendering module, configured to obtain post-processing parameter information based on the media content information of each channel of the decoded multimedia data based on the rendering thread, perform data rendering on each channel of the decoded multimedia data, and obtain multimedia content corresponding to each channel of the decoded multimedia data;
[0015] The data synthesis module is used to synthesize the multimedia content of each channel based on the rendering thread and the multimedia scene, and output multimedia playback data.
[0016] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of computer programs; a processor loads the computer program from the memory to execute any one of the playback processing methods provided in the embodiment of the present application.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of computer programs, and the computer programs are suitable for loading by a processor to execute any one of the playback processing methods provided in the embodiments of the present application.
[0018] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which implements any one of the playback processing methods provided in the embodiments of the present application when the computer program is executed by a processor.
[0019] The embodiment of the present application controls the decoding of the decoding thread through the rendering thread. Therefore, the rendering thread can control the decoding rhythm of each frame in the decoding thread, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 This is one of the flowcharts of the playback processing method provided in the embodiment of the present application;
[0022] Figure 2 This is the second flowchart of the playback processing method provided in the embodiment of the present application;
[0023] Figure 3 is a schematic diagram of the interaction timing provided in an embodiment of the present application;
[0024] Figure 4 It is a structural diagram of a playback processing framework provided in an embodiment of the present application;
[0025] Figure 5 is a structural diagram of a playback processing device provided in an embodiment of the present application;
[0026] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0028] In the playback processing scenario, the post-processing operation of traditional hard decoding technology usually consumes a lot of computing resources, which easily leads to problems such as audio and video asynchrony and freezes. Therefore, the current player architecture performs poorly when handling post-processing operations and cannot provide a smooth multimedia playback experience, resulting in poor smoothness of multimedia data playback.
[0029] In order to solve the technical problems existing in the prior art, the embodiment of the present application responds to the multimedia playback event, starts the decoder based on the rendering thread according to the multimedia scene; based on the rendering thread, allocates each multimedia data to the target decoding thread corresponding to the decoder according to the multimedia quality parameters of each multimedia data, so that each target decoding thread decodes the multimedia data therein; after receiving the decoding completion signal of each target decoding thread, the rendering thread performs content recognition on the decoded multimedia data transmitted by each target decoding thread to obtain the media content information of each decoded multimedia data; based on the rendering thread, the post-processing parameter information is obtained according to the media content information of each decoded multimedia data, and the data is rendered on each decoded multimedia data to obtain the multimedia content corresponding to each decoded multimedia data; based on the rendering thread, each multimedia content is synthesized and processed according to the multimedia scene, and the multimedia playback data is output. Therefore, the embodiment of the present application can control the decoding of the decoding thread through the rendering thread, so that the rendering thread can control the decoding rhythm of each frame in the decoding thread, solve the synchronization problem between the decoding thread and the rendering thread, improve the overall performance of the system, and thus improve the smoothness of multimedia data playback.
[0030] The embodiment of the present application provides a playback processing method, device, electronic device and computer storage medium. Specifically, the embodiment of the present application will be described from the perspective of the playback processing device, and the playback processing device can be specifically integrated in the electronic device, that is, the playback processing method of the embodiment of the present application can be executed by the electronic device. Optionally, the electronic device includes a terminal device. The terminal device can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a game console, a personal computer (Personal Computer, PC), or a device such as an interactive tablet. Optionally, the electronic device includes a server, which can be an independent server or a server network or server cluster composed of servers, which includes but is not limited to a computer, a network host, a single network server, a network server set or a cloud server composed of servers. Among them, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing).
[0031] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown in the drawings.
[0032] The following is a detailed description with reference to the accompanying drawings. The present application embodiment is described with the rendering thread as the execution subject. Figure 1 , Figure 1This is one of the flowcharts of the playback processing method provided in the embodiment of the present application. The specific process of the playback processing method provided in the embodiment of the present application may be as follows: Steps 10 to 50, including:
[0033] Step 10, responding to the multimedia playback event, starting the decoder based on the rendering thread according to the multimedia scene.
[0034] The playback processing method of the embodiment of the present application can be applied to applications such as Xiaohongshu. Taking the application of Xiaohongshu as an example, the multimedia data can be video, audio, pictures, etc. In the embodiment of the present application, the Xiaohongshu app includes at least one rendering thread and at least one decoder. The decoder can be understood as a decoding thread pool. Therefore, a decoder includes at least one decoding thread.
[0035] Furthermore, when the user end of the Xiaohongshu app, such as the anchor end or the ordinary user end, needs to play multimedia, it is necessary to trigger a multimedia play event in the Xiaohongshu app. Therefore, the Xiaohongshu app responds to the multimedia play event and starts the rendering thread in the Xiaohongshu app.
[0036] Optionally, the rendering thread determines the multimedia scene according to the multimedia playback event, and calls the decoding agent according to the multimedia scene to start the decoder through the decoding agent. It should be noted that the multimedia playback event may include single-channel multimedia data or multi-channel multimedia data. Therefore, the multimedia scene may be a single-channel multimedia scene or a multi-channel multimedia scene, wherein single-channel multimedia data refers to multimedia data triggered by a single independent user terminal, and multi-channel multimedia data refers to multimedia data jointly triggered by multiple user terminals. Common scenarios are live broadcast or PK scenarios, which are jointly triggered by multiple user terminals.
[0037] Therefore, it can be understood that, different from the existing playback processing framework, in the playback processing framework in the embodiment of the present application, the rendering thread controls the decoding thread in the decoder.
[0038] Therefore, the process of starting the decoder according to the multimedia scene includes steps a1 to a2:
[0039] Step a1, responding to a multimedia playback event, if the multimedia scene is a single-channel multimedia scene, starting a decoder including a decoding thread based on a rendering thread; or,
[0040] Step a2, responding to a multimedia playback event, if the multimedia scene is a multi-channel multimedia scene, starting a decoder including at least one decoding thread based on a rendering thread.
[0041] Optionally, in response to a multimedia playback event, if it is determined that the multimedia playback event includes single-channel multimedia data, that is, the multimedia scene is a single-channel multimedia scene, in order to save decoder overhead, the rendering thread starts a decoder including a decoding thread.
[0042] Further, in response to a multimedia playback event, if it is determined that the multimedia playback event includes multiple multimedia data, that is, the multimedia scene is a multi-channel multimedia scene, in order to improve the decoding efficiency of the multimedia, the rendering thread starts a decoder including multiple decoding threads.
[0043] The embodiment of the present application starts decoders including different numbers of decoding threads through different multimedia scenarios, thereby saving decoder overhead and improving multimedia decoding efficiency.
[0044] Step 20 , allocating each channel of multimedia data to a target decoding thread corresponding to the decoder based on the multimedia quality parameter of each channel of multimedia data according to the rendering thread, so that each target decoding thread decodes the multimedia data therein.
[0045] Optionally, the embodiment of the present application takes the multimedia playback event that may include multiple channels of multimedia data, that is, the multimedia scene is a multi-channel multimedia scene as an example for explanation, therefore, the decoder started in this scene includes at least one decoding thread, and the decoding capabilities of each decoding thread are different, such as the decoding speed of a decoding thread with a high priority is faster than the decoding speed of a decoding thread with a low priority. Therefore, the rendering thread obtains the multimedia quality parameters of each channel of multimedia data, and in one embodiment, the multimedia quality parameters may include a bit rate parameter, a packet loss rate parameter, and a delay parameter.
[0046] Further, the rendering thread allocates each multimedia data to a target decoding thread corresponding to the decoder according to the multimedia quality parameter of each multimedia data. After receiving the multimedia data allocated by the rendering thread, each target decoding thread decodes the multimedia data to obtain decoded multimedia data, and transmits the decoded multimedia data to the rendering thread, as described in steps 201 to 203.
[0047] Step 30, after receiving the decoding completion signal of each target decoding thread, the rendering thread performs content recognition on the decoded multimedia data transmitted by each target decoding thread to obtain media content information of each channel of decoded multimedia data.
[0048] In the embodiment of the present application, after each target decoding thread completes decoding of the multimedia data, it will send a decoding completion signal to the rendering thread. Therefore, after receiving the decoding completion signal of each target decoding thread, the rendering thread obtains the decoded multimedia data transmitted by each target decoding thread.
[0049] Optionally, a multimedia recognition model based on machine learning (such as an audio recognition model, an image recognition model, a content recognition model, etc.) is pre-stored in the rendering thread. Therefore, the rendering thread can perform content recognition on the decoded multimedia data transmitted by each target decoding thread through the multimedia recognition model to obtain media content information of each decoded multimedia data. In one embodiment, the media content information may include resolution information and multimedia type information.
[0050] Step 40 , based on the rendering thread, obtain post-processing parameter information according to the media content information of each channel of decoded multimedia data, perform data rendering on each channel of decoded multimedia data, and obtain multimedia content corresponding to each channel of decoded multimedia data.
[0051] Optionally, the rendering thread obtains post-processing parameter information based on the media content information of each decoded multimedia data. In one embodiment, the post-processing parameter information may include post-processing effect texture information and post-processing optimization texture information, wherein the post-processing effect texture information includes denoising effect, sharpening effect, and color correction effect, and the post-processing optimization texture information includes enhancement optimization or repair optimization, as specifically described in steps 401 to 403.
[0052] Furthermore, the rendering thread performs data rendering on each channel of decoded multimedia data according to the post-processing parameter information of each channel of decoded multimedia data to obtain multimedia content corresponding to each channel of decoded multimedia data, as specifically described in steps 404 to 406 .
[0053] Step 50: synthesize each channel of multimedia content according to the multimedia scene based on the rendering thread, and output multimedia playback data.
[0054] Optionally, the multimedia scene of the embodiment of the present application is a multi-channel multimedia scene, therefore, the rendering thread needs to synthesize and process each channel of multimedia content, output multimedia playback data, that is, display the multimedia playback data on the screen to the display interface, as described in steps 501 to 502. Further, if the multimedia scene is a single-channel multimedia scene, the rendering thread does not need to synthesize and process the multimedia content, and directly displays the multimedia content on the screen as multimedia playback data on the display interface.
[0055] The embodiment of the present application controls the decoding of the decoding thread through the rendering thread. Therefore, the rendering thread can control the decoding rhythm of each frame in the decoding thread, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback.
[0056] In an optional embodiment, the description of steps 201 to 203 is as follows:
[0057] Step 201, based on the rendering thread, the bit rate adaptability score, packet loss rate score and delay score of each multimedia data channel are calculated according to the bit rate parameter, packet loss rate parameter and delay parameter of each multimedia data channel;
[0058] Step 202, calculating a multimedia quality score of each multimedia data channel based on the bit rate adaptability score, packet loss rate score and delay score of each multimedia data channel based on the rendering thread;
[0059] Step 203 : Allocate each channel of multimedia data to a target decoding thread corresponding to the decoder based on the multimedia quality score of each channel of multimedia data according to the rendering thread.
[0060] Optionally, the rendering thread calculates the bit rate adaptability score of each multimedia data channel according to the bit rate parameter of each multimedia data channel. The specific process is as follows:
[0061] The actual bit rate and theoretical maximum bit rate of each multimedia data are obtained, and the bit rate ratio of each multimedia data is calculated based on the actual bit rate and theoretical maximum bit rate of each multimedia data, that is, bit rate ratio = actual bit rate / theoretical maximum bit rate, wherein the theoretical maximum bit rate of each multimedia data can be estimated by parameters such as the resolution, frame rate and encoder type of each multimedia data. For example, for a segment of H.264 encoded multimedia data with a resolution of 720p and a frame rate of 30fps, its theoretical maximum bit rate can be calculated according to the following formula: theoretical maximum bit rate = frame rate * resolution * encoder complexity coefficient, where the encoder complexity coefficient is a constant, usually between 0.1 and 0.3. Further, a bit rate ratio threshold is set, which is a constant used to determine whether the bit rate adaptability of each multimedia data is good. Generally, the bit rate ratio threshold is between 0.8 and 1.2. Further, based on the bit rate ratio of the video and the bit rate ratio threshold, the bit rate adaptability score of each multimedia data is calculated. In one embodiment, if the bit rate ratio of each multimedia data channel is greater than or equal to the bit rate ratio threshold, the bit rate adaptability is considered to be good and the score is 1; otherwise, the score is the bit rate ratio divided by the bit rate ratio threshold, that is, bit rate adaptability score = min (bit rate ratio / bit rate ratio threshold, 1). For example, if the bit rate ratio threshold is set to 1, and the actual bit rate of each multimedia data channel is 800kbps, and the theoretical maximum bit rate is 1000kbps, then its bit rate ratio is 0.8, and therefore, the obtained bit rate adaptability score is: bit rate adaptability score = min (0.8 / 1, 1) = 0.8.
[0062] Furthermore, the rendering thread calculates the bitrate packet loss rate score of each multimedia data channel according to the packet loss rate parameter of each multimedia data channel. The specific process is as follows:
[0063] The range of the packet loss rate score of each multimedia data channel is set. Generally speaking, the packet loss rate score ranges from 0 to 1, indicating a situation from complete loss to no packet loss. Further, according to the packet loss rate of each multimedia data channel, the packet loss rate score of each multimedia data channel is calculated. The embodiment of the present application can use methods such as linear interpolation or exponential function for calculation.
[0064] For the linear interpolation method: the packet loss rate can be mapped to the range of packet loss rate scores according to the ratio between 0 and 1. For example, the following formula can be used for linear interpolation calculation: packet loss rate score = 1-packet loss rate, when the packet loss rate is 0, the score is 1; when the packet loss rate is 1, the score is 0.
[0065] For the exponential function method: an exponential function can be used to map the packet loss rate to a range of packet loss rate scores. For example, the following formula can be used for calculation: packet loss rate score = e^(-k*packet loss rate), where k is a constant used to adjust the curve of the exponential function. Usually, k is between 1 and 10.
[0066] Furthermore, the rendering thread calculates the delay score of each multimedia data channel according to the delay parameter of each multimedia data channel. The specific process is as follows:
[0067] Set a delay threshold for each multimedia data channel, which will be used to evaluate the delay score of each multimedia data channel. Calculate the delay score of each multimedia data channel: For each multimedia data channel, the delay score can be calculated using the following formula: Delay score = (delay threshold - actual delay) / delay threshold, where the actual delay refers to the delay time taken to receive each multimedia data channel. The delay score usually ranges from 0 to 1, indicating a relative assessment of the degree of delay, with a higher score indicating a smaller delay.
[0068] Furthermore, the rendering thread calculates the multimedia quality score of each multimedia data channel using the rate adaptability score, packet loss rate score and delay score of each multimedia data channel and their corresponding weight coefficients. Therefore, the multimedia quality score = a*rate adaptability score + b*packet loss rate score + c*delay score, where a, b and c are the weight coefficients of the rate adaptability score, packet loss rate score and delay score, respectively, and a+b+c=1.
[0069] It should be noted that if the multimedia quality score is lower than the preset score, it means that the quality of the multimedia data is low. In order to reduce the delay of the multimedia data, a high-priority decoding thread is required for decoding. If the multimedia quality score is higher than the preset score, it means that the quality of the multimedia data is high and can be decoded by a low-priority decoding thread. The preset score may be 0.7. Therefore, the rendering thread allocates the multimedia data with a multimedia quality score lower than the preset score to the high-priority decoding thread in the decoder, and allocates the multimedia data with a multimedia quality score higher than the preset score to the low-priority decoding thread in the decoder.
[0070] The embodiment of the present application allocates each channel of multimedia data to a target decoding thread corresponding to a decoder according to a multimedia quality score of each channel of multimedia data, thereby reducing the delay of the multimedia data, solving the synchronization problem between the decoding thread and the rendering thread, and improving the overall performance of the system, thereby improving the smoothness of multimedia data playback.
[0071] In an optional embodiment, the description of steps 401 to 403 is as follows:
[0072] Step 401, based on the rendering thread and according to the multimedia type information of each channel of decoded multimedia data, obtain post-processing effect texture information in the texture rendering environment;
[0073] Step 402, based on the rendering thread, obtain post-processing optimized texture information in the texture rendering environment according to the resolution information of each channel of decoded multimedia data;
[0074] Step 403 : Based on the rendering thread, the post-processing effect texture information and the post-processing optimization texture information are determined as post-processing parameter information of each channel of decoded multimedia data.
[0075] It should be noted that the texture rendering environment is configuration information for texture rendering created based on the rendering surface object provided by the upper layer application. The specific creation process is as described in steps b1 to b4.
[0076] Optionally, the rendering thread obtains post-processing effect texture information in the texture rendering environment according to the multimedia type information of each decoded multimedia data, where the post-processing effect texture information includes denoising effect, sharpening effect, color correction effect, distortion removal effect and special effect processing effect. The denoising effect refers to removing noise in the multimedia data, the sharpening effect refers to enhancing the edges and details of the multimedia data, the distortion removal effect refers to correcting the multimedia data, the color correction effect refers to adjusting the color of the multimedia data, and the special effect processing effect refers to performing specific processing on the multimedia data, including blurring, mosaic, mirroring, rotation, scaling, background replacement, etc.
[0077] Furthermore, the rendering thread obtains post-processing optimized texture information in the texture rendering environment according to the resolution information of each decoded multimedia data, wherein the post-processing optimized texture information can be enhanced optimization or repair optimization, wherein the enhanced optimization number refers to adjusting the brightness, contrast, saturation and other parameters of the multimedia data to improve the visual effect of the multimedia data, and the repair optimization refers to repairing the missing part of the information, the damaged part of the information, the occluded part of the information, etc. in the multimedia data.
[0078] Furthermore, the rendering thread determines the post-processing effect texture information and the post-processing optimization texture information as the post-processing parameter information of each channel of decoded multimedia data.
[0079] The multimedia type information and resolution information of each channel of decoded multimedia data in the embodiment of the present application can accurately obtain the post-processing parameter information of each channel of decoded multimedia data, so that the post-processing effect of the decoded multimedia data can achieve the optimal effect.
[0080] In an optional embodiment, the specific steps of creating a texture rendering environment include:
[0081] Step b1, obtaining a rendering surface object created by an upper-layer application based on a rendering thread, and creating a local window object with the rendering surface object;
[0082] Step b2: transferring the local window object to the underlying player based on the rendering thread, so that the underlying player can create a texture surface environment based on the local window object;
[0083] Step b3, obtaining the texture surface environment transmitted by the underlying player based on the rendering thread;
[0084] Step b4, associating and binding the texture surface environment and the local window object based on the rendering thread to obtain the texture rendering environment.
[0085] Optionally, an upper-layer application (such as an Android application or a Window application) creates a Surface object for carrying rendering results, namely a rendering surface object, through a corresponding API (Application Programming Interface), and passes the rendering surface Surface object to a rendering thread.
[0086] Furthermore, the rendering thread uses the rendering surface Surface object passed by the upper application to create a native Window object that interacts with the graphics system of the underlying player, that is, a local window object, and passes the native Window object to the underlying player, which can be passed through function parameters or API interfaces. Therefore, it can be understood that the rendering thread passes the native Window object to the underlying player through function parameters or API interfaces, and then creates a texture rendering environment through the underlying player.
[0087] In a rendering environment based on texture mapping obtained from a rendering surface object provided by an upper-level application, a graphics library or engine is usually required to perform texture drawing and rendering. In one embodiment, graphics libraries such as OpenGL or DirectX provide a rich graphics drawing API that can be used to create texture objects, set texture parameters, load texture data, and perform texture drawing and other operations. If you need to load a large amount of texture resources or perform texture drawing on a mobile device, you can consider using texture compression technologies such as ETC1, PVRTC, etc. Mipmapping is an optimization technology that can improve drawing performance and quality when drawing at a long distance or reducing the display. Specifically, Mipmapping generates a set of textures of different resolutions when loading textures, and selects the optimal texture for drawing according to actual needs. Shaders are a technology that programmatically controls graphics rendering. Shaders can be used to achieve various effects when drawing textures, such as lighting, shadows, transparency, etc. When drawing textures, texture caches can be used to improve rendering performance and avoid repeated loading and binding of texture objects.
[0088] The rendering thread passes the native Window object of the local window to the underlying player through function parameters or API interfaces. The underlying player uses the OpenGL ES extension-related API interfaces of EGL (Embedded System Graphics Library, embedded system graphics library) to create an EGL context and an EGL surface, namely, a texture surface environment, according to the native Window object of the local window. Furthermore, the rendering thread associates and binds the texture EGL surface environment with the native Window object of the local window to obtain a texture rendering environment, so that subsequent rendering operations can be performed through the texture EGL surface environment in the texture rendering environment. Therefore, the embodiment of the present application places the creation of the texture EGL surface environment in the underlying player, which better realizes the C++sdk encapsulation and integrity of the code.
[0089] It should be noted that before starting the decoder, the rendering thread needs to create a texture rendering object and connect to the decoder through the texture rendering object so that the decoded multimedia data transmitted by the decoding thread in the decoder can be received later. The specific process includes:
[0090] Step c1, creating a texture rendering object based on a rendering thread;
[0091] Step c2: Based on the rendering thread, the texture rendering object is passed to the upper-layer application, so that the upper-layer application can create a texture rendering surface based on the texture rendering object, and initialize the decoding thread based on the texture rendering surface, establish an association between the decoding thread and the texture rendering object, so that the decoding thread in the decoder transmits the decoded multimedia data to the texture rendering object.
[0092] Optionally, the rendering thread creates an external OES texture object, i.e., a texture rendering object, which is used to receive decoded multimedia data obtained by the decoding thread in the decoder (such as a hard decoder and a soft decoder, etc.), wherein the texture OES rendering object is a special texture type that can be seamlessly integrated with OpenGL ES and the decoding thread.
[0093] Furthermore, the rendering thread passes the created texture OES rendering object to the upper application, and the upper application creates a special texture rendering surface Surface according to the texture OES rendering object, and associates the texture rendering surface OES_Surface with the texture OES rendering object, and uses the texture rendering surface OES_Surface in the association result as input to initialize the media decoding thread, so that the decoding thread establishes an association relationship with the texture OES rendering object. Therefore, after the decoding thread decodes the multimedia data, it outputs the decoded multimedia data obtained after decoding to the texture OES rendering object.
[0094] The embodiment of the present application associates the texture rendering object of the rendering thread with the decoding thread, so that the rendering thread can control the decoding rhythm of each frame in the decoding thread, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback.
[0095] In an optional embodiment, the description of steps 404 to 406 is as follows:
[0096] Step 404, based on the rendering thread, obtaining a decoding frame rate of each target decoding thread in a process of decoding its multimedia data, and obtaining a data rendering strategy of the rendering thread;
[0097] Step 405, determining the rendering frame rate of each channel of decoded multimedia data based on the rendering thread according to the decoding frame rate of each target decoding thread and the data rendering strategy;
[0098] Step 406 , based on the rendering thread, data rendering is performed on each channel of decoded multimedia data according to the rendering frame rate and post-processing parameter information of each channel of decoded multimedia data to obtain multimedia content corresponding to each channel of decoded multimedia data.
[0099] Optionally, the rendering thread obtains the decoding frame rate of each target decoding thread during the decoding process of its multimedia data, and obtains the data rendering strategy of the rendering thread. In one embodiment, the data rendering strategy may include a fixed frame rate rendering strategy and a dynamic frame rate rendering strategy. The fixed frame rate rendering strategy renders the multimedia data at a fixed frame rate, and the dynamic frame rate rendering strategy renders the multimedia data at a dynamic frame rate. Further, the rendering thread determines the rendering frame rate of each channel of the decoded multimedia data according to the decoding frame rate of each target decoding thread and the data rendering strategy, as shown in steps 4051 to 4052.
[0100] Furthermore, the rendering thread performs data rendering on each channel of decoded multimedia data according to the rendering frame rate and post-processing parameter information of each channel of decoded multimedia data to obtain multimedia content corresponding to each channel of decoded multimedia data.
[0101] In the embodiment of the present application, a rendering frame rate is determined by a rendering thread according to the decoding frame rate of each target decoding thread, so that the synchronization between rendering and decoding can be ensured through the rendering frame rate, thereby solving the synchronization problem between the decoding thread and the rendering thread, improving the overall performance of the system, and thus improving the smoothness of multimedia data playback.
[0102] In an optional embodiment, the description of step 4051 to step 4052 is as follows:
[0103] Step 4051, if the data rendering strategy is a fixed frame rate rendering strategy, then based on the rendering thread, the decoding frame rate of each target decoding thread is determined as the rendering frame rate of each channel of decoded multimedia data; or,
[0104] Step 4052: If the data rendering strategy is a dynamic frame rate rendering strategy, a rendering performance coefficient of the rendering thread is obtained based on the rendering thread, and a rendering frame rate of each channel of decoded multimedia data is determined based on the rendering performance coefficient and the decoding frame rate of each target decoding thread.
[0105] Optionally, if the data rendering strategy is a fixed frame rate rendering strategy, the rendering thread determines the decoding frame rate of each target decoding thread as the rendering frame rate of each channel of decoded multimedia data.
[0106] Further, if the data rendering strategy is a dynamic frame rate rendering strategy, the rendering thread obtains the rendering performance coefficient of the rendering thread, wherein the rendering performance coefficients of different rendering threads are different, and the rendering capability of the rendering thread is proportional to the rendering performance coefficient. Further, the rendering thread calculates the product of the rendering performance coefficient and the decoding frame rate of each target decoding thread, and determines the product result as the rendering frame rate of each channel of decoded multimedia data, that is, the rendering frame rate of each channel of decoded multimedia data = the decoding frame rate of each target decoding thread * the rendering performance coefficient.
[0107] In the embodiment of the present application, a rendering frame rate is determined by a rendering thread according to the decoding frame rate of each target decoding thread, so that the synchronization between rendering and decoding can be ensured through the rendering frame rate, thereby solving the synchronization problem between the decoding thread and the rendering thread, improving the overall performance of the system, and thus improving the smoothness of multimedia data playback.
[0108] In an optional embodiment, in order to ensure synchronization between rendering and decoding and improve the smoothness of multimedia data playback, during the process of rendering multimedia data by the rendering thread, the embodiment of the present application may use different data buffering mechanisms, and the specific process includes:
[0109] Step d1, based on the rendering thread, performing a rendering operation on each channel of current frame decoded multimedia data with the rendering frame rate and post-processing parameter information of each channel of decoded multimedia data, completing the rendering operation on each channel of current frame decoded multimedia data, and obtaining a data buffering mechanism in the data rendering process of each channel of decoded multimedia data;
[0110] Step d2, if the data buffer mechanism is a single buffer mechanism, then based on the rendering thread according to the rendering frame rate and post-processing parameter information of the next frame of decoded multimedia data sent by each target decoding thread, the rendering operation is performed on the next frame of decoded multimedia data sent by each target decoding thread until the decoding completion signal output by each target decoding line is no longer received; or,
[0111] Step d3, if the data buffering mechanism is a double buffering mechanism, based on the rendering thread, according to the rendering frame rate and post-processing parameter information of the new decoded multimedia data detected in the texture rendering object, the new decoded multimedia data detected in the texture rendering object is rendered until no new decoded multimedia data is detected in the texture rendering object.
[0112] Optionally, the rendering thread performs rendering operations on each channel of current frame decoded multimedia data according to the rendering frame rate and post-processing parameter information of each channel of decoded multimedia data, completes the rendering operation on each channel of current frame decoded multimedia data, and obtains a data buffering mechanism during the data rendering process for each channel of decoded multimedia data. In one embodiment, the data buffering mechanism may include a single buffering mechanism and a double buffering mechanism, wherein the single buffering mechanism buffers according to the decoding completion signal output by each target decoding line, and the double buffering mechanism buffers according to the decoded multimedia data in the texture rendering object, and the texture rendering object is an object for storing the decoded multimedia data of each target decoding thread, and the process of creating a texture rendering object is as described in steps c1 to c2 above.
[0113] The data buffering mechanism is a single buffering mechanism:
[0114] The rendering thread monitors in real time whether the decoding completion signal output by each target decoding line is received.
[0115] Furthermore, if a decoding completion signal output by each target decoding line is received, the rendering thread obtains the rendering frame rate and post-processing parameter information of the next frame of decoded multimedia data sent by each target decoding thread, as specifically described in the above embodiment.
[0116] Furthermore, the rendering thread performs rendering operations on the next frame of decoded multimedia data sent by each target decoding thread according to the rendering frame rate and post-processing parameter information of the next frame of decoded multimedia data sent by each target decoding thread until the decoding completion signal output by each target decoding line is no longer received.
[0117] The data buffering mechanism is a double buffering mechanism:
[0118] The rendering thread detects in real time whether there is new decoded multimedia data in the texture rendering object.
[0119] Further, if it is detected that new decoded multimedia data exists in the texture rendering object, the rendering thread obtains the rendering frame rate and post-processing parameter information of the new decoded multimedia data detected in the texture rendering object, as specifically described in the above embodiment.
[0120] Furthermore, the rendering thread performs rendering operations on the new decoded multimedia data detected in the texture rendering object according to the rendering frame rate and post-processing parameter information of the new decoded multimedia data detected in the texture rendering object until no new decoded multimedia data is detected in the texture rendering object.
[0121] In the process of rendering multimedia data, the embodiment of the present application uses a single buffer mechanism and a double buffer mechanism to ensure the synchronization between rendering and decoding, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback.
[0122] In an optional embodiment, the description of step 501 to step 502 is as follows:
[0123] Step 501, if the multimedia scene is a multi-channel multimedia scene and the data synthesis strategy is a timestamp strategy, then based on the rendering thread, each channel of multimedia content is synthesized according to the time difference information of each channel of multimedia content, and the multimedia playback data is output; or,
[0124] Step 502: If the multimedia scene is a multi-channel multimedia scene and the data synthesis strategy is a delay strategy, each channel of multimedia content is synthesized based on the rendering thread according to the delay difference information of each channel of multimedia content, and the multimedia playback data is output.
[0125] Optionally, in the case where the multimedia scene is a multi-channel multimedia scene, different data synthesis strategies can be used for synthesis in the process of synthesizing and processing the multi-channel multimedia content. In one embodiment, the data synthesis strategy may include a timestamp strategy and a delay strategy, wherein the timestamp strategy is to perform synthesis processing based on the timestamp information of each channel of multimedia content, and the delay strategy is to perform synthesis processing based on the delay difference information of each channel of multimedia content.
[0126] Therefore, if the multimedia scene is a multi-channel multimedia scene and the data synthesis strategy is a timestamp strategy, the rendering thread obtains the time difference information of each channel of multimedia content, and synthesizes each channel of multimedia content according to the time difference information of each channel of multimedia content, and outputs the multimedia playback data, as described in steps 5011 to 5014.
[0127] Furthermore, if the multimedia scene is a multi-channel multimedia scene and the data synthesis strategy is a delay strategy, the rendering thread obtains the delay difference information of each channel of multimedia content, and synthesizes each channel of multimedia content according to the delay difference information of each channel of multimedia content, and outputs multimedia playback data, as specifically described in steps 5021 to 5024.
[0128] The embodiment of the present application synthesizes each channel of multimedia content according to different data synthesis strategies, thereby avoiding delays in multimedia playback data and improving the smoothness of multimedia data playback.
[0129] In an optional embodiment, the description of steps 5011 to 5014 is as follows:
[0130] Step 5011, obtaining the timestamp information of each multimedia content based on the rendering thread, and obtaining the main multimedia content in each multimedia content;
[0131] Step 5012, based on the rendering thread, using the timestamp information of the main multimedia content as the reference timestamp information, determining the time difference information between the timestamp information of each non-main multimedia content and the reference timestamp information;
[0132] Step 5013, adjusting the timestamp information of each non-main multimedia content according to the time difference information of each non-main multimedia content based on the rendering thread;
[0133] Step 5014: sort each channel of multimedia content according to the adjusted timestamp information based on the rendering thread to obtain sorted multimedia content, and synthesize the sorted multimedia content according to the order of the timestamps to output multimedia playback data.
[0134] Optionally, the rendering thread obtains the timestamp information of each multimedia content, and obtains the main multimedia content in each multimedia content, wherein the main multimedia content is any multimedia content in each multimedia content, and the main multimedia content is used to determine the reference time axis of the final synthesized multimedia playback data, that is, the timestamp information of the main multimedia content is determined as the reference timestamp information, therefore, the remaining multimedia content except the main multimedia content in each multimedia content can be understood as non-main multimedia content. The timestamp information can be an absolute time (a timestamp at the millisecond level) or a relative time (a frame number), and these timestamp information are used to determine the temporal sequence of each multimedia content in time.
[0135] Furthermore, the rendering thread uses the timestamp information of the main multimedia content as the reference timestamp information to determine the time difference information between the timestamp information of each non-main multimedia content and the reference timestamp information, that is, the time difference information of each non-main multimedia content = the timestamp information of each non-main multimedia content - the reference timestamp information.
[0136] It should be noted that, in order to avoid sudden changes or freezes, the embodiment of the present application may consider using interpolation technology to smoothly process the time difference information between each channel of multimedia content. The specific process is as follows:
[0137] The rendering thread obtains the multimedia content with the smallest time difference in the time difference information of each non-main multimedia content as the reference multimedia content, and aligns the time points of the time difference information of other non-main multimedia content with the time points of the reference multimedia content.
[0138] Further, the rendering thread adjusts the timestamp information of each non-main multimedia content according to the time difference information of each non-main multimedia content. In one embodiment, the process of adjusting the timestamp information of each non-main multimedia content is: adding or subtracting the time difference information of each non-main multimedia content to the timestamp information of each non-main multimedia content to obtain the adjusted timestamp information of each non-main multimedia content.
[0139] Furthermore, the rendering thread sorts each channel of multimedia content according to the adjusted timestamp information to obtain sorted multimedia content, and synthesizes the sorted multimedia content according to the order of the timestamps to output multimedia playback data.
[0140] The embodiment of the present application synthesizes each channel of multimedia content according to the data synthesis strategy of the timestamp, thereby avoiding the delay of the multimedia playback data and improving the smoothness of the multimedia data playback.
[0141] In an optional embodiment, the description of steps 5021 to 5024 is as follows:
[0142] Step 5021, creating a multimedia content buffer based on the rendering thread;
[0143] Step 5022, determining a synthesis time point of each channel of multimedia content based on the delay difference information of each channel of multimedia content according to the rendering thread;
[0144] Step 5023, filling each channel of multimedia content into the multimedia content buffer according to the time point sequence of the synthesis time point of each channel of multimedia content based on the rendering thread;
[0145] Step 5024: Based on the rendering thread, each channel of multimedia content in the multimedia content buffer is synthesized in a time sequence to output multimedia playback data.
[0146] Optionally, the rendering thread creates a multimedia content buffer, wherein the multimedia content buffer is used to temporarily store multimedia content to be synthesized, and the size of the multimedia content buffer can be set according to actual needs and the performance of the rendering thread.
[0147] Furthermore, the rendering thread obtains the delay difference information of each multimedia content, specifically:
[0148] The rendering thread obtains the timestamp information of each multimedia content, and performs difference calculation between the timestamp information of each multimedia content and the current timestamp information. The obtained time difference information of each multimedia content is the delay difference information of each multimedia content.
[0149] Furthermore, the rendering thread determines the synthesis time point of each multimedia content according to the delay difference information of each multimedia content, that is, according to the delay difference information of each multimedia content, predicts the position point of each multimedia content in the multimedia content buffer. In one embodiment, assuming that the time range of the multimedia content buffer is [0, T], the synthesis time points in the multimedia content buffer are spaced at 0.1T, T is the total duration of the multimedia content buffer, the delay difference information of multimedia content 1 is 0.5T, the delay difference information of multimedia content 1 is 0, and the delay difference information of multimedia content 3 is 0.3T, then multimedia content 1 is at the 6th synthesis time point of the multimedia content buffer, multimedia content 2 is at the 1st synthesis time point of the multimedia content buffer, and multimedia content 3 is at the 4th synthesis time point of the multimedia content buffer.
[0150] Furthermore, the rendering thread fills each channel of multimedia content into the multimedia content buffer according to the time point sequence of the synthesis time point of each channel of multimedia content.
[0151] Furthermore, when synthesizing multimedia contents, the rendering thread synthesizes each channel of multimedia contents in the multimedia content buffer in a chronological order and outputs multimedia playback data.
[0152] It should be noted that the size of the multimedia content buffer is dynamically adjusted according to the delay difference of each multimedia content in real time. If the delay of the multimedia content of a certain user end is large, the size of the multimedia content buffer can be appropriately increased to ensure that the multimedia data stream can be synthesized and played on time at the time of playback. Conversely, if the delay of the multimedia content of a certain user end is small, the size of the multimedia content buffer can be appropriately reduced to improve the real-time performance of the playback.
[0153] At the same time, according to the delay difference of each multimedia content in real time, reasonable delay processing is performed on each multimedia content. For example, if the delay of multimedia content at a certain user end is large, the multimedia content can be appropriately delayed to ensure synchronization with other multimedia content. Conversely, if the delay of multimedia content at a certain user end is small, the frame of the multimedia content can be appropriately advanced to ensure smoothness and synchronization of playback.
[0154] The embodiment of the present application synthesizes each channel of multimedia content according to a data synthesis strategy of delay difference, thereby avoiding delay in multimedia playback data and improving the smoothness of multimedia data playback.
[0155] Further, the embodiment of the present application takes multiple anchor terminals (such as anchor terminal A and anchor terminal B) as an example to initiate a live broadcast and microphone connection scenario in the Xiaohongshu app, referring to Figure 2 , Figure 2 This is the second flow chart of the playback processing method provided in the embodiment of the present application. Among them, the data synthesis strategy is a delay strategy, and the time range of the multimedia content buffer is [0, T], the synthesis time points in the multimedia content buffer are spaced at 0.1T, and the live videos of different anchor terminals are delayed. The process of obtaining multimedia playback data of multiple anchor terminals through the playback processing method of the embodiment of the present application is:
[0156] Host A selects host B on the live broadcast connection interface of the Xiaohongshu app, or host B selects host A on the live broadcast connection interface of the Xiaohongshu app to enter the live broadcast connection.
[0157] The rendering thread starts a decoder, which includes at least a decoding thread of a first priority (high priority) and a decoding thread of a second priority (low priority).
[0158] Furthermore, the rendering thread obtains the video quality parameters of video data 1 of anchor terminal A and the video quality parameters of video data 2 of anchor terminal B. The video quality score calculated according to the video quality parameters of video data 1 is 0.5, and the video quality score calculated according to the video quality parameters of video data 2 is 0.8. Therefore, the rendering thread assigns video data 1 to the first priority decoding thread for decoding, and assigns video data 2 to the second priority decoding thread for decoding.
[0159] Further, after receiving the decoding completion signal from the decoding thread of the first priority, the rendering thread performs content recognition on the decoded video data 1 output by the decoding thread of the first priority, obtains the video content information 1 of the decoded video data 1, and obtains the post-processing parameter information 1 according to the video content information 1. Further, the rendering thread renders the decoded video data 1 by the post-processing parameter information 1, obtains the multimedia content 1, and determines that the delay difference between the timestamp of the multimedia content 1 and the current timestamp is 0.1T, at which point the multimedia content 1 is stored at the second synthesis time point in the multimedia content buffer.
[0160] Further, after receiving the decoding completion signal from the second priority decoding thread, the rendering thread performs content recognition on the decoded video data 2 output by the second priority decoding thread, obtains the video content information 2 of the decoded video data 2, and obtains the post-processing parameter information 2 according to the video content information 2. Further, the rendering thread renders the decoded video data 2 by the post-processing parameter information 2, obtains the multimedia content 2, and determines that the delay difference between the timestamp of the multimedia content 2 and the current timestamp is 0T, at which point the multimedia content 2 is stored in the first synthesis time point in the multimedia content buffer.
[0161] Furthermore, when the rendering thread is synthesizing the video playback data of the host terminal A and the host terminal B, A synthesizes the multimedia content 2 and the multimedia content 1 in the order of the synthesis time points to obtain the video playback data of the host terminal A and the host terminal B.
[0162] Optionally, it can be understood that in the loop of the rendering thread, the rendering thread calls the corresponding decoding method to start the decoder, that is, calls the decoding thread through the corresponding decoding method to decode the multimedia data. Therefore, the decoding thread will synchronize the decoded multimedia data obtained after decoding to the texture OES rendering object for subsequent use in OpenGL rendering operations.
[0163] In the embodiment of the present application, the texture-related API of OpenGL ES can be used to copy the decoded multimedia data received after decoding to the texture OES rendering object. Therefore, the rendering thread can obtain the decoded multimedia data returned by the decoding thread in the texture OES rendering object.
[0164] Further, the rendering thread obtains the texture object of the decoded multimedia data, and performs post-processing on the texture object of the decoded multimedia data. Post-processing generally refers to the process of further processing and optimizing the multimedia data that has been basically processed (such as decoding, editing, etc.) in the multimedia processing flow. The specific content of post-processing will vary according to the multimedia type and application scenario. In the field of video processing, post-processing may include video filters: color adjustment and filter effect addition to the video to improve the picture quality or give a specific visual effect. Image stabilization: image stabilization processing is performed on the video to eliminate the jitter caused by camera shaking or movement to improve the viewing experience. Video noise reduction: eliminate noise in the video to make the image clearer. Video compression: compress and encode the video to reduce the file size or improve the transmission efficiency. In the field of audio processing, post-processing may include audio equalization: adjust the spectral characteristics of the audio to balance the volume in each frequency band. Reverberation / echo cancellation: increase or decrease the reverberation effect of the audio, or eliminate the echo problem that may exist during recording. Dynamic range control: adjust the dynamic range of the audio to make it more balanced and suitable for various environments during playback.
[0165] Therefore, it is necessary to add post-processing capabilities to the rendering chain of the rendering thread to meet user needs for bullet screens, special effects, color blindness mode, etc. Post-processing capabilities can include various enhancements, special effects processing and adjustments, and customized video effects can be achieved by processing the decoded textures.
[0166] Therefore, the process of post-processing the texture object of the decoded multimedia data is specifically as follows:
[0167] The rendering thread inputs the texture OES object of the decoded multimedia data as an input object into the texture rendering environment for texture rendering, and performs various processing operations through the post-processing module, such as applying filters, special effects, color blindness, image enhancement, etc. These processing operations can be implemented based on the OpenGL shader language (GLSL). By writing a custom shader program to operate on the texture, the multimedia content rendered by the decoded multimedia data is obtained, and the rendered multimedia content is played and displayed on the screen.
[0168] Furthermore, when it is necessary to stop decoding, the stop method of the decoding thread is called to end the decoding process of the decoding thread, which can be done in the loop of the rendering thread or at other appropriate times.
[0169] It should be noted that if the post-processing and rendering parameter configuration needs to be changed in real time, it can be achieved by adjusting the rendering thread and rendering link. For example, filter effects and special effect parameters can be adjusted dynamically to meet the user's real-time adjustment needs for video effects. When the player exits or is destroyed, the relevant rendering resources, including rendering threads, rendering links, and rendering environments, are released and destroyed in a timely manner to ensure effective management and release of resources and avoid resource leakage and system load.
[0170] The embodiment of the present application controls the decoding of the decoding thread through the rendering thread. Therefore, the rendering thread can control the decoding rhythm of each frame in the decoding thread, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback.
[0171] In one embodiment, referring to Figure 3 , Figure 3 This is a schematic diagram of the interaction timing provided in the embodiment of the present application. The specific interaction process is as follows:
[0172] S1: The upper-layer application creates a rendering surface object and passes the rendering surface object to the rendering thread.
[0173] S2: The rendering thread creates a local window object based on the rendering surface object and passes the local window object to the underlying player.
[0174] S3: The underlying player creates a texture surface environment based on the local window object and passes the texture surface environment to the rendering thread.
[0175] S4: The rendering thread associates and binds the texture surface environment and the local window object to obtain the texture rendering environment, creates a texture rendering object, and passes the texture rendering object to the upper application.
[0176] S5: The upper layer application creates a texture rendering surface based on the texture rendering object, initializes the decoding thread based on the texture rendering surface, and establishes an association relationship between the decoding thread and the texture rendering object.
[0177] S6: The rendering thread responds to the multimedia playback event and starts the decoder according to the multimedia scene; and distributes each channel of multimedia data to a target decoding thread corresponding to the decoder according to the multimedia quality parameter of each channel of multimedia data.
[0178] S7: Each target decoding thread decodes the multimedia data therein and outputs the decoded multimedia data.
[0179] S8: After the rendering thread receives the decoding completion signal from each target decoding thread, it performs content identification on the decoded multimedia data transmitted by each target decoding thread to obtain the media content information of each decoded multimedia data; obtains post-processing parameter information according to the media content information of each decoded multimedia data, performs data rendering on each decoded multimedia data, and obtains the multimedia content corresponding to each decoded multimedia data; synthesizes each multimedia content according to the multimedia scene, and outputs multimedia playback data.
[0180] The following describes the playback processing framework provided by the embodiment of the present application. Figure 4 As shown, Figure 4 It is a structural diagram of a playback processing framework provided in an embodiment of the present application. The playback processing framework may include: a rendering thread, a decoding thread, an upper layer application, and an underlying player;
[0181] The upper layer application is used to create a rendering surface object and pass the rendering surface object to the rendering thread.
[0182] The rendering thread is used to: create a local window object based on the rendering surface object and pass the local window object to the underlying player.
[0183] The underlying player is used to create a texture surface environment based on the local window object and pass the texture surface environment to the rendering thread.
[0184] The rendering thread is used to associate and bind the texture surface environment and the local window object, obtain the texture rendering environment, create a texture rendering object, and pass the texture rendering object to the upper application.
[0185] The upper layer application is used to: create a texture rendering surface based on the texture rendering object, initialize the decoding thread based on the texture rendering surface, and establish an association relationship between the decoding thread and the texture rendering object.
[0186] The rendering thread is used to: respond to multimedia playback events, call the decoding agent according to the multimedia scene to start the decoder; and distribute each multimedia data to the target decoding thread corresponding to the decoder according to the multimedia quality parameters of each multimedia data.
[0187] Each target decoding thread is used to decode the multimedia data therein and output the decoded multimedia data.
[0188] The rendering thread is used to: after receiving the decoding completion signal of each target decoding thread, perform content recognition on the decoded multimedia data transmitted by each target decoding thread to obtain the media content information of each decoded multimedia data; obtain post-processing parameter information according to the media content information of each decoded multimedia data, perform data rendering on each decoded multimedia data to obtain the multimedia content corresponding to each decoded multimedia data; synthesize and process each multimedia content according to the multimedia scene, and output multimedia playback data; and display the multimedia playback data on the screen.
[0189] It should be noted that when the external texture content needs to be updated, the external texture image can be triggered to update the external texture content.
[0190] The present application implements the decoding of the decoding thread controlled by the rendering thread. Therefore, the rendering thread can control the decoding rhythm of each frame in the decoding thread, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback.
[0191] The following describes the playback processing device provided by the embodiment of the present application. The playback processing device described below and the playback processing method described above can be referred to in correspondence with each other. Figure 5 , Figure 5 : is a schematic diagram of the structure of a playback processing device provided in an embodiment of the present application. The playback processing device may include:
[0192] A start module 501 is used to respond to a multimedia playback event and start a decoder based on a rendering thread according to a multimedia scene;
[0193] A calling module 502 is used to allocate each channel of multimedia data to a target decoding thread corresponding to the decoder based on the rendering thread according to the multimedia quality parameter of each channel of multimedia data, so that each target decoding thread decodes the multimedia data therein;
[0194] The content identification module 503 is used to perform content identification on the decoded multimedia data transmitted by each of the target decoding threads based on the rendering thread after receiving the decoding completion signal of each of the target decoding threads, so as to obtain the media content information of each of the decoded multimedia data;
[0195] A data rendering module 504 is configured to obtain post-processing parameter information based on the media content information of each channel of the decoded multimedia data based on the rendering thread, perform data rendering on each channel of the decoded multimedia data, and obtain multimedia content corresponding to each channel of the decoded multimedia data;
[0196] The data synthesis module 505 is used to synthesize each channel of the multimedia content according to the multimedia scene based on the rendering thread and output multimedia playback data.
[0197] The embodiment of the present application controls the decoding of the decoding thread through the rendering thread. Therefore, the rendering thread can control the decoding rhythm of each frame in the decoding thread, solves the synchronization problem between the decoding thread and the rendering thread, improves the overall performance of the system, and thus improves the smoothness of multimedia data playback.
[0198] The specific embodiments of the playback processing device provided in this application are basically the same as the embodiments of the playback processing method, and will not be described in detail here.
[0199] Optional, such as Figure 6 As shown, Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call a computer program in the memory 630 to execute the steps of the playback processing method, for example, including:
[0200] In response to multimedia playback events, the decoder is started based on the rendering thread according to the multimedia scene;
[0201] Based on the rendering thread and according to the multimedia quality parameter of each multimedia data channel, each multimedia data channel is allocated to a target decoding thread corresponding to the decoder, so that each target decoding thread decodes the multimedia data therein;
[0202] After receiving the decoding completion signal of each target decoding thread, performing content recognition on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data;
[0203] Based on the rendering thread, post-processing parameter information is acquired according to the media content information of each channel of the decoded multimedia data, and data rendering is performed on each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data;
[0204] Based on the rendering thread, each channel of the multimedia content is synthesized according to the multimedia scene, and multimedia playback data is output.
[0205] On the other hand, an embodiment of the present application further provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium includes a computer program, and the computer program can be stored on the non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the playback processing method provided in the above embodiments, for example, including:
[0206] In response to multimedia playback events, the decoder is started based on the rendering thread according to the multimedia scene;
[0207] Based on the rendering thread and according to the multimedia quality parameter of each multimedia data channel, each multimedia data channel is allocated to a target decoding thread corresponding to the decoder, so that each target decoding thread decodes the multimedia data therein;
[0208] After receiving the decoding completion signal of each target decoding thread, performing content recognition on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data;
[0209] Based on the rendering thread, post-processing parameter information is acquired according to the media content information of each channel of the decoded multimedia data, and data rendering is performed on each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data;
[0210] Based on the rendering thread, each channel of the multimedia content is synthesized according to the multimedia scene, and multimedia playback data is output.
[0211] On the other hand, the embodiments of the present application further provide a computer product, the computer product includes a computer program, the computer program can be stored on the computer product, when the computer program is executed by the processor, the computer can perform the steps of the playback processing method provided in the above embodiments, for example, including:
[0212] In response to multimedia playback events, the decoder is started based on the rendering thread according to the multimedia scene;
[0213] Based on the rendering thread and according to the multimedia quality parameter of each multimedia data channel, each multimedia data channel is allocated to a target decoding thread corresponding to the decoder, so that each target decoding thread decodes the multimedia data therein;
[0214] After receiving the decoding completion signal of each target decoding thread, performing content recognition on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data;
[0215] Based on the rendering thread, post-processing parameter information is acquired according to the media content information of each channel of the decoded multimedia data, and data rendering is performed on each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data;
[0216] Based on the rendering thread, each channel of the multimedia content is synthesized according to the multimedia scene, and multimedia playback data is output.
[0217] The device embodiments described above are merely illustrative, 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 scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0218] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including several computer programs to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0219] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A playback processing method, characterized in that: include: In response to multimedia playback events, the decoder is started based on the rendering thread according to the multimedia scene; Based on the rendering thread and according to the multimedia quality parameter of each multimedia data channel, each multimedia data channel is allocated to a target decoding thread corresponding to the decoder, so that each target decoding thread decodes the multimedia data therein; The multimedia quality parameters include bit rate parameters, packet loss rate parameters and delay parameters; After receiving the decoding completion signal of each target decoding thread, performing content recognition on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data; Based on the rendering thread, post-processing parameter information is acquired according to the media content information of each channel of the decoded multimedia data, and data rendering is performed on each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data; Based on the rendering thread, synthesizing and processing each channel of the multimedia content according to the multimedia scene, and outputting multimedia playback data; The acquiring post-processing parameter information based on the media content information of each channel of the decoded multimedia data based on the rendering thread includes: Based on the rendering thread, according to the multimedia type information of each channel of the decoded multimedia data, obtaining post-processing effect texture information in the texture rendering environment; Acquiring post-processing optimized texture information in the texture rendering environment based on the rendering thread and the resolution information of each channel of the decoded multimedia data; Determine the post-processing effect texture information and the post-processing optimization texture information as post-processing parameter information of each channel of the decoded multimedia data based on the rendering thread; The texture rendering environment is configuration information for texture rendering created based on a rendering surface object provided by an upper layer application.
2. The playback processing method according to claim 1, characterized in that: The synthesizing and processing each channel of the multimedia content based on the rendering thread according to the multimedia scene and outputting multimedia playback data includes: If the multimedia scene is a multi-channel multimedia scene and the data synthesis strategy is a timestamp strategy, then based on the rendering thread, each channel of the multimedia content is synthesized according to the time difference information of each channel of the multimedia content, and the multimedia playback data is output; or, If the multimedia scene is a multi-channel multimedia scene and the data synthesis strategy is a delay strategy, each channel of the multimedia content is synthesized based on the rendering thread according to the delay difference information of each channel of the multimedia content, and the multimedia playback data is output.
3. The playback processing method according to claim 2, characterized in that: The step of synthesizing each channel of the multimedia content based on the rendering thread according to the time difference information of each channel of the multimedia content and outputting the multimedia playback data comprises: Acquire timestamp information of each channel of the multimedia content based on the rendering thread, and acquire main multimedia content in each channel of the multimedia content; Determine, based on the rendering thread, time difference information between the timestamp information of each non-main multimedia content and the reference timestamp information, using the timestamp information of the main multimedia content as reference timestamp information; Adjusting the timestamp information of each of the non-main multimedia contents based on the rendering thread according to the time difference information of each of the non-main multimedia contents; Based on the rendering thread, the multimedia content of each channel is sorted according to the adjusted timestamp information to obtain sorted multimedia content, and the sorted multimedia content is synthesized according to the order of the timestamps to output the multimedia playback data; The main multimedia content is any multimedia content of each channel of the multimedia content; the non-main multimedia content is the remaining multimedia content of each channel of the multimedia content except the main multimedia content.
4. The playback processing method according to claim 2, characterized in that: The step of synthesizing each channel of the multimedia content based on the rendering thread according to the delay difference information of each channel of the multimedia content and outputting the multimedia playback data comprises: Creating a multimedia content buffer based on the rendering thread; Determining, based on the rendering thread and according to the delay difference information of each channel of the multimedia content, a synthesis time point of each channel of the multimedia content; Filling each channel of the multimedia content into the multimedia content buffer according to the time sequence of the synthesis time point of each channel of the multimedia content based on the rendering thread; Based on the rendering thread, each channel of the multimedia content in the multimedia content buffer is synthesized in a time sequence, and the multimedia playback data is output.
5. The playback processing method according to claim 1, characterized in that: The multimedia playback event includes multiple channels of multimedia data; The allocating each channel of the multimedia data to a target decoding thread corresponding to the decoder based on the rendering thread according to the multimedia quality parameter of each channel of the multimedia data comprises: Calculate the bit rate adaptability score, packet loss rate score and delay score of each channel of the multimedia data based on the rendering thread according to the bit rate parameter, packet loss rate parameter and delay parameter of each channel of the multimedia data; Calculating a multimedia quality score of each channel of the multimedia data based on the bit rate adaptability score, packet loss rate score and delay score of each channel of the multimedia data by the rendering thread; Based on the multimedia quality score of each channel of the multimedia data, each channel of the multimedia data is allocated to a target decoding thread corresponding to the decoder.
6. The playback processing method according to claim 1, characterized in that: The step of performing data rendering on each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data includes: Based on the rendering thread, obtain the decoding frame rate of each target decoding thread in the process of decoding its multimedia data, and obtain the data rendering strategy of the rendering thread; Determining, based on the rendering thread and the decoding frame rate of each target decoding thread and the data rendering strategy, a rendering frame rate of each channel of the decoded multimedia data; Based on the rendering thread, data rendering is performed on each channel of the decoded multimedia data according to the rendering frame rate and post-processing parameter information of each channel of the decoded multimedia data to obtain multimedia content corresponding to each channel of the decoded multimedia data.
7. The playback processing method according to claim 6, characterized in that: The determining, based on the rendering thread according to the decoding frame rate of each target decoding thread and the data rendering strategy, the rendering frame rate of each channel of the decoded multimedia data comprises: If the data rendering strategy is a fixed frame rate rendering strategy, then based on the rendering thread, the decoding frame rate of each target decoding thread is determined as the rendering frame rate of each channel of the decoded multimedia data; or, If the data rendering strategy is a dynamic frame rate rendering strategy, the rendering performance coefficient of the rendering thread is obtained based on the rendering thread, and the rendering frame rate of each channel of the decoded multimedia data is determined based on the rendering performance coefficient and the decoding frame rate of each target decoding thread.
8. The playback processing method according to claim 6, characterized in that: Also includes: Based on the rendering thread, the rendering frame rate and post-processing parameter information of each channel of the decoded multimedia data are used to perform a rendering operation on each channel of the current frame of the decoded multimedia data, and the rendering operation is completed after each channel of the current frame of the decoded multimedia data is decoded, and a data buffer mechanism is obtained during the data rendering process of each channel of the decoded multimedia data; If the data buffer mechanism is a single buffer mechanism, based on the rendering frame rate and post-processing parameter information of the next frame of decoded multimedia data sent by each of the target decoding threads, the rendering thread performs a rendering operation on the next frame of decoded multimedia data sent by each of the target decoding threads until a decoding completion signal output by each of the target decoding threads is no longer received; or, If the data buffering mechanism is a double buffering mechanism, based on the rendering frame rate and post-processing parameter information of the new decoded multimedia data detected in the texture rendering object, the rendering operation is performed on the new decoded multimedia data detected in the texture rendering object until no new decoded multimedia data is detected in the texture rendering object; the texture rendering object is an object for storing the decoded multimedia data of each of the target decoding threads.
9. The playback processing method according to claim 1, characterized in that: The specific steps of creating the texture rendering environment include: Acquire the rendering surface object created by the upper layer application based on the rendering thread, and create a local window object with the rendering surface object; Based on the rendering thread, the local window object is transmitted to the underlying player, so that the underlying player creates a texture surface environment based on the local window object; Acquire the texture surface environment transmitted by the underlying player based on the rendering thread; The texture surface environment and the local window object are associated and bound based on the rendering thread to obtain the texture rendering environment.
10. The playback processing method according to claim 1, characterized in that: In response to multimedia playback events, the decoder is started based on the rendering thread according to the multimedia scene, including: In response to the multimedia playback event, if the multimedia scene is a single-channel multimedia scene, starting a decoder including a decoding thread based on the rendering thread; or, In response to the multimedia playback event, if the multimedia scene is a multi-channel multimedia scene, a decoder including at least one decoding thread is started based on the rendering thread.
11. The playback processing method according to any one of claims 1 to 10, characterized in that: The method of responding to the multimedia playback event and starting the decoder based on the rendering thread according to the multimedia scene also includes: Creating a texture rendering object based on the rendering thread; The texture rendering object is passed to an upper-layer application based on the rendering thread, so that the upper-layer application creates a texture rendering surface based on the texture rendering object, and the decoding thread is initialized based on the texture rendering surface, and an association is established between the decoding thread and the texture rendering object, so that the decoding thread in the decoder transmits the decoded multimedia data to the texture rendering object.
12. A playback processing device, characterized in that: include: A startup module is used to respond to multimedia playback events and start the decoder based on the rendering thread according to the multimedia scene; A calling module, configured to allocate each channel of multimedia data to a target decoding thread corresponding to the decoder based on the rendering thread according to a multimedia quality parameter of each channel of multimedia data, so that each target decoding thread decodes the multimedia data therein; the multimedia quality parameter includes a bit rate parameter, a packet loss rate parameter and a delay parameter; A content identification module is used to, after receiving a decoding completion signal from each target decoding thread, perform content identification on the decoded multimedia data transmitted by each target decoding thread based on the rendering thread to obtain media content information of each channel of the decoded multimedia data; A data rendering module, configured to obtain post-processing parameter information based on the media content information of each channel of the decoded multimedia data based on the rendering thread, perform data rendering on each channel of the decoded multimedia data, and obtain multimedia content corresponding to each channel of the decoded multimedia data; A data synthesis module, configured to synthesize each channel of the multimedia content according to the multimedia scene based on the rendering thread, and output multimedia playback data; The acquiring post-processing parameter information based on the media content information of each channel of the decoded multimedia data based on the rendering thread includes: Based on the rendering thread, according to the multimedia type information of each channel of the decoded multimedia data, obtaining post-processing effect texture information in the texture rendering environment; Acquiring post-processing optimized texture information in the texture rendering environment based on the rendering thread and the resolution information of each channel of the decoded multimedia data; Determine the post-processing effect texture information and the post-processing optimization texture information as post-processing parameter information of each channel of the decoded multimedia data based on the rendering thread; The texture rendering environment is configuration information for texture rendering created based on a rendering surface object provided by an upper layer application.
13. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of computer programs; the processor loads the computer program from the memory to execute the playback processing method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of computer programs, and the computer programs are suitable for being loaded by a processor to execute the playback processing method according to any one of claims 1 to 11.
