summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-11-16 08:22:14 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-11-16 08:49:24 -0300
commit921816400bf3ad65f8978a50569a7d87ef05c806 (patch)
tree014616992fcaa0dfc5be988709f331d980a89046
parent288280fb0cea8ecf4f2b170f790b9c814925d017 (diff)
baseparse: simplify code a bit
Avoid repeated checks for testing if a buffer is a header
-rw-r--r--libs/gst/base/gstbaseparse.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index f8f4380010..f83c86d835 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -980,19 +980,21 @@ static GstFlowReturn
gst_base_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstBuffer *buffer = frame->buffer;
- gboolean is_header = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_HEADER);
- if (!GST_BUFFER_PTS_IS_VALID (buffer) && !is_header &&
- GST_CLOCK_TIME_IS_VALID (parse->priv->next_pts)) {
- GST_BUFFER_PTS (buffer) = parse->priv->next_pts;
- }
- if (!GST_BUFFER_DTS_IS_VALID (buffer) && !is_header &&
- GST_CLOCK_TIME_IS_VALID (parse->priv->next_dts)) {
- GST_BUFFER_DTS (buffer) = parse->priv->next_dts;
- }
- if (!GST_BUFFER_DURATION_IS_VALID (buffer) && !is_header &&
- GST_CLOCK_TIME_IS_VALID (parse->priv->frame_duration)) {
- GST_BUFFER_DURATION (buffer) = parse->priv->frame_duration;
+ /* Avoid updating timestamps of header buffers */
+ if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_HEADER)) {
+ if (!GST_BUFFER_PTS_IS_VALID (buffer) &&
+ GST_CLOCK_TIME_IS_VALID (parse->priv->next_pts)) {
+ GST_BUFFER_PTS (buffer) = parse->priv->next_pts;
+ }
+ if (!GST_BUFFER_DTS_IS_VALID (buffer) &&
+ GST_CLOCK_TIME_IS_VALID (parse->priv->next_dts)) {
+ GST_BUFFER_DTS (buffer) = parse->priv->next_dts;
+ }
+ if (!GST_BUFFER_DURATION_IS_VALID (buffer) &&
+ GST_CLOCK_TIME_IS_VALID (parse->priv->frame_duration)) {
+ GST_BUFFER_DURATION (buffer) = parse->priv->frame_duration;
+ }
}
return GST_FLOW_OK;
}