Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
518386c9
Commit
518386c9
authored
Dec 04, 2019
by
Andrew Voznytsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Non-invasive media file offset adjusting
parent
0c53e2e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+16
-7
No files found.
src/VideoStreaming/VideoReceiver.cc
View file @
518386c9
...
...
@@ -854,13 +854,22 @@ VideoReceiver::_keyframeWatch(GstPad* pad, GstPadProbeInfo* info, gpointer user_
return
GST_PAD_PROBE_DROP
;
}
else
{
VideoReceiver
*
pThis
=
static_cast
<
VideoReceiver
*>
(
user_data
);
// reset the clock
GstClock
*
clock
=
gst_pipeline_get_clock
(
GST_PIPELINE
(
pThis
->
_pipeline
));
GstClockTime
time
=
gst_clock_get_time
(
clock
);
gst_object_unref
(
clock
);
gst_element_set_base_time
(
pThis
->
_pipeline
,
time
);
// offset pipeline timestamps to start at zero again
buf
->
dts
=
0
;
// The offset will not apply to this current buffer, our first frame, timestamp is zero
buf
->
pts
=
0
;
// set media file '0' offset to current timeline position - we don't want to touch other elements in the graph, except these which are downstream!
gint64
position
;
if
(
gst_element_query_position
(
pThis
->
_pipeline
,
GST_FORMAT_TIME
,
&
position
)
!=
TRUE
)
{
qCDebug
(
VideoReceiverLog
)
<<
"Unable to get timeline position, let's hope that downstream elements will survive"
;
if
(
buf
->
pts
!=
GST_CLOCK_TIME_NONE
)
{
position
=
buf
->
pts
;
}
else
{
position
=
gst_pad_get_offset
(
pad
);
}
}
gst_pad_set_offset
(
pad
,
position
);
// Add the filesink once we have a valid I-frame
gst_bin_add_many
(
GST_BIN
(
pThis
->
_pipeline
),
pThis
->
_sink
->
filesink
,
nullptr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment