Record a packet with its duration

Record a packet only once the following has been received, so that we
can set its duration before muxing it.

Fixes <https://github.com/Genymobile/scrcpy/issues/702>
This commit is contained in:
Romain Vimont
2019-08-08 18:57:20 +02:00
parent 8a08ca0f3d
commit 8507fea271
2 changed files with 34 additions and 2 deletions

View File

@@ -34,6 +34,12 @@ struct recorder {
bool stopped; // set on recorder_stop() by the stream reader
bool failed; // set on packet write failure
struct recorder_queue queue;
// we can write a packet only once we received the next one so that we can
// set its duration (next_pts - current_pts)
// "previous" is only accessed from the recorder thread, so it does not
// need to be protected by the mutex
struct record_packet *previous;
};
bool