Store queue of PTS for pending frames

Several frames may be read by read_packet() before they are consumed
(returned by av_read_frame()), so we need to store the PTS of frames in
order, so that the right PTS is assigned to the right frame.
This commit is contained in:
Romain Vimont
2018-11-11 15:27:52 +01:00
parent 345f8858d3
commit 60afb46c8d
2 changed files with 60 additions and 8 deletions

View File

@@ -9,6 +9,11 @@
struct frames;
struct frame_meta {
uint64_t pts;
struct frame_meta *next;
};
struct decoder {
struct frames *frames;
socket_t video_socket;
@@ -16,8 +21,8 @@ struct decoder {
SDL_mutex *mutex;
struct recorder *recorder;
struct receiver_state {
uint64_t next_pts;
uint64_t pts;
// meta (in order) for frames not consumed yet
struct frame_meta *frame_meta_queue;
size_t remaining; // remaining bytes to receive for the current frame
} receiver_state;
};