A bullet screen processing method and related device

By using the second thread in the video application to calculate the barrage layout and render it in the first thread, the lag problem caused by the huge number of barrages is solved, and the smoothness of video playback is optimized.

CN119277142BActive Publication Date: 2025-04-04BEIJING SOHU NEW MOMENTUM INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411775595.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-04
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

In video applications, when the number of barrage is large, it will cause lag during video playback, affecting the user's viewing experience.

Method used

By performing barrage layout calculations in the second thread and rendering based on the pre-calculated results in the first thread, time-consuming barrage layout calculations in the main thread are avoided.

Benefits of technology

Optimized barrage rendering, reduce the frequency of lag, and improve the user's viewing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119277142B_ABST
    Figure CN119277142B_ABST
Patent Text Reader

Abstract

The present application discloses a bullet screen processing method and related devices, which relate to the field of data processing technology, including: obtaining bullet screen data; when the bullet screen data needs to be displayed, if the bullet screen layout calculation result corresponding to the bullet screen data is stored, performing a bullet screen rendering operation based on the bullet screen layout calculation result through a first thread; when the bullet screen data does not need to be displayed, if the bullet screen layout calculation result corresponding to the bullet screen data is not stored, then when the data type of the bullet screen data is the first data type, performing a bullet screen layout calculation on the bullet screen data through a second thread, and obtaining and storing the bullet screen layout calculation result. The present application saves the time spent on the bullet screen layout calculation in the first thread, optimizes the bullet screen rendering, and reduces the frequency of jamming.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a bullet screen processing method and related devices. Background Art

[0002] In video applications, video bullet comments are one of the essential basic functions. In order to ensure that bullet comments do not block each other, the size of the bullet comments needs to be determined according to the content before the bullet comments are rendered, so that bullet comments of different lengths occupy different screen spaces. However, when there are a large number of bullet comments, there will be a freeze during video playback, which prevents users from watching videos and bullet comments smoothly, affecting the user's viewing experience. Summary of the invention

[0003] In view of the above problems, this application provides a bullet screen processing method and related devices to optimize bullet screen rendering and reduce the frequency of freezes. The specific solution is as follows:

[0004] The first aspect of the present application provides a bullet comment processing method, comprising:

[0005] Obtaining bullet screen data; wherein the bullet screen data at least includes bullet screen data of the current time period, and the current time period is the time period of the current video playback progress;

[0006] When the bullet chat data needs to be displayed, if a bullet chat layout calculation result corresponding to the bullet chat data is stored, a bullet chat rendering operation is performed based on the bullet chat layout calculation result through the first thread;

[0007] When the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the first data type, the barrage layout calculation is performed on the barrage data through the second thread to obtain and store the barrage layout calculation result.

[0008] In a possible implementation, the method further includes:

[0009] When the barrage data needs to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, the barrage layout calculation is performed on the barrage data through the first thread to obtain the barrage layout calculation result, and the barrage rendering operation is performed based on the barrage layout calculation result.

[0010] In a possible implementation, the method further includes:

[0011] When the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the second data type, the barrage layout calculation is performed on the barrage data through the first thread to obtain the barrage layout calculation result; wherein the second data type is different from the first data type.

[0012] In a possible implementation, the performing bullet screen layout calculation on the bullet screen data includes:

[0013] Generate a rich text string based on the bullet comment data;

[0014] Determining a bullet screen rendering method based on the bullet screen type of the bullet screen data;

[0015] Based on the bullet screen rendering method and the rich text string, a bullet screen layout calculation result is obtained.

[0016] In a possible implementation, before calculating the bullet screen layout for the bullet screen data, the method further includes:

[0017] Determine the number of the time period in which the video playback progress corresponding to the barrage data is located, and obtain the target time period number;

[0018] Determine whether the target time period number is a mark number; wherein the mark number indicates that the bullet screen layout calculation has been performed in the corresponding time period;

[0019] If the target time period number is not the mark number, the bullet screen layout calculation is performed on the bullet screen data.

[0020] In a possible implementation, after obtaining the bullet comment data, the following is further included:

[0021] Obtaining an identifier of the barrage data;

[0022] Determine a bullet screen layout calculation object corresponding to the bullet screen type of the bullet screen data;

[0023] Based on the identifier and the bullet screen layout calculation object, the bullet screen layout calculation result corresponding to the bullet screen data is searched from the stored bullet screen layout calculation results.

[0024] A second aspect of the present application provides a bullet comment processing system, including:

[0025] A bullet screen acquisition module, used to acquire bullet screen data; wherein the bullet screen data at least includes the bullet screen data of the current time period, and the current time period is the time period of the current video playback progress;

[0026] A first processing module is used for, when the bullet chat data needs to be displayed, if a bullet chat layout calculation result corresponding to the bullet chat data is stored, performing a bullet chat rendering operation based on the bullet chat layout calculation result through a first thread;

[0027] The second processing module is used to, when the barrage data does not need to be displayed and if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the first data type, perform barrage layout calculation on the barrage data through the second thread to obtain and store the barrage layout calculation result.

[0028] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the barrage processing method of the above-mentioned first aspect or any implementation manner of the first aspect.

[0029] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0030] The memory is used to store computer programs;

[0031] The processor is used to execute the computer program so that the electronic device can implement the barrage processing method of the above-mentioned first aspect or any implementation manner of the first aspect.

[0032] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the barrage processing method of the above-mentioned first aspect or any implementation of the first aspect.

[0033] By means of the above technical scheme, the barrage processing method and related device provided by the present application, when the barrage data needs to be displayed, if the barrage layout calculation result corresponding to the barrage data is stored, the barrage rendering operation is performed based on the barrage layout calculation result through the first thread; when the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the first data type, the barrage layout calculation is performed on the barrage data through the second thread, and the barrage layout calculation result is obtained and stored. By performing the barrage layout calculation in the second thread, the barrage rendering is performed only based on the barrage layout calculation result in the first thread, which saves the time spent on the barrage layout calculation in the first thread, optimizes the barrage rendering, and reduces the frequency of jamming. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0035] Figure 1 A flow chart of a bullet screen processing method provided by this application;

[0036] Figure 2 A schematic diagram of the structure of a bullet screen processing system provided in this application;

[0037] Figure 3 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0038] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0039] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0040] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0041] The embodiment of the present application provides a method for processing a bullet screen. The method for processing a bullet screen in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0042] Reference Figure 1 , Figure 1 A schematic diagram of a bullet screen processing method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, a barrage processing method provided in an embodiment of the present application may include steps 101 to 103, and these steps are described in detail below.

[0043] Step 101: Obtain bullet screen data; wherein the bullet screen data at least includes the bullet screen data of the current time period, and the current time period is the time period of the current video playback progress.

[0044] The barrage data is obtained through an interface request. The data type of the barrage data may include but is not limited to text and pictures, and the pictures may be dynamic pictures and expression pictures. The barrage types of the barrage data may include but are not limited to text barrage, character barrage, etc. The barrage data may include barrage data with different font sizes, expression content, and text colors.

[0045] The barrage data includes the barrage data of the time period of the current video playback progress. Assuming that each x seconds is a time period, the current video playback progress is at time t, and the time period of the current video playback progress is [t, t+x], the obtained barrage data is the barrage data of duration t+x.

[0046] Of course, the barrage data can also include the barrage data of the next time period of the current time period. Assuming that one time period is x seconds, the current video playback progress is at time t, the current time period is [t, t+x], and the next time period of the current time period is [t+x, t+2x], then the obtained barrage data is the barrage data of duration t+2x.

[0047] The total number of bullet comments in a time period can be obtained by the maximum number of bullet comments per second. Assuming that the maximum number of bullet comments per second is 5, and each 10 seconds is a time period, there are 50 bullet comments in a time period. If the bullet comment data of the current time period and the next time period are obtained, 100 bullet comments can be obtained.

[0048] Step 102: When the bullet screen data needs to be displayed, if the bullet screen layout calculation result corresponding to the bullet screen data is stored, the bullet screen rendering operation is performed based on the bullet screen layout calculation result through the first thread.

[0049] According to the screen refresh rate, the screen update is checked. Specifically, it can be determined at a frequency of N times per second whether there is a position on the screen to display a new bullet screen, where N can be 60 or other positive integers. It can also be determined once per frame whether a bullet screen can be inserted. In actual application, first, in the set bullet screen display area, several bullet screen movement tracks are divided according to the font size. When a bullet screen occupies the right edge of the screen, it is determined that no new bullet screen can be inserted into this track, that is, there is no new space. When the bullet screen gradually scrolls to the right side of the screen in the track to expose enough space, a new bullet screen can be inserted. The tracks cannot cross each other, so as to achieve the effect of bullet screens not blocking each other. Each bullet screen has a corresponding display playback time point, and the bullet screen can be displayed when there is a gap on the screen.

[0050] When the bullet screen data needs to be displayed, it can be determined whether the bullet screen layout calculation result corresponding to the bullet screen data is stored. After obtaining the bullet screen data, the method further includes:

[0051] Get the identifier of the barrage data;

[0052] Determine a bullet screen layout calculation object corresponding to the bullet screen type of the bullet screen data;

[0053] Based on the identifier and the bullet screen layout calculation object, the bullet screen layout calculation result corresponding to the bullet screen data is searched from the stored bullet screen layout calculation results.

[0054] If the barrage layout calculation result corresponding to the barrage data is found, it means that the barrage layout calculation result corresponding to the barrage data is stored. If the barrage layout calculation result corresponding to the barrage data is not found, it means that the barrage layout calculation result corresponding to the barrage data is not stored.

[0055] Since different types of bullet comments, such as text bullet comments and character bullet comments, have different calculation rules when calculating bullet comment layout, different bullet comment layout calculation objects can be used for each type of bullet comment. The bullet comment layout calculation object can be a proxy object responsible for calculation that follows the SVLayoutDelegate protocol. The identifier of the bullet comment data and the bullet comment layout calculation object can be used as the cache key of each bullet comment layout calculation task, and the bullet comment layout calculation result can be queried and stored through the cache key.

[0056] The calculation result of the barrage layout includes but is not limited to the overall size of the barrage, the number of lines required for the barrage, the content of each line of text, the layout position and size of each line of text, etc.

[0057] The first thread can be the main thread, and the main thread can be the UI thread. The barrage rendering operation is performed directly through the first thread based on the barrage layout calculation result. Compared with first performing the barrage layout calculation through the first thread and then performing the barrage rendering based on the barrage layout calculation result, the time spent on the barrage layout calculation in the first thread is saved. Since the barrage layout calculation is the main time-consuming step in the barrage rendering process, not performing the barrage layout calculation in the main thread can significantly improve the rendering efficiency and reduce the frequency of lag.

[0058] Step 103: When the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the first data type, the barrage layout calculation is performed on the barrage data through the second thread to obtain and store the barrage layout calculation result.

[0059] When the barrage data does not need to be displayed, based on the barrage data identifier and the barrage layout calculation object, the barrage layout calculation result corresponding to the barrage data is not found from the stored barrage layout calculation results, which means that the barrage layout calculation result corresponding to the barrage data is not stored.

[0060] Before performing bullet screen layout calculation on bullet screen data, it can be determined whether to perform bullet screen layout calculation through the first thread or the second thread according to the data type of the bullet screen data. The first thread is the main thread, and the second thread is the child thread. The data type of the bullet screen data can be text or picture, and the picture can be a GIF or emoticon. If the data type of the bullet screen data is the first data type, and the first data type is the text type, the bullet screen layout calculation can be performed on the bullet screen data through the second thread.

[0061] In a possible implementation, the bullet comment processing method provided by the present application further includes:

[0062] When the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the second data type, the barrage layout calculation is performed on the barrage data through the first thread to obtain the barrage layout calculation result; wherein the second data type is different from the first data type.

[0063] Before performing bullet screen layout calculation on bullet screen data, it can be determined whether to perform bullet screen layout calculation through the first thread or the second thread according to the data type of the bullet screen data. The first thread is the main thread, and the second thread is the child thread. The data type of the bullet screen data can be text or picture, and the picture can be a dynamic picture or an expression. If the data type of the bullet screen data is the second data type, and the first data type is a dynamic picture or an expression, the bullet screen layout calculation can be performed on the bullet screen data through the first thread.

[0064] Optionally, after the bullet screen layout calculation is performed on the bullet screen data through the first thread to obtain the bullet screen layout calculation result, the bullet screen layout calculation result can be stored.

[0065] In a possible implementation, before calculating the bullet screen layout for the bullet screen data, the following steps are further included:

[0066] Determine the number of the time period in which the video playback progress corresponding to the bullet screen data is located, and obtain the target time period number;

[0067] Determine whether the target time period number is a marked number; wherein the marked number indicates that the bullet screen layout calculation has been performed in the corresponding time period;

[0068] If the target time period number is not a mark number, the bullet screen layout calculation is performed on the bullet screen data.

[0069] In order to avoid repeated calculation of the barrage layout, the calculated time period number can be marked after initiating the barrage layout calculation. In this way, before the barrage layout calculation is performed on the barrage data, if the number of the time period in which the video playback progress corresponding to the barrage data is located is the marked number, it means that the barrage layout calculation is already being performed on the barrage data, but the barrage layout calculation result has not yet been obtained. At this time, there is no need to perform the barrage layout calculation on the barrage data, thereby avoiding repeated calculation of the barrage layout.

[0070] In a possible implementation, the bullet comment processing method provided by the present application further includes:

[0071] When the barrage data needs to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, the barrage layout calculation is performed on the barrage data through the first thread to obtain the barrage layout calculation result, and the barrage rendering operation is performed based on the barrage layout calculation result.

[0072] When the bullet chat data needs to be displayed, if the bullet chat layout calculation result corresponding to the bullet chat data is not stored, it is necessary to perform the bullet chat layout calculation on the bullet chat data through the first thread, that is, through the main thread, to obtain the bullet chat layout calculation result, and then perform the bullet chat rendering operation based on the bullet chat layout calculation result through the first thread. If the second thread is performing the bullet chat layout calculation on the bullet chat data, the second thread can be interrupted to prevent repeated calculations, and the second thread abandons the bullet chat layout calculation on the bullet chat data, and then performs the bullet chat layout calculation on the next bullet chat data.

[0073] Optionally, after the bullet screen layout calculation is performed on the bullet screen data through the first thread to obtain the bullet screen layout calculation result, the bullet screen layout calculation result can be stored.

[0074] In a possible implementation, the bullet screen layout calculation is performed on the bullet screen data, including:

[0075] Generate rich text strings based on bullet comment data;

[0076] Determine the bullet screen rendering method based on the bullet screen type of the bullet screen data;

[0077] Based on the bullet screen rendering mode and the rich text string, the bullet screen layout calculation result is obtained.

[0078] The rich text string is an attributed string submitted to the UI layer for rendering, which can reflect attributes such as color, font, line spacing, and line height. The types of barrage data include text barrage, character barrage, and queue barrage. Different barrage types correspond to different barrage rendering methods. For example, in queue barrage, the barrage data is a word, which is arranged in a matrix form according to the calculation rules during rendering. Based on the barrage rendering method and the rich text string, the barrage layout calculation result is obtained, which includes but is not limited to the overall size of the barrage, the number of lines required for the barrage, the content of each line of text, the layout position and size of each line of text, etc.

[0079] In a possible implementation, the bullet comment processing method provided by the present application further includes:

[0080] After storing the bullet screen layout calculation result, the bullet screen layout calculation result corresponding to the bullet screen data before the current period is deleted.

[0081] In order to ensure that there are not too many stored bullet screen layout calculation results, the bullet screen layout calculation results corresponding to the bullet screen data before the current period can be deleted.

[0082] After the main thread or child thread calculates the barrage layout result, the barrage layout result can be stored in the constructed calculation cache manager SVBarrageLayoutManager. When a new barrage needs to be displayed, the barrage layout result can be obtained from the calculation cache manager and provided to the YYLabel component for barrage rendering, and the YYLabel component displays the barrage. If the calculation cache manager does not have a cache, the YYTextLayout object is calculated in the main thread. The YYTextLayout object saves the barrage layout result required for the barrage when rendering, including but not limited to: overall size, required number of lines, text content of each line, layout position and size of each line of text, etc. YYTextLayout can use the CoreText framework. The barrage layout results of the current segment and the next segment can be calculated in the child thread, and the barrage layout results cached before the two segments are deleted to keep the number of caches in the calculation cache manager from being too large. A calculation task SVTextLayoutTask is initiated through the (void)layoutBarrage method. This calculation task is a task for calculating the barrage layout result. The child thread or the main thread can be selected. For barrages that do not need to be displayed yet, they can be put into the child thread for completion when they need to be calculated in advance. Once the bullet screen needs to be displayed immediately and the bullet screen layout result does not exist in the cache, the calculation needs to be completed immediately in the main thread. At this time, if the child thread is also calculating this task, the child thread task will be interrupted and abandoned, and the calculation of the next task will be performed. If the bullet screen contains dynamic image expression content, the bullet screen layout result calculation needs to be performed in the main thread, and the regular text bullet screen can be calculated in the child thread. For bullet screens that do not need to be displayed yet, if there is no calculation task for the bullet screen, a calculation task SVTextLayoutTask is created, and the bullet screen layout calculation is started, and the status of the task is marked as being calculated. If a calculation task already exists, the calculation task result is taken out of the cache. If the task status is calculated, the calculation result is directly returned through the finished callback and the value is assigned to YYLabel. If the task status is being calculated, a new callback is added to the callBacks array of the task, and the results are called back in sequence after the calculation result is completed, and the status is marked as being calculated.Due to the variety of barrage types, the rules of font size, expression content, text color, etc. of barrage content are all different. Therefore, the barrage layout calculation process can be completed by a proxy object that follows the proxy protocol SVLayoutDelegate. The interface requests the barrage data BarrageItem, generates a rich text string NSAttributedString based on the barrage data BarrageItem, calculates the YYTextLayout object based on the rich text string NSAttributedString, obtains the barrage layout calculation result, and then provides the barrage layout result to the YYLabel component for barrage rendering.

[0083] A barrage processing method provided in an embodiment of the present application is introduced above, and a system for executing the above barrage processing method will be introduced below.

[0084] See also Figure 2 , Figure 2 This is a structural diagram of a bullet screen processing system provided in an embodiment of the present application. Figure 2 As shown, the bullet screen processing system includes:

[0085] The bullet screen acquisition module 201 is used to acquire bullet screen data; wherein the bullet screen data at least includes the bullet screen data of the current time period, and the current time period is the time period of the current video playback progress;

[0086] The first processing module 202 is used for performing a bullet screen rendering operation based on the bullet screen layout calculation result through the first thread when the bullet screen data needs to be displayed, if the bullet screen layout calculation result corresponding to the bullet screen data is stored;

[0087] The second processing module 203 is used to perform barrage layout calculation on the barrage data through the second thread when the barrage data does not need to be displayed and if the barrage layout calculation result corresponding to the barrage data is not stored, and when the data type of the barrage data is the first data type, to obtain and store the barrage layout calculation result.

[0088] In a possible implementation, the bullet comment processing system further includes:

[0089] The third processing module is used to perform barrage layout calculation on the barrage data through the first thread when the barrage data needs to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, to obtain the barrage layout calculation result, and perform barrage rendering operation based on the barrage layout calculation result.

[0090] In a possible implementation, the bullet comment processing system further includes:

[0091] The fourth processing module is used to perform barrage layout calculation on the barrage data through the first thread to obtain the barrage layout calculation result when the barrage data does not need to be displayed and the barrage layout calculation result corresponding to the barrage data is not stored, when the data type of the barrage data is a second data type; wherein the second data type is different from the first data type.

[0092] Optionally, the second processing module, the third processing module and the fourth processing module are specifically used to:

[0093] Generate rich text strings based on bullet comment data;

[0094] Determine the bullet screen rendering method based on the bullet screen type of the bullet screen data;

[0095] Based on the bullet screen rendering mode and the rich text string, the bullet screen layout calculation result is obtained.

[0096] The second processing module, the third processing module and the fourth processing module are further used for:

[0097] Determine the number of the time period in which the video playback progress corresponding to the bullet screen data is located, and obtain the target time period number;

[0098] Determine whether the target time period number is a marked number; wherein the marked number indicates that the bullet screen layout calculation has been performed in the corresponding time period;

[0099] If the target time period number is not a mark number, the bullet screen layout calculation is performed on the bullet screen data.

[0100] In a possible implementation, the bullet comment processing system further includes:

[0101] A search module is used to obtain the identifier of the barrage data; determine the barrage layout calculation object corresponding to the barrage type of the barrage data; and based on the identifier and the barrage layout calculation object, search for the barrage layout calculation result corresponding to the barrage data from the stored barrage layout calculation results.

[0102] The present application also provides an electronic device in an embodiment. Figure 3 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 3 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0103] like Figure 3As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 to a random access memory (RAM) 303. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 303. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0104] Typically, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a memory card, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0105] The electronic device can implement the above-mentioned barrage processing method.

[0106] Also provided in an embodiment of the present application is a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any barrage processing method provided in the embodiment of the present application.

[0107] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any barrage processing method provided in an embodiment of the present application.

[0108] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over 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. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0109] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0110] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0111] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A method for processing barrage, characterized in that: include: Obtaining bullet screen data; wherein the bullet screen data at least includes bullet screen data of the current time period, and the current time period is the time period of the current video playback progress; Obtaining an identifier of the barrage data; determining a barrage layout calculation object corresponding to the barrage type of the barrage data; based on the identifier and the barrage layout calculation object, searching for a barrage layout calculation result corresponding to the barrage data from the stored barrage layout calculation results; When the bullet chat data needs to be displayed, if a bullet chat layout calculation result corresponding to the bullet chat data is stored, a bullet chat rendering operation is performed based on the bullet chat layout calculation result through the first thread; When the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the first data type, the barrage layout calculation is performed on the barrage data through the second thread to obtain and store the barrage layout calculation result; Before calculating the bullet screen layout of the bullet screen data, the method further includes: Determine the number of the time period in which the video playback progress corresponding to the barrage data is located, and obtain the target time period number; Determine whether the target time period number is a mark number; wherein the mark number indicates that the bullet screen layout calculation has been performed in the corresponding time period; If the target time period number is not the mark number, performing bullet screen layout calculation on the bullet screen data; The performing bullet screen layout calculation on the bullet screen data includes: Generate a rich text string based on the bullet comment data; Determining a bullet screen rendering method based on the bullet screen type of the bullet screen data; Based on the bullet screen rendering method and the rich text string, a bullet screen layout calculation result is obtained.

2. The method for processing barrage according to claim 1, characterized in that: Also includes: When the barrage data needs to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, the barrage layout calculation is performed on the barrage data through the first thread to obtain the barrage layout calculation result, and the barrage rendering operation is performed based on the barrage layout calculation result.

3. The method for processing barrage according to claim 1, characterized in that: Also includes: When the barrage data does not need to be displayed, if the barrage layout calculation result corresponding to the barrage data is not stored, then when the data type of the barrage data is the second data type, the barrage layout calculation is performed on the barrage data through the first thread to obtain the barrage layout calculation result; wherein the second data type is different from the first data type.

4. A bullet comment processing system, characterized in that: include: A bullet screen acquisition module, used to acquire bullet screen data; wherein the bullet screen data at least includes the bullet screen data of the current time period, and the current time period is the time period of the current video playback progress; A search module is used to obtain an identifier of the barrage data; determine a barrage layout calculation object corresponding to the barrage type of the barrage data; and based on the identifier and the barrage layout calculation object, search for a barrage layout calculation result corresponding to the barrage data from the stored barrage layout calculation results; A first processing module is used for, when the bullet chat data needs to be displayed, if a bullet chat layout calculation result corresponding to the bullet chat data is stored, performing a bullet chat rendering operation based on the bullet chat layout calculation result through a first thread; A second processing module is used for, when the barrage data does not need to be displayed, if a barrage layout calculation result corresponding to the barrage data is not stored, then, when the data type of the barrage data is the first data type, performing barrage layout calculation on the barrage data through a second thread to obtain and store the barrage layout calculation result; The second processing module is specifically used for: Generate rich text strings based on bullet comment data; Determine the bullet screen rendering method based on the bullet screen type of the bullet screen data; Based on the bullet screen rendering method and rich text string, the bullet screen layout calculation result is obtained; The second processing module is further used for: Determine the number of the time period in which the video playback progress corresponding to the bullet screen data is located, and obtain the target time period number; Determine whether the target time period number is a marked number; wherein the marked number indicates that the bullet screen layout calculation has been performed in the corresponding time period; If the target time period number is not a mark number, the bullet screen layout calculation is performed on the bullet screen data.

5. A computer program product, characterized in that It includes computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the barrage processing method as described in any one of claims 1 to 3.

6. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the barrage processing method as described in any one of claims 1 to 3.

7. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the barrage processing method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Bullet screen rendering method and device, computer readable storage medium and computer equipment

    CN111083551A

  • Bullet screen implementation method and device, electronic equipment and readable storage medium

    CN111131910A