|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -63,6 +63,8 @@ struct _HLSProgressBuffer
|
63 | 63 | gboolean is_eos;
|
64 | 64 |
|
65 | 65 | GstFlowReturn srcresult;
|
| 66 | + |
| 67 | + GstClockTime buffer_pts; |
66 | 68 | };
|
67 | 69 |
|
68 | 70 | struct _HLSProgressBufferClass
|
@@ -191,6 +193,8 @@ static void hls_progress_buffer_init(HLSProgressBuffer *element)
|
191 | 193 | element->is_eos = FALSE;
|
192 | 194 |
|
193 | 195 | element->srcresult = GST_FLOW_OK;
|
| 196 | + |
| 197 | + element->buffer_pts = GST_CLOCK_TIME_NONE; |
194 | 198 | }
|
195 | 199 |
|
196 | 200 | /**
|
@@ -419,6 +423,13 @@ static void hls_progress_buffer_loop(void *data)
|
419 | 423 | g_cond_signal(&element->del_cond);
|
420 | 424 | }
|
421 | 425 |
|
| 426 | + if (element->buffer_pts != GST_CLOCK_TIME_NONE) |
| 427 | + { |
| 428 | + GST_BUFFER_TIMESTAMP(buffer) = element->buffer_pts; |
| 429 | + GST_BUFFER_DTS(buffer) = element->buffer_pts; |
| 430 | + element->buffer_pts = GST_CLOCK_TIME_NONE; |
| 431 | + } |
| 432 | + |
422 | 433 | g_mutex_unlock(&element->lock);
|
423 | 434 |
|
424 | 435 | // Send the data to the hls progressbuffer source pad
|
@@ -494,11 +505,13 @@ static gboolean hls_progress_buffer_sink_event(GstPad *pad, GstObject *parent, G
|
494 | 505 | gst_segment_init (&new_segment, GST_FORMAT_TIME);
|
495 | 506 | new_segment.flags = segment.flags;
|
496 | 507 | new_segment.rate = segment.rate;
|
497 |
| - new_segment.start = 0; |
| 508 | + new_segment.start = segment.position; |
498 | 509 | new_segment.stop = -1;
|
499 | 510 | new_segment.position = segment.position;
|
500 | 511 | new_segment.time = segment.position;
|
501 | 512 |
|
| 513 | + element->buffer_pts = segment.position; |
| 514 | + |
502 | 515 | event = gst_event_new_segment (&new_segment);
|
503 | 516 | element->send_new_segment = FALSE;
|
504 | 517 | ret = gst_pad_push_event(element->srcpad, event);
|
|
0 commit comments