aacparse: Check aacparse seekable to byte, in the push mode
authorGilbok Lee <gilbok.lee@samsung.com>
Mon, 14 Sep 2020 06:09:33 +0000 (15:09 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Mon, 14 Sep 2020 07:10:45 +0000 (16:10 +0900)
Change-Id: If8f66f71b562b03c7faa412724f299c516c9106b

gst/audioparsers/gstaacparse.c
gst/audioparsers/gstaacparse.h
packaging/gst-plugins-good.spec

index 93a5e0b..6ec3a75 100644 (file)
@@ -122,6 +122,7 @@ static gboolean gst_aac_parse_adts_src_eventfunc (GstBaseParse * parse,
 int get_aac_parse_get_adts_frame_length (const unsigned char *data,
     gint64 offset);
 static gboolean gst_aac_parse_estimate_duration (GstBaseParse * parse);
+static void gst_aac_parse_check_byte_seekability (GstBaseParse * parse);
 #endif
 
 #define gst_aac_parse_parent_class parent_class
@@ -1422,6 +1423,7 @@ gst_aac_parse_handle_frame (GstBaseParse * parse,
         GST_WARNING_OBJECT (aacparse, "can not estimate total duration");
         ret = GST_FLOW_NOT_SUPPORTED;
       }
+      gst_aac_parse_check_byte_seekability (parse);
     }
 #endif
   } else if (aacparse->header_type == DSPAAC_HEADER_LOAS) {
@@ -2137,10 +2139,13 @@ gst_aac_parse_adts_src_eventfunc (GstBaseParse * parse, GstEvent * event)
         GstPad *srcpad = parse->srcpad;
         GST_INFO_OBJECT (aacparse, "aac parser is PUSH MODE.");
         /* check NULL */
-        ret = gst_aac_audio_parse_do_push_seek (parse, srcpad, event);
-        gst_object_unref (srcpad);
-        return ret;
+        if (aacparse->byte_seekable)
+          return gst_aac_audio_parse_do_push_seek (parse, srcpad, event);
+
+        GST_INFO_OBJECT (aacparse, "not support byte seek");
+        goto aac_seek_null_exit;
       }
+
       gst_base_parse_get_upstream_size (parse, &total_file_size);
       gst_base_parse_get_index_last_offset (parse, &start_offset);
       gst_base_parse_get_index_last_ts (parse, &current_ts);
@@ -2327,4 +2332,25 @@ aac_seek_null_exit:
   handled = GST_BASE_PARSE_CLASS (parent_class)->src_event (parse, event);
   return handled;
 }
+
+static void
+gst_aac_parse_check_byte_seekability (GstBaseParse * parse)
+{
+  GstQuery *query;
+  gboolean seekable = FALSE;
+  GstAacParse *aacparse = GST_AAC_PARSE (parse);
+  GST_LOG_OBJECT (aacparse, "gst_aac_parse_check_byte_seekability enter");
+
+  query = gst_query_new_seeking (GST_FORMAT_BYTES);
+  if (gst_pad_peer_query (parse->sinkpad, query))
+    gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
+  else
+    GST_DEBUG_OBJECT (aacparse, "seeking query failed");
+
+  gst_query_unref (query);
+
+  GST_INFO_OBJECT (aacparse, "byte seekable: %d", seekable);
+
+  aacparse->byte_seekable = seekable;
+}
 #endif /* TIZEN_FEATURE_AACPARSE_MODIFICATION */
index 1cde1f6..30ea6e5 100644 (file)
@@ -91,6 +91,7 @@ struct _GstAacParse {
   guint          read_bytes;
   gint64         file_size;
   guint          frame_byte;
+  gboolean       byte_seekable;
 #endif
 
   GstAacHeaderType header_type;
index fd50d7a..dd24215 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:           gst-plugins-good
 Version:        1.16.2
-Release:        9
+Release:        10
 License:        LGPL-2.1+
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 Url:            http://gstreamer.freedesktop.org/