capture: add end time for captures

Update the end time when we flush the buffer to disk. Also add
a way to either incrementally get the end time or rely on the
header when possible.
This commit is contained in:
Christian Hergert
2016-09-27 21:24:33 -07:00
parent 4953731dd7
commit 2197a0c02e
5 changed files with 65 additions and 3 deletions

View File

@ -50,6 +50,9 @@ test_reader_basic (void)
sp_capture_writer_flush (writer);
/* We should have an old header (without end time) */
g_assert_cmpint (0, ==, sp_capture_reader_get_end_time (reader));
for (i = 0; i < 100; i++)
{
SpCaptureFrameType type = -1;
@ -75,6 +78,11 @@ test_reader_basic (void)
g_assert_cmpstr (map->filename, ==, str);
}
/* Now that we have read a frame, we should start having updated
* end times with each incoming frame.
*/
g_assert_cmpint (0, !=, sp_capture_reader_get_end_time (reader));
for (i = 0; i < 100; i++)
{
r = sp_capture_writer_add_timestamp (writer, t, i, -1);