CN113784197B - Video display method, video frame caching method and device - Google Patents

Video display method, video frame caching method and device Download PDF

Info

Publication number
CN113784197B
CN113784197B CN202110966888.4A CN202110966888A CN113784197B CN 113784197 B CN113784197 B CN 113784197B CN 202110966888 A CN202110966888 A CN 202110966888A CN 113784197 B CN113784197 B CN 113784197B
Authority
CN
China
Prior art keywords
storage space
video
target storage
video frame
displayed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110966888.4A
Other languages
Chinese (zh)
Other versions
CN113784197A (en
Inventor
郑帅
高玉龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202110966888.4A priority Critical patent/CN113784197B/en
Publication of CN113784197A publication Critical patent/CN113784197A/en
Application granted granted Critical
Publication of CN113784197B publication Critical patent/CN113784197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44004Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video buffer management, e.g. video decoder buffer or video display buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4335Housekeeping operations, e.g. prioritizing content for deletion because of storage space restrictions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440281Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the temporal resolution, e.g. by frame skipping

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The application provides a method for displaying video, a method and a device for caching video frames, which are used for solving the problem that abnormal display conditions are easy to occur in the process of displaying video. The method comprises the following steps: based on the storage space set, a first target storage space indicated by a write pointer and used for caching received video frames is obtained, and a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of the next frame of the video is obtained; if the first target storage space is not matched with the second target storage space, updating a second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video; and reading the video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video.

Description

Video display method, video frame caching method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method for displaying video, a method for buffering video frames, and an apparatus for buffering video frames.
Background
With the continuous development of technology, more and more devices can display video. In order to ensure the consistency of video display, the device continuously receives video frames of the video, continuously caches the received video frames in a storage space, and sequentially reads each video frame for display when the video is displayed.
However, since the process of buffering the video frame and the process of reading the video frame are independent from each other, the situation that the video frame being buffered is read out and displayed when the device reads the video frame easily occurs, and since the video frame being buffered is not already buffered, a part of the picture displayed by the device may belong to the video frame being buffered, and another part of the picture belongs to the video frame displayed by the previous frame, which causes abnormal display such as tearing of the picture.
Disclosure of Invention
The embodiment of the application provides a method for displaying video, a method and a device for caching video frames, computer equipment and a storage medium, which are used for solving the problem that abnormal display conditions are easy to occur in the process of displaying video.
In a first aspect, a method of displaying video is provided, comprising:
based on the storage space set, a first target storage space indicated by a write pointer and used for caching received video frames is obtained, and a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of the next frame of the video is obtained;
If the first target storage space is not matched with the second target storage space, updating a second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video;
and reading the video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video.
Optionally, reading the video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video includes:
reading a video frame to be displayed in the second target storage space indicated by the second read pointer, if a read completion signal for the video frame to be displayed is not received within a preset duration, continuing to display the video frame currently displayed by the video, and re-reading the video frame to be displayed;
and if the reading completion signal for the video frame to be displayed is received within the preset time length, updating the video frame currently displayed by the video based on the video frame to be displayed.
Optionally, after receiving the read completion signal for the video frame to be displayed within the preset duration, updating the video frame currently displayed by the video based on the video frame to be displayed, the method further includes:
Deleting the video frame to be displayed from the second target storage space;
updating the first reading pointer to indicate other storage spaces except the second target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set.
Optionally, if the first target storage space does not match the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer includes:
if the first target storage space is not matched with the second target storage space, determining whether the video frame to be displayed exists in the second target storage space;
and if the video frame to be displayed exists in the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer.
Optionally, after determining whether the video frame to be displayed exists in the second target storage space if the first target storage space is not matched with the second target storage space, the method further includes:
If the video frame to be displayed does not exist in the second target storage space, continuing to display the video frame currently displayed by the video;
updating the first read pointer to indicate other storage spaces except the second target storage space in the storage space set based on respective arrangement orders, wherein the respective arrangement orders are arrangement orders corresponding to the respective storage spaces in the storage space set.
Optionally, after obtaining, based on the storage space set, a first target storage space indicated by the write pointer and used for caching the received video frame, and obtaining a second target storage space indicated by the first read pointer and used for caching a video frame to be displayed of the next frame of the video, the method further includes:
and if the first target storage space is matched with the second target storage space, continuing to display the video frame currently displayed by the video.
Optionally, if the video frames buffered in each storage space in the storage space set carry the write pointer, based on the storage space set, obtaining a first target storage space indicated by the write pointer and used for buffering the received video frames, and obtaining a second target storage space indicated by the first read pointer and used for buffering the video frames to be displayed in the next frame of the video, including:
Obtaining a second target storage space indicated by the first reading pointer and used for caching a video frame to be displayed of the next frame of the video;
and determining a write pointer carried by the video frame to be displayed based on the video frame to be displayed in the second target storage space, and obtaining a first target storage space indicated by the write pointer and used for caching the received video frame.
Optionally, the storage space set is obtained by adopting the following method:
obtaining processing delay information in the video display process;
determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between pre-stored reference delay information and the number of storage spaces;
based on the target storage space quantity and the preset storage space size, distributing each storage space in the memory;
the set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
In a second aspect, a method for buffering video frames is provided, comprising:
receiving a video frame to be stored;
based on the storage space set, a first target storage space indicated by a write pointer and used for caching the received video frames to be stored is obtained, and a second target storage space indicated by a first read pointer and used for caching the video frames to be stored of the next frame of video is obtained;
And if the first target storage space is not matched with the second target storage space, caching the video frames to be stored in the first target storage space.
Optionally, after buffering the video frame to be stored in the first target storage space if the first target storage space and the second target storage space do not match, the method further includes:
if a buffer completion signal for the video frame to be stored is received within a preset duration, adding a buffer identification for representing the video frame to be stored to the first target storage space, and updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is an arrangement sequence corresponding to each storage space in the storage space set;
if the buffer completion signal for the video frame to be stored is not received within the preset time length, continuing to receive the next video frame to be stored.
Optionally, after obtaining, based on the storage space set, a first target storage space indicated by the write pointer and used for caching the received video frame to be stored, and obtaining a second target storage space indicated by the first read pointer and used for caching the video frame to be stored of the next frame of video, the method further includes:
If the first target storage space is matched with the second target storage space, determining whether a video frame to be stored exists in the first target storage space;
if the first target storage space has the video frame to be stored, updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set;
and if the first target storage space does not have the video frames to be stored, caching the video frames to be stored in the first target storage space.
Optionally, caching the video frame to be stored in the first target storage space includes:
performing data expansion processing on the video frame to be stored;
writing the write pointer into the video frame to be stored after the data expansion processing to obtain the video frame to be stored carrying the write pointer;
and caching the video frame to be stored carrying the write pointer in the first target storage space.
In a third aspect, there is provided an apparatus for displaying video, comprising:
The acquisition module is used for: the method comprises the steps of obtaining a first target storage space indicated by a write pointer and used for caching received video frames based on a storage space set, and obtaining a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of the next frame of video;
the processing module is used for: if the first target storage space is not matched with the second target storage space, updating a second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video;
the processing module is further configured to: and reading the video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video.
Optionally, the processing module is specifically configured to:
reading a video frame to be displayed in the second target storage space indicated by the second read pointer, if a read completion signal for the video frame to be displayed is not received within a preset duration, continuing to display the video frame currently displayed by the video, and re-reading the video frame to be displayed;
And if the reading completion signal for the video frame to be displayed is received within the preset time length, updating the video frame currently displayed by the video based on the video frame to be displayed.
Optionally, the processing module is further configured to:
if the reading completion signal for the video frame to be displayed is received within the preset time length, deleting the video frame to be displayed from the second target storage space after updating the video frame currently displayed by the video based on the video frame to be displayed;
updating the first reading pointer to indicate other storage spaces except the second target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set.
Optionally, the processing module is specifically configured to:
if the first target storage space is not matched with the second target storage space, determining whether the video frame to be displayed exists in the second target storage space;
and if the video frame to be displayed exists in the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer.
Optionally, the processing module is further configured to:
after determining whether the video frame to be displayed exists in the second target storage space or not if the first target storage space is not matched with the second target storage space, if the video frame to be displayed does not exist in the second target storage space, continuing to display the video frame currently displayed by the video;
updating the first read pointer to indicate other storage spaces except the second target storage space in the storage space set based on respective arrangement orders, wherein the respective arrangement orders are arrangement orders corresponding to the respective storage spaces in the storage space set.
Optionally, the processing module is further configured to:
and after a first target storage space indicated by a write pointer and used for caching received video frames is obtained based on a storage space set and a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of the next frame of the video is obtained, if the first target storage space is matched with the second target storage space, continuing to display the video frame currently displayed by the video.
Optionally, if the video frames cached in each storage space in the storage space set carry the write pointer, the obtaining module is specifically configured to:
Obtaining a second target storage space indicated by the first reading pointer and used for caching a video frame to be displayed of the next frame of the video;
and determining a write pointer carried by the video frame to be displayed based on the video frame to be displayed in the second target storage space, and obtaining a first target storage space indicated by the write pointer and used for caching the received video frame.
Optionally, the storage space set is obtained by adopting the following method:
the obtaining module is further configured to: obtaining processing delay information in the video display process;
the processing module is further configured to: determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between pre-stored reference delay information and the number of storage spaces;
the processing module is further configured to: based on the target storage space quantity and the preset storage space size, distributing each storage space in the memory;
the processing module is further configured to: the set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
In a fourth aspect, an apparatus for buffering video frames is provided, comprising:
and a transceiver module: for receiving a video frame to be stored;
the processing module is used for: the method comprises the steps of obtaining a first target storage space indicated by a write pointer and used for caching received video frames to be stored based on a storage space set, and obtaining a second target storage space indicated by a first read pointer and used for caching video frames to be stored of next frames of video;
The processing module is further configured to: and if the first target storage space is not matched with the second target storage space, caching the video frames to be stored in the first target storage space.
Optionally, the processing module is further configured to:
after the video frames to be stored are cached in the first target storage space if the first target storage space is not matched with the second target storage space, if a caching completion signal for the video frames to be stored is received within a preset time period, adding a caching identification for representing the existence of the video frames to be stored into the first target storage space, and updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set;
if the buffer completion signal for the video frame to be stored is not received within the preset time length, continuing to receive the next video frame to be stored.
Optionally, the processing module is further configured to:
after a first target storage space indicated by a write pointer and used for caching received video frames to be stored is obtained based on a storage space set and a second target storage space indicated by a first read pointer and used for caching video frames to be stored of a next frame of video are obtained, if the first target storage space is matched with the second target storage space, determining whether the video frames to be stored exist in the first target storage space;
If the first target storage space has the video frame to be stored, updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set;
and if the first target storage space does not have the video frames to be stored, caching the video frames to be stored in the first target storage space.
Optionally, the processing module is specifically configured to:
performing data expansion processing on the video frame to be stored;
writing the write pointer into the video frame to be stored after the data expansion processing to obtain the video frame to be stored carrying the write pointer;
and caching the video frame to be stored carrying the write pointer in the first target storage space.
In a fifth aspect, there is provided a computer device comprising:
a memory for storing program instructions;
and a processor for invoking program instructions stored in said memory, performing the method according to the first aspect or according to the second aspect in accordance with the obtained program instructions.
In a sixth aspect, there is provided a computer readable storage medium storing computer executable instructions for causing a computer to perform the method of the first aspect or the second aspect.
In the embodiment of the application, when the video frame to be displayed is read in the process of displaying the video, not only the second target storage space for caching the video frame to be displayed of the next frame of the video indicated by the first read pointer, but also the first target storage space for caching the received video frame indicated by the write pointer are obtained. By matching the first target storage space and the second target storage space, abnormal display caused by mutual independence of a process of caching video frames and a process of reading video frames is avoided. When the first target storage space is not matched with the second target storage space, the process of caching the video frames is not in conflict with the process of reading the video frames, then the second read pointer indicating the storage space for caching the video frames currently displayed by the video can be updated to indicate the second target storage space, and then the video frames currently displayed by the video can be updated according to the video frames to be displayed in the second target storage space indicated by the second read pointer. Aiming at the process of reading the video frames, the first reading pointer and the second reading pointer are set, so that the storage space where the currently displayed video frame is located and the storage space where the next frame to be displayed is located can be clearly indicated, the storage space where the next frame to be displayed is located is determined when the next frame to be displayed is not needed after the current video frame is displayed, and the problem of video display delay is avoided; and when the video frame is not read, the storage space of the next frame to be displayed is determined, so that the problem of abnormal video display caused by the fact that the video frame is not read completely is avoided, and the stability of video display is improved.
Drawings
Fig. 1 is an application scenario of a method for displaying video and a method for buffering video frames according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a method for displaying video according to an embodiment of the present application;
fig. 3 is a schematic diagram of a method for displaying video according to an embodiment of the present application;
fig. 4a is a schematic flow chart of a method for displaying video according to an embodiment of the present application;
fig. 4b is a schematic diagram of a second principle of the method for displaying video according to the embodiment of the present application;
fig. 5 is a flowchart illustrating a method for buffering video frames according to an embodiment of the present application;
fig. 6a is a flowchart illustrating a method for buffering video frames according to an embodiment of the present application;
fig. 6b is a schematic diagram III of a method for buffering video frames according to an embodiment of the present application;
fig. 7a is a schematic diagram of a method for displaying video and a method for buffering video frames according to an embodiment of the present application;
fig. 7b is a flowchart of a method for displaying video and a method for buffering video frames according to an embodiment of the present application;
fig. 7c is a schematic diagram of a method for displaying video and a method for buffering video frames according to an embodiment of the present application;
Fig. 8a is a flowchart illustrating a method for displaying video according to an embodiment of the present application;
fig. 8b is a schematic diagram of a method for displaying video according to an embodiment of the present application;
fig. 9 is a schematic diagram of a device for displaying video according to an embodiment of the present application;
fig. 10 is a schematic diagram ii of an apparatus for buffering video frames according to an embodiment of the present application;
fig. 11 is a schematic diagram of a device for displaying video or a device for buffering video frames according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
The application field of the method for displaying video provided by the embodiment of the application is briefly described below.
With the continuous development of technology, more and more devices can display video. In order to ensure the consistency of video display, the device continuously receives video frames of the video, continuously caches the received video frames in a storage space, and sequentially reads each video frame for display when the video is displayed.
However, since the process of buffering video frames and the process of reading video frames are independent of each other, in the process of displaying video, there is a case where the video frames being buffered are read out and displayed easily when the device reads the video frames. Since the video frame being buffered is not buffered, a part of the frame displayed by the device may belong to the video frame being buffered, and another part of the frame belongs to the video frame displayed by the previous frame, resulting in abnormal display such as tearing of the frame.
In order to solve the problem that abnormal display conditions easily occur in the process of displaying videos, the application provides a method for displaying videos. The method is based on a storage space set, a first target storage space indicated by a write pointer and used for caching received video frames is obtained, and a second target storage space indicated by a first read pointer and used for caching video frames to be displayed in the next frame of video is obtained. If the first target storage space is not matched with the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video. And reading the video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video.
In the embodiment of the application, when the video frame to be displayed is read in the process of displaying the video, not only the second target storage space for caching the video frame to be displayed of the next frame of the video indicated by the first read pointer, but also the first target storage space for caching the received video frame indicated by the write pointer are obtained. By matching the first target storage space and the second target storage space, abnormal display caused by mutual independence of a process of caching video frames and a process of reading video frames is avoided. When the first target storage space is not matched with the second target storage space, the process of caching the video frames is not in conflict with the process of reading the video frames, then the second read pointer indicating the storage space for caching the video frames currently displayed by the video can be updated to indicate the second target storage space, and then the video frames currently displayed by the video can be updated according to the video frames to be displayed in the second target storage space indicated by the second read pointer. Aiming at the process of reading the video frames, the first reading pointer and the second reading pointer are set, so that the storage space where the currently displayed video frame is located and the storage space where the next frame to be displayed is located can be clearly indicated, the storage space where the next frame to be displayed is located is determined when the next frame to be displayed is not needed after the current video frame is displayed, and the problem of video display delay is avoided; and when the video frame is not read, the storage space of the next frame to be displayed is determined, so that the problem of abnormal video display caused by the fact that the video frame is not read completely is avoided, and the stability of video display is improved.
The application scenario of the method for displaying video provided by the application is described below.
Referring to fig. 1, an application scenario of a method for displaying video according to an embodiment of the present application is shown. The application scene comprises a client 101 and a server 102. The client 101 and the server 102 may communicate with each other by using a wired communication technology, for example, communication is performed through a connection network or a serial port line; the communication may also be performed by using a wireless communication technology, for example, bluetooth or wireless fidelity (wireless fidelity, WIFI) technologies, and the like, which is not particularly limited.
The client 101 generally refers to a device that can display video, for example, a terminal device, a third party application that the terminal device can access, or a web page that the terminal device can access, or the like. The terminal equipment comprises, but is not limited to, mobile phones, computers, intelligent voice interaction equipment, intelligent household appliances, vehicle-mounted terminals and the like. Server 102 generally refers to a device, such as a terminal device or server, that can transceive video frames, buffer video frames, read video frames, etc. Servers include, but are not limited to, cloud servers, local servers, or associated third party servers, and the like. Both the client 101 and the server 102 can adopt cloud computing to reduce occupation of local computing resources; cloud storage may also be employed to reduce the occupation of local storage resources.
The method for displaying video according to the embodiment of the present application will be specifically described with reference to fig. 1, and in the embodiment of the present application, a server 102 is taken as an example.
Fig. 2 is a flowchart of a method for displaying video according to an embodiment of the present application.
S201, based on the storage space set, a first target storage space indicated by the write pointer and used for caching received video frames is obtained, and a second target storage space indicated by the first read pointer and used for caching video frames to be displayed in the next frame of video is obtained.
The server may obtain the write pointer and the first read pointer from the set of storage spaces to determine a first target storage space indicated by the write pointer and a second target storage space indicated by the first read pointer. The first target storage space is used for caching received video frames, and the second target storage space is used for caching video frames to be displayed in the next frame of video. Please refer to fig. 3, which is a schematic diagram of a possible structure of the storage space set. The video frame A is cached in the storage space A, the video frame B is cached in the storage space B, and the video frames are not cached in the storage space C and the storage space D. The write pointer points to the storage space C, representing the currently received video frame, and may be cached in the storage space C. The first reading pointer points to the storage space B, and indicates a to-be-displayed video frame to be displayed next to the video frame, and the to-be-displayed video frame can be read from the storage space B.
As an embodiment, in order to effectively determine the situation of the residual frame, the insufficient frame rate, and even the broken frame, a write pointer may be embedded in the received video frame, so that the video frames buffered in each storage space may carry the write pointer. If the video frames cached in each storage space in the storage space set carry write pointers, after obtaining the second target storage space indicated by the first read pointer and used for caching video frames to be displayed in the next frame of video, the server can determine the write pointers carried by the video frames to be displayed based on the video frames to be displayed in the second target storage space, so that the first target storage space indicated by the write pointers and used for caching received video frames can be obtained.
As an embodiment, each storage space in the storage space set may correspond to a preset storage space size, and then the storage space set may only include a base address corresponding to each storage space, so that each base address in the storage space set may uniquely represent each storage space. Each base address in the storage space set can be allocated by an operator according to the memory use condition of the server, or can be determined by the server according to the memory use condition, and the method is not particularly limited. The storage spaces respectively correspond to the preset storage space, and the size of the storage space is not smaller than that of a video frame, so that at least one video frame can be buffered in one storage space.
As one example, a set of storage spaces may be obtained by:
the server can determine the processing delay information of the server in the video display process according to the processing delay of each module in the video frame caching process and the video frame reading process. The server can also determine the processing delay information of the server in the video display process according to the processing delay obtained by testing each module when leaving the factory, and the method for obtaining the processing delay information is not particularly limited.
After obtaining the processing delay information, the server may determine a target number of storage spaces corresponding to the processing delay information based on a mapping relationship between the pre-stored reference delay information and the number of storage spaces. The mapping relation is used for representing corresponding reference delay information, and corresponding storage space quantity can ensure that video frames can be displayed continuously when the server displays video. For example, the reference delay information corresponding to the ping-pong operation maps 2 storage spaces.
After determining the target number of storage spaces, the server may allocate each storage space in the memory based on the target number of storage spaces and a preset storage space size. Since the storage space size of each storage space is already preset, the storage space set can be generated based on the respective base address of each storage space. The server may also generate a storage space set based on the base address of each storage space and the storage space size of each storage space, and specifically, the form of the storage space set is not limited.
As an embodiment, the target storage space amount may be set to be not greater than the preset amount threshold, so as to avoid the situation that the processing capacity of the server is abnormal due to more occupied server resources when all storage spaces are occupied. The preset number threshold may be set by an operator, or may be set and updated by the server according to the occupation condition of the resources of the server, which is not particularly limited.
S202, if the first target storage space is not matched with the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer.
After obtaining the first target storage space indicated by the write pointer and the second target storage space indicated by the first read pointer, the server may match the first target storage space with the second target storage space, and through the matching result, it may be determined whether the process of buffering the video frame collides with the process of reading the video frame. If the first target storage space does not match the second target storage space, it may be determined that the process of buffering the video frame does not conflict with the process of reading the video frame, and the second read pointer may be updated to indicate the second target storage space based on the first read pointer.
With continued reference to fig. 3, the second read pointer points to the storage space a, which indicates that the video frame currently displayed by the video is read from the storage space a, or may indicate that the video frame currently to be displayed by the video is being read from the storage space a.
As an embodiment, during the process of displaying video, when the device reads video frames, the situation that no video frame is cached in the storage space or no video frame is completely cached in the storage space, so that the device reads empty frames or residual frames and displays abnormal display is easy to occur. In order to avoid the situation of reading empty frames or residual frames, the server may further determine whether a video frame to be displayed exists in the second target storage space when determining that the first target storage space does not match the second target storage space.
If there is a video frame to be displayed in the second target storage space, indicating that the video frame can be read from the second target storage space without reading a blank frame or reading a residual frame, the server may update the second read pointer to indicate the second target storage space based on the first read pointer, and perform S203.
If the second target storage space does not have any video frame to be displayed, it may also be indicated that the second target storage space does not have any video frame to be displayed completely buffered, and if the video frame is read from the second target storage space, a situation of reading an empty frame or reading a residual frame may occur, then the server may continue to display the video frame currently displayed by the video.
As an embodiment, the server continues to display the video frame currently displayed by the video, which may be that the server controls the video to pause in the video frame currently displayed and maintain to display the video frame currently displayed; the server may continue to read the video frames in the storage space based on the storage space indicated by the second read pointer, and display the read video frames, which is not particularly limited.
As an embodiment, after the server continues to display the video frame currently displayed by the video, the server may update the first read pointer to indicate the storage space other than the second target storage space in the storage space set based on respective arrangement orders, where the respective arrangement orders are arrangement orders corresponding to respective storage spaces in the storage space set. For example, the base addresses of the respective storage spaces in the storage space set are arranged in order, and then the server may update the first read pointer to indicate a storage space corresponding to the next base address arranged behind the base address of the second target storage space according to the arrangement order of the base addresses of the second target storage space indicated by the first read pointer in the storage space set.
After the server continues to display the video frame currently displayed by the video, the server may further update the first read pointer to indicate a storage space other than the second target storage space in the storage space set according to the indication sequence of the write pointer. For example, when the write pointers sequentially indicate the storage spaces for buffering each received video frame, the server may record the indication sequence of the write pointers, and when the buffered video frames are read, may update the first read pointer according to the indication sequence of the write pointers, and read and display the video frames.
As an embodiment, each storage space in the storage space set may have a storage identifier, if a video frame to be displayed exists in the storage space, a storage identifier indicating that a video frame to be displayed exists may be added to the storage space, and if a video frame to be displayed does not exist in the storage space, a storage identifier indicating that a video frame to be displayed does not exist may be added to the storage space. Therefore, the server can determine whether the video frame to be displayed exists in the corresponding storage space according to the storage identification of the storage space.
After the server updates the first read pointer to indicate the storage space except for the second target storage space in the storage space set, the method provided by the application can be re-executed to perform the next round of judging, reading and displaying processes.
S203, the video frame to be displayed in the second target storage space indicated by the second reading pointer is read, and the video frame currently displayed by the video is updated.
After the server updates the second read pointer to indicate the second target storage space according to the first read pointer, the video frame to be displayed in the second target storage space indicated by the second read pointer can be read, and the video frame currently displayed by the video is updated, so that the video can be switched from a picture presented by the video frame of the previous frame to a picture presented by the video frame to be displayed, and the playing of the video is realized. After the video frame to be displayed is successfully read, the next video frame to be displayed can be continuously read based on the method provided by the embodiment of the application, and the display of the video can be continuously carried out.
In order to avoid the situation that the server waits for reading the video frame all the time due to the abnormality of the reading process of one video frame in the video display process, so that the video display is abnormal, if the server does not receive a reading completion signal for the video frame to be displayed within a preset duration when reading the video frame to be displayed in the second target storage space indicated by the second reading pointer, the server continues to display the video frame currently displayed by the video frame to be displayed, and re-reads the video frame to be displayed, so that the situation that video is torn when the video frame is not read all the time, such as the video black screen display is caused, or part of the video frame is displayed, and the other part of the video frame is displayed. When the read video frame size matches the preset video frame size, it may be regarded as a read completion signal, when a preset current signal is received, it may be regarded as a read completion signal, or the like, without limitation.
When the server reads the video frame to be displayed in the second target storage space indicated by the second read pointer, if a read completion signal for the video frame to be displayed is received within a preset time length, which indicates that the video frame to be displayed is successfully read, the video frame currently displayed in the video can be updated based on the read video frame to be displayed, so that the video can be switched from the picture presented by the video frame of the previous frame to the picture presented by the video frame to be displayed, and the video is played. After the video frame to be displayed is successfully read, the next video frame to be displayed can be continuously read based on the method provided by the embodiment of the application, and the display of the video can be continuously carried out.
As an embodiment, after the video frame to be displayed is successfully read or successfully displayed, the video frame to be displayed may be deleted from the second target storage space, so as to avoid that unnecessary video frames occupy the storage resource of the server. If the storage space has a storage identity, the server may update the storage identity of the second target storage space to a storage identity that characterizes the absence of the video frame to be displayed after deleting the video frame to be displayed from the second target storage space.
After deleting the video frame to be displayed from the second target storage space, the first read pointer may be updated to indicate other storage spaces except for the second target storage space in the storage space set based on each arrangement sequence, where each arrangement sequence is an arrangement sequence corresponding to each storage space in the storage space set, and specific reference may be made to the foregoing description and will not be repeated herein.
As one embodiment, after matching the first target storage space with the second target storage space, if the first target storage space matches the second target storage space, indicating that the process of buffering video frames conflicts with the process of reading video frames, the server may continue to display the video frame currently displayed by the video. The process of continuing to display the video frame currently displayed by the video may be referred to the foregoing description, and will not be repeated here.
In the following, an exemplary description of a method for displaying video according to the present application is provided, and reference is made to a schematic flow chart shown in fig. 4a and a schematic principle diagram shown in fig. 4 b.
S401, a first target memory space indicated by the write pointer, i.e. BUF1 indicated by wr_id=1, and a second target memory space indicated by the first read pointer, i.e. BUF0 indicated by rd_id=0, are obtained.
S402, judging whether the wr_id and the rd_id are matched, and determining that the wr_id and the rd_id are not matched because the wr_id and the rd_id are not equal.
S403, determining that the video frame to be displayed exists in the second target memory space BUF0 according to the memory identification flag [0] of the second target memory space BUF0 being 1.
S404, based on the first read pointer rd_id=0, the second read pointer is updated.
S405, based on the second read pointer last_rd_id=0, the video frame to be displayed is read in the second target storage space BUF 0.
S406, judging whether a read completion signal for the video frame to be displayed is received within a preset time period, if the read completion signal for the video frame to be displayed is received within the preset time period, updating the storage identification flag [0] of the second target storage space BUF0 to 0, wherein the fact that the video frame to be displayed does not exist in the second target storage space BUF0 is indicated.
S407, updating the first reading pointer to other storage spaces except BUF0 in the storage space set, namely updating the rd_id to point to BUF1, and continuing to read the video frame to be displayed of the next frame.
Based on the same inventive concept, the embodiment of the application provides a method for caching video frames. After receiving a video frame to be stored, the method obtains a first target storage space indicated by a write pointer and used for caching the received video frame to be stored based on a storage space set, and obtains a second target storage space indicated by a first read pointer and used for caching a video frame to be stored of a next frame of video. And if the first target storage space is not matched with the second target storage space, caching the video frames to be stored in the first target storage space.
Continuing with fig. 1, a method for buffering video frames according to an embodiment of the present application will be described.
Fig. 5 is a flowchart of a method for buffering video frames according to an embodiment of the present application.
S501, receiving a video frame to be stored.
In the process of displaying the video, the server can continuously receive the video frames sent by the acquisition equipment, and continuously send the video frames to the client based on the received video frames, so that the client sequentially displays each video frame, and the video is displayed. The server may also continuously receive video frames sent by other devices, and is not particularly limited. In the embodiment of the present application, the method provided in the embodiment of the present application is described by taking the reception of one video frame to be stored as an example, and the process after each video frame is received is similar to the process after the reception of the one video frame to be stored, and will not be described herein.
S502, based on the storage space set, a first target storage space indicated by the write pointer and used for caching the received video frames to be stored is obtained, and a second target storage space indicated by the first read pointer and used for caching the video frames to be stored of the next frame of video is obtained.
After receiving the video frame to be stored, the server obtains, based on the storage space set, a first target storage space indicated by the write pointer and used for caching the received video frame to be stored, and obtains a second target storage space indicated by the first read pointer and used for caching the video frame to be stored of the next frame of video, which is referred to the description in S201 and will not be repeated here.
S503, if the first target storage space is not matched with the second target storage space, the video frame to be stored is cached in the first target storage space.
After the server obtains the first target storage space and the second target storage space, the first target storage space and the second target storage space can be matched, so that whether the process of caching video frames conflicts with the process of reading video frames or not can be determined, the situation that the storage space of the video frames to be cached is the storage space of the video frames to be read or the storage space of the video frames to be read is avoided, the situation that the video frames are not completely cached due to limited storage space size is avoided, the situation that the video frames just cached are read in the process of reading the video frames is avoided, and the like.
If the first target storage space does not match the second target storage space, indicating that the operation of buffering the video frames does not conflict with the operation of reading the video frames, the video frames to be stored may be buffered in the first target storage space. If the buffer completion signal for the video frame to be stored is not received within the preset time length, the next video frame to be stored is continuously received, and the situation that the next video frame to be buffered cannot be buffered because the buffer abnormality occurs to the video frame to be buffered is avoided.
As an embodiment, after the video frames to be stored are cached in the first target storage space, if a caching completion signal for the video frames to be stored is received within a preset duration, which indicates that the caching of the video frames to be stored is completed, a cache identifier for indicating that the video frames to be stored exist may be added to the first target storage space. When the size of the video frame buffered in the storage space matches with the preset video frame size, the buffer completion signal may be considered as a buffer completion signal, and when the preset current signal is received, the buffer completion signal may be considered as a buffer completion signal, etc., without limitation.
After receiving the buffer completion signal for the video frame to be stored, the server may update the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, where each arrangement sequence is an arrangement sequence corresponding to each storage space in the storage space set, and reference may be made to the foregoing description and will not be repeated herein.
As an embodiment, in the process of caching the video frames to be stored, if a new video frame to be cached is received, the server may update the write pointer to indicate the storage space except for the first target storage space in the storage space set directly based on each arrangement order, so as to avoid the situation that the next video frame to be cached cannot be cached due to the occurrence of the abnormal caching of the video frames to be cached or the occurrence of the abnormal receiving of the caching completion signal.
As an embodiment, if the first target storage space matches the second target storage space, indicating that there may be a conflict between the operation of buffering the video frames and the operation of reading the video frames, the server may determine whether there is a video frame to be stored in the first target storage space. If the first target storage space has video frames to be stored, which indicates that the first target storage space can not store other video frames, updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set. After the write pointer is updated to point to other storage spaces, the video frame to be stored can be stored in the updated storage space, and when the storage is completed, a storage identifier with the video frame to be stored is added to the updated storage space, and then the write pointer is updated to other storage spaces.
If the first target storage space does not have the video frames to be stored, which means that the video frames can be cached in the first target storage space, the video frames to be stored are cached in the first target storage space.
In one embodiment, in the process that the server caches the video frame to be stored in the first target storage space, the server may perform data expansion processing on the video frame to be stored, write the write pointer into the video frame to be stored after the data expansion processing, and obtain the video frame to be stored carrying the write pointer. And caching the video frames to be stored carrying the write pointer in the first target storage space. Because the write pointer is embedded into the video stream, the conditions of residual frames, insufficient frame rate and even frame interruption can be effectively judged, and the method is applicable to different types of operating systems.
In the following, an exemplary description of a method for buffering video frames according to the present application is provided, and please refer to a flowchart shown in fig. 6a and a schematic diagram shown in fig. 6 b.
S601, receiving a video frame to be stored.
S602, a first target memory space indicated by the write pointer, i.e. BUF0 indicated by wr_id=0, and a second target memory space indicated by the first read pointer, i.e. BUF0 indicated by rd_id=0, are obtained.
S603, judging whether the wr_id and the rd_id are matched, and determining that the wr_id and the rd_id are matched because the wr_id and the rd_id are equal.
S604, according to the storage identification flag [0] of the first target storage space BUF0 being 0, it is determined that no video frame to be stored exists in the first target storage space BUF0.
S605 embeds wr_id in the video frame to be stored, and stores the video frame to be stored carrying wr_id in the first target storage space BUF0.
S606, judging whether a buffer completion signal for the video frame to be stored is received within a preset time period, if the buffer completion signal for the video frame to be displayed is received within the preset time period, updating a storage identification flag [0] of the first target storage space BUF0 to 1 to indicate that the video frame to be buffered exists in the first target storage space BUF0.
S607 updates the write pointer to the other storage space except BUF0 in the storage space set, i.e. updates wr_id to point to BUF1, and continues to read the video frame to be stored of the next frame.
In the following, an exemplary description will be given of a method for buffering video frames and a method for displaying video according to the present application, referring to fig. 7a, which is a schematic structural diagram of some modules included in a server. The server comprises an acquisition module, a video processing module, a storage module, a frame buffer scheduling module, a sending module, a display module and the like. The acquisition module is used for acquiring video from a video source so that video frames to be stored can be obtained. The video processing module is used for carrying out data processing, such as image processing or data packet processing, on the acquired video frames to be stored. The memory module includes a set of memory spaces for storing data, such as RAM, SDRAM, or DDR, etc., random access memory. The frame buffer scheduling module is used for controlling the buffer video frames and the read video frames. The sending module is used for sending the read video frames to be displayed to the display module according to a given time sequence, the display module is used for displaying the received video frames to be displayed, and the display module is an LED screen and the like.
As an embodiment, a plurality of registers may be included in the server, wherein each register is configured to hold a base address of one of the set of storage spaces. Each storage space in the storage space set can be discontinuous or continuous; one register for holding a write pointer, one register for holding a first read pointer, and one register for holding a second read pointer.
The following describes an example of a method for buffering video frames based on fig. 7a, in conjunction with the process of the method for displaying video, please refer to a flow chart shown in fig. 7b and a schematic diagram shown in fig. 7 c.
S701, a frame of video frame is acquired by an acquisition module, and the video frame to be stored is obtained.
S702, the frame buffer scheduling module obtains a first target storage space indicated by the write pointer, i.e. BUF1 indicated by wr_id=1, and a second target storage space indicated by the first read pointer, i.e. BUF1 indicated by rd_id=1.
S703, the frame buffer scheduling module judges whether the wr_id and the rd_id are matched, and determines that the wr_id and the rd_id are matched because the wr_id and the rd_id are equal.
S704, the frame buffer scheduling module determines that no video frame to be stored exists in the first target storage space BUF1 according to the storage identification flag [1] of the first target storage space BUF1 being 0.
S705, the frame buffer scheduling module embeds the wr_id into the video frame to be stored, and stores the video frame to be stored carrying the wr_id into the first target memory space BUF1.
In the process that the frame buffer scheduling module controls the buffer of the video frame to be stored in BUF1, S706, the buffer of the video frame to be stored is not completely completed, for example, the residual frame is buffered for some reasons. If the acquisition module acquires a new video frame to be stored, the frame buffer scheduling module updates the wr_id to point to BUF2, and the method for buffering the video frame provided by the application is re-executed.
S707, the frame buffer scheduling module obtains the second target storage space indicated by the first read pointer, that is, BUF1 indicated by rd_id=1, during the process of reading the video frame. According to the write pointer carried in the video frame to be displayed, wrid=2, the first target storage space indicated by the write pointer, i.e. BUF2, is determined.
S708, the frame buffer scheduling module judges whether the wr_id and the rd_id are matched, and determines that the wr_id and the rd_id are not matched because the wr_id and the rd_id are not equal.
S709, the frame buffer scheduling module determines that the video frame to be displayed does not exist in the second target storage space BUF1 according to the storage identification flag [1] of the second target storage space BUF1 being 0.
And S710, when the frame buffer scheduling module starts to read the video frame to be displayed of the next frame, as no video frame to be displayed exists in the storage area indicated by the first reading pointer, the video frame currently being displayed can be continuously read from BUF0 pointed by the second reading pointer last rd id and sent to the sending module, so that the video frame is sent to the display module to be continuously displayed, or the frame buffer scheduling module directly controls the display module to continuously display the video frame currently being displayed.
S711, if a read completion signal for the video frame to be displayed is received within the preset time period, the frame buffer scheduling module sets the storage flag [0] of the second target storage space BUF0 to 0.
S712, the frame buffer scheduling module updates the first read pointer to other storage spaces except BUF1 in the storage space set, namely, updates the rd_id to point to BUF2, and continues to read the video frame to be displayed of the next frame. Thus, a complete one-frame video frame has been buffered at BUF0 and read away. When the BUF1 caches the video frame of the residual frame, if the video frame is not ready to be read from the BUF2, the video frame cached in the BUF0 can be continuously displayed, so that the video frame of the residual frame is prevented from being read and displayed.
The following describes an example of a method for buffering video frames based on fig. 7a, in conjunction with the process of the method for displaying video, please refer to a flow chart shown in fig. 8a and a schematic diagram shown in fig. 8 b. The process of buffering the video frames may refer to S701 to S706, and at this time, since the speed of buffering the video frames is abnormally slow, even the buffering operation is stopped, the process of buffering the video frames by the frame buffering scheduling module is always stopped in the first target storage space BUF1, and in this case, the process of reading the video frames is described below.
S801, the frame buffer scheduling module obtains a second target storage space indicated by the first read pointer, that is, BUF1 indicated by rd_id=1, during the process of reading the video frame. According to the write pointer carried in the video frame to be displayed, wrid=1, the first target storage space indicated by the write pointer, i.e. BUF1, is determined.
S802, the frame buffer scheduling module judges whether the wr_id and the rd_id are matched, and since the wr_id and the rd_id are equal, the wr_id and the rd_id are determined to be matched.
S803, when the next frame to be displayed is required to be displayed, the frame buffer scheduling module reads the video frame to be displayed from BUF0 pointed by last_rd_id and sends the video frame to be displayed to the sending module, so that the sending module sends the video frame to be displayed to the display module, and the display module displays the video frame to be displayed.
S804, if the read completion signal for the video frame to be displayed is received within the preset time length, the frame buffer scheduling module continues to read the video frame of the next frame, and the video display method is re-executed.
Based on the same inventive concept, the embodiment of the application provides a device for displaying video, which is equivalent to the server discussed above, and can realize the functions corresponding to the method for displaying video. Referring to fig. 9, the apparatus includes an acquisition module 901 and a processing module 902, where:
acquisition module 901: the method comprises the steps of obtaining a first target storage space indicated by a write pointer and used for caching received video frames based on a storage space set, and obtaining a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of next frames of video;
processing module 902: if the first target storage space is not matched with the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video;
the processing module 902 is further configured to: and reading the video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video.
In one possible embodiment, the processing module 902 is specifically configured to:
reading a video frame to be displayed in a second target storage space indicated by a second reading pointer, if a reading completion signal for the video frame to be displayed is not received within a preset duration, continuing to display the video frame currently displayed by the video, and re-reading the video frame to be displayed;
if the read completion signal for the video frame to be displayed is received within the preset time length, updating the video frame currently displayed by the video based on the video frame to be displayed.
In one possible embodiment, the processing module 902 is further configured to:
if the read completion signal for the video frame to be displayed is received within the preset time length, deleting the video frame to be displayed from the second target storage space after updating the video frame currently displayed by the video based on the video frame to be displayed;
updating the first reading pointer to indicate other storage spaces except the second target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set.
In one possible embodiment, the processing module 902 is specifically configured to:
If the first target storage space is not matched with the second target storage space, determining whether a video frame to be displayed exists in the second target storage space;
if the video frame to be displayed exists in the second target storage space, the second reading pointer is updated to indicate the second target storage space based on the first reading pointer.
In one possible embodiment, the processing module 902 is further configured to:
after determining whether the video frame to be displayed exists in the second target storage space if the first target storage space is not matched with the second target storage space, if the video frame to be displayed does not exist in the second target storage space, continuing to display the video frame currently displayed by the video;
updating the first read pointer to indicate the other storage spaces except the second target storage space in the storage space set based on the respective arrangement sequences, wherein the respective arrangement sequences are the arrangement sequences corresponding to the respective storage spaces in the storage space set.
In one possible embodiment, the processing module 902 is further configured to:
and after a first target storage space for caching the received video frame indicated by the write pointer is obtained based on the storage space set and a second target storage space for caching the video frame to be displayed of the next frame of the video indicated by the first read pointer is obtained, if the first target storage space is matched with the second target storage space, continuing to display the video frame currently displayed by the video.
In one possible embodiment, if the video frames buffered in each storage space in the storage space set carry a write pointer, the obtaining module is specifically configured to:
obtaining a second target storage space indicated by the first reading pointer and used for caching a video frame to be displayed of a next frame of the video;
and determining a write pointer carried by the video frame to be displayed based on the video frame to be displayed in the second target storage space, and obtaining a first target storage space indicated by the write pointer and used for caching the received video frame.
In one possible embodiment, the set of storage spaces is obtained by:
the obtaining module is further configured to: obtaining processing delay information in the video display process;
the processing module 902 is further configured to: determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between the pre-stored reference delay information and the number of storage spaces;
the processing module 902 is further configured to: based on the number of the target storage spaces and the preset storage space size, distributing each storage space in the memory;
the processing module 902 is further configured to: a set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
Based on the same inventive concept, the embodiment of the application provides a device for caching video frames, which is equivalent to the server discussed above, and can realize the functions corresponding to the method for caching video frames. Referring to fig. 10, the apparatus includes a transceiver module 1001 and a processing module 902, where:
Transceiver module 1001: for receiving a video frame to be stored;
processing module 1002: the method comprises the steps of obtaining a first target storage space indicated by a write pointer and used for caching received video frames to be stored based on a storage space set, and obtaining a second target storage space indicated by a first read pointer and used for caching video frames to be stored of next frames of video;
the processing module 1002 is further configured to: and if the first target storage space is not matched with the second target storage space, caching the video frames to be stored in the first target storage space.
In one possible embodiment, the processing module 1002 is further configured to:
after the video frames to be stored are cached in the first target storage space if the first target storage space is not matched with the second target storage space, if a caching completion signal for the video frames to be stored is received within a preset time period, a caching identification for representing the existence of the video frames to be stored is added to the first target storage space, and based on each arrangement sequence, a write pointer is updated to indicate other storage spaces except the first target storage space in the storage space set, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set;
If the buffer completion signal for the video frame to be stored is not received within the preset time length, the next frame of the video frame to be stored is continuously received.
In one possible embodiment, the processing module 1002 is further configured to:
after a first target storage space for caching received video frames to be stored indicated by a write pointer is obtained based on a storage space set and a second target storage space for caching video frames to be stored of a next frame of video indicated by a first read pointer is obtained, if the first target storage space is matched with the second target storage space, determining whether the video frames to be stored exist in the first target storage space;
if the first target storage space has the video frame to be stored, updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set;
and if the first target storage space does not have the video frames to be stored, caching the video frames to be stored in the first target storage space.
In one possible embodiment, the processing module 1002 is specifically configured to:
Performing data expansion processing on the video frames to be stored;
writing the write pointer into the video frame to be stored after the data expansion processing to obtain the video frame to be stored carrying the write pointer;
and caching the video frames to be stored carrying the write pointer in the first target storage space.
Based on the same inventive concept, embodiments of the present application provide a computer apparatus, and the computer apparatus 1100 is described below.
Referring to fig. 11, the apparatus for displaying video or the apparatus for buffering video frames may be run on a computer device 1100, a current version and a historical version of a data storage program and application software corresponding to the data storage program may be installed on the computer device 1100, and the computer device 1100 includes a display unit 1140, a processor 1180 and a memory 1120, where the display unit 1140 includes a display panel 1141 for displaying an interface interacted with by a user.
In one possible embodiment, the display panel 1141 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD) or an Organic Light-Emitting Diode (OLED) or the like.
The processor 1180 is used to read a computer program and then execute a method defined by the computer program, for example, the processor 1180 reads a data storage program or a file, etc., so that the data storage program is run on the computer device 1100, and a corresponding interface is displayed on the display unit 1140. The processor 1180 may include one or more general-purpose processors and may also include one or more DSPs (Digital Signal Processor, digital signal processors) for performing related operations to implement the techniques provided by embodiments of the present application.
Memory 1120 typically includes memory and external memory, which may be Random Access Memory (RAM), read Only Memory (ROM), and CACHE memory (CACHE), among others. The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk, a tape drive, etc. The memory 1120 is used to store computer programs including application programs corresponding to the respective clients, etc., and other data, which may include data generated after the operating system or application programs are executed, including system data (e.g., configuration parameters of the operating system) and user data. In the embodiment of the present application, the program instructions are stored in the memory 1120, and the processor 1180 executes the program instructions stored in the memory 1120, so as to implement any of the methods for displaying video or the method for buffering video frames discussed in the previous figures.
The above-described display unit 1140 is used to receive input digital information, character information, or touch operation/non-contact gestures, and to generate signal inputs related to user settings and function controls of the computer device 1100, and the like. Specifically, in an embodiment of the present application, the display unit 1140 may include a display panel 1141. The display panel 1141, such as a touch screen, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on the display panel 1141 or on the display panel 1141 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a predetermined program.
In one possible embodiment, the display panel 1141 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a player, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device and converts it into touch point coordinates, which are then sent to the processor 1180, and can receive commands from the processor 1180 and execute them.
The display panel 1141 may be implemented by various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 1140, the computer device 1100 may also include an input unit 1130, which input unit 1130 may include a graphical input device 1131 and other input devices 1132, where the other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc.
In addition to the above, the computer device 1100 may also include a power supply 1190 for powering other modules, audio circuitry 1160, near field communication module 1170, and RF circuitry 1110. The computer device 1100 may also include one or more sensors 1150, such as acceleration sensors, light sensors, pressure sensors, and the like. The audio circuit 1160 specifically includes a speaker 1161 and a microphone 1162, etc., for example, the computer device 1100 may collect user's voice through the microphone 1162, perform corresponding operations, etc.
The number of processors 1180 may be one or more, and the processors 1180 and the memory 1120 may be coupled or may be relatively independent.
As an example, the processor 1180 in fig. 11 may be used to implement the functions of the acquisition module 901 and the processing module 902 in fig. 9, and may also be used to implement the functions of the transceiver module 1001 and the processing module 1002 in fig. 10.
As an example, the processor 1180 in fig. 11 may be used to implement the functions corresponding to the server 102 discussed above.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware associated with program instructions, where the foregoing program may be stored in a computer readable storage medium, and when executed, the program performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or an optical disk, or the like, which can store program codes.
Alternatively, the above-described integrated units of the present invention may be stored in a computer-readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solutions of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (13)

1. A method of displaying video, comprising:
based on the storage space set, a first target storage space indicated by a write pointer and used for caching received video frames is obtained, and a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of the next frame of the video is obtained;
if the first target storage space is not matched with the second target storage space, updating a second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video;
reading a video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video;
the storage space set is obtained by the following method:
Obtaining processing delay information in the video display process;
determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between pre-stored reference delay information and the number of storage spaces;
based on the target storage space quantity and the preset storage space size, distributing each storage space in the memory;
the set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
2. The method of claim 1, wherein reading the video frame to be displayed in the second target storage space indicated by the second read pointer, updating the video frame currently displayed by the video, comprises:
reading a video frame to be displayed in the second target storage space indicated by the second read pointer, if a read completion signal for the video frame to be displayed is not received within a preset duration, continuing to display the video frame currently displayed by the video, and re-reading the video frame to be displayed;
and if the reading completion signal for the video frame to be displayed is received within the preset time length, updating the video frame currently displayed by the video based on the video frame to be displayed.
3. The method according to claim 2, further comprising, after updating the video frame currently displayed by the video based on the video frame to be displayed if the read completion signal for the video frame to be displayed is received within a preset time period:
deleting the video frame to be displayed from the second target storage space;
updating the first reading pointer to indicate other storage spaces except the second target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set.
4. The method of any of claims 1-3, wherein updating the second read pointer to indicate the second target storage space based on the first read pointer if the first target storage space does not match the second target storage space comprises:
if the first target storage space is not matched with the second target storage space, determining whether the video frame to be displayed exists in the second target storage space;
and if the video frame to be displayed exists in the second target storage space, updating the second read pointer to indicate the second target storage space based on the first read pointer.
5. The method of claim 4, wherein after determining whether the video frame to be displayed is present in the second target storage space if the first target storage space and the second target storage space do not match, further comprising:
if the video frame to be displayed does not exist in the second target storage space, continuing to display the video frame currently displayed by the video;
updating the first read pointer to indicate other storage spaces except the second target storage space in the storage space set based on respective arrangement orders, wherein the respective arrangement orders are arrangement orders corresponding to the respective storage spaces in the storage space set.
6. A method according to any one of claims 1 to 3, wherein after obtaining, based on the storage space set, a first target storage space indicated by the write pointer for buffering the received video frame, and obtaining a second target storage space indicated by the first read pointer for buffering a video frame to be displayed for a next frame of the video, further comprises:
and if the first target storage space is matched with the second target storage space, continuing to display the video frame currently displayed by the video.
7. A method of buffering video frames, comprising:
receiving a video frame to be stored;
based on the storage space set, a first target storage space indicated by a write pointer and used for caching the received video frames to be stored is obtained, and a second target storage space indicated by a first read pointer and used for caching the video frames to be stored of the next frame of video is obtained;
if the first target storage space is not matched with the second target storage space, caching the video frames to be stored in the first target storage space;
the storage space set is obtained by the following method:
obtaining processing delay information in the video display process;
determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between pre-stored reference delay information and the number of storage spaces;
based on the target storage space quantity and the preset storage space size, distributing each storage space in the memory;
the set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
8. The method of claim 7, further comprising, after buffering the video frame to be stored in the first target storage space if the first target storage space does not match the second target storage space:
If a buffer completion signal for the video frame to be stored is received within a preset duration, adding a buffer identification for representing the video frame to be stored to the first target storage space, and updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is an arrangement sequence corresponding to each storage space in the storage space set;
if the buffer completion signal for the video frame to be stored is not received within the preset time length, continuing to receive the next video frame to be stored.
9. The method according to claim 7 or 8, wherein after obtaining a first target storage space indicated by the write pointer for buffering the received video frame to be stored based on the storage space set, obtaining a second target storage space indicated by the first read pointer for buffering the video frame to be stored for the next frame of video, further comprising:
if the first target storage space is matched with the second target storage space, determining whether a video frame to be stored exists in the first target storage space;
If the first target storage space has the video frame to be stored, updating the write pointer to indicate other storage spaces except the first target storage space in the storage space set based on each arrangement sequence, wherein each arrangement sequence is the arrangement sequence corresponding to each storage space in the storage space set;
and if the first target storage space does not have the video frames to be stored, caching the video frames to be stored in the first target storage space.
10. An apparatus for displaying video, comprising:
the acquisition module is used for: the method comprises the steps of obtaining a first target storage space indicated by a write pointer and used for caching received video frames based on a storage space set, and obtaining a second target storage space indicated by a first read pointer and used for caching video frames to be displayed of the next frame of video;
the processing module is used for: if the first target storage space is not matched with the second target storage space, updating a second read pointer to indicate the second target storage space based on the first read pointer, wherein the second read pointer indicates a storage space for caching a video frame currently displayed by the video;
The processing module is further configured to: reading a video frame to be displayed in the second target storage space indicated by the second read pointer, and updating the video frame currently displayed by the video;
the acquisition module is specifically configured to:
obtaining processing delay information in the video display process;
determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between pre-stored reference delay information and the number of storage spaces;
based on the target storage space quantity and the preset storage space size, distributing each storage space in the memory;
the set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
11. An apparatus for buffering video frames, comprising:
and a transceiver module: for receiving a video frame to be stored;
the processing module is used for: the method comprises the steps of obtaining a first target storage space indicated by a write pointer and used for caching received video frames to be stored based on a storage space set, and obtaining a second target storage space indicated by a first read pointer and used for caching video frames to be stored of next frames of video;
the processing module is further configured to: if the first target storage space is not matched with the second target storage space, caching the video frames to be stored in the first target storage space;
The processing module is specifically configured to:
obtaining processing delay information in the video display process;
determining the number of target storage spaces corresponding to the processing delay information based on a mapping relation between pre-stored reference delay information and the number of storage spaces;
based on the target storage space quantity and the preset storage space size, distributing each storage space in the memory;
the set of memory spaces is generated based on the respective base addresses of the respective memory spaces.
12. A computer device, comprising:
a memory for storing program instructions;
a processor for invoking program instructions stored in the memory and executing the method according to any of the claims 1-9 according to the obtained program instructions.
13. A computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method of any one of claims 1-9.
CN202110966888.4A 2021-08-23 2021-08-23 Video display method, video frame caching method and device Active CN113784197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110966888.4A CN113784197B (en) 2021-08-23 2021-08-23 Video display method, video frame caching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110966888.4A CN113784197B (en) 2021-08-23 2021-08-23 Video display method, video frame caching method and device

Publications (2)

Publication Number Publication Date
CN113784197A CN113784197A (en) 2021-12-10
CN113784197B true CN113784197B (en) 2023-10-03

Family

ID=78838731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110966888.4A Active CN113784197B (en) 2021-08-23 2021-08-23 Video display method, video frame caching method and device

Country Status (1)

Country Link
CN (1) CN113784197B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115984457A (en) * 2022-12-02 2023-04-18 北京百度网讯科技有限公司 Three-dimensional model display method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5388208A (en) * 1992-12-04 1995-02-07 Honeywell Inc. Gerbil wheel memory
US6044431A (en) * 1996-04-12 2000-03-28 Sony Corporation Data buffer using dummy data
WO2015058617A1 (en) * 2013-10-23 2015-04-30 腾讯科技(深圳)有限公司 Video frame storage management method, video server and communication system
CN111512603A (en) * 2017-12-27 2020-08-07 华为技术有限公司 Data transmission method and first equipment
CN112600815A (en) * 2020-12-08 2021-04-02 努比亚技术有限公司 Video display method, terminal and computer readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8390743B2 (en) * 2011-03-31 2013-03-05 Intersil Americas Inc. System and methods for the synchronization and display of video input signals
JP6199070B2 (en) * 2013-04-26 2017-09-20 シャープ株式会社 Memory control device and portable terminal
JP2017152928A (en) * 2016-02-24 2017-08-31 富士通株式会社 Transmission device and signal processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5388208A (en) * 1992-12-04 1995-02-07 Honeywell Inc. Gerbil wheel memory
US6044431A (en) * 1996-04-12 2000-03-28 Sony Corporation Data buffer using dummy data
WO2015058617A1 (en) * 2013-10-23 2015-04-30 腾讯科技(深圳)有限公司 Video frame storage management method, video server and communication system
CN111512603A (en) * 2017-12-27 2020-08-07 华为技术有限公司 Data transmission method and first equipment
CN112600815A (en) * 2020-12-08 2021-04-02 努比亚技术有限公司 Video display method, terminal and computer readable storage medium

Also Published As

Publication number Publication date
CN113784197A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
EP3382994A1 (en) Method and apparatus for updating data
CN104852885B (en) Method, device and system for verifying verification code
US10802622B2 (en) Electronic device and method for controlling same
WO2015058617A1 (en) Video frame storage management method, video server and communication system
CN109885257B (en) Disk file reading and writing method and device
CN108984066B (en) Application icon display method and mobile terminal
CN106462270B (en) Input device, method and system for electronic device
US20220058118A1 (en) Garbage Data Scrubbing Method, and Device
CN109428839B (en) CDN scheduling method, device and system
CN109144723B (en) Method and terminal for allocating storage space
CN113395592A (en) Video playing control method, device, equipment and computer storage medium
CN111199424A (en) Advertisement putting method and device, terminal equipment and storage medium
CN113784197B (en) Video display method, video frame caching method and device
CN106682189B (en) File name display method and device
EP3229125A1 (en) Electronic device and method of receiving user input thereof
CN107918517B (en) Screen rotation response method and device, mobile terminal and storage medium
WO2019052436A1 (en) Image processing method, computer-readable storage medium and mobile terminal
CN109889568B (en) Data export method, server and system
WO2015062400A1 (en) Method for managing video channel allocation, related device, and communications system
CN106970812B (en) Upgrade file processing device and terminal
CN115657943A (en) Data processing method, device and equipment for thin volume of storage system and storage medium
CN115269243A (en) Method, device and equipment for detecting process and storage medium
CN109308164B (en) System migration method and device
US11327845B2 (en) Image synchronization method and device, and server
CN105302846B (en) Method and device for restoring webpage

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant