After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722705 - Factor out common init/reset code from matroska parse/demux
Factor out common init/reset code from matroska parse/demux
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal enhancement
: 1.3.1
Assigned To: Reynaldo H. Verdejo Pinochet
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-21 15:37 UTC by Reynaldo H. Verdejo Pinochet
Modified: 2014-02-11 20:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
factor out common demux/parse read-context setup/reset code (18.22 KB, patch)
2014-01-21 15:40 UTC, Reynaldo H. Verdejo Pinochet
needs-work Details | Review
factor out common demux/parse read-context setup/reset code (18.18 KB, patch)
2014-01-30 22:40 UTC, Reynaldo H. Verdejo Pinochet
committed Details | Review

Description Reynaldo H. Verdejo Pinochet 2014-01-21 15:37:08 UTC
While working on #722311 I noticed a fairly sized
amount of repeated utility read-context init/reset
code on these two elements. Attached patch factors
out the duplication shoving some 100 LOCs off the
two elements (combined).
Comment 1 Reynaldo H. Verdejo Pinochet 2014-01-21 15:40:19 UTC
Created attachment 266890 [details] [review]
factor out common demux/parse read-context setup/reset code
Comment 2 Sebastian Dröge (slomo) 2014-01-22 09:05:48 UTC
Review of attachment 266890 [details] [review]:

::: gst/matroska/matroska-demux.c
@@ +190,3 @@
   GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (object);
 
+  gst_matroska_read_common_finalize_ctx (&demux->common);

It's called GstMatroskaReadCommon, not GstMatroskaReadCommonCtx

@@ -197,3 @@
-  if (demux->common.global_tags) {
-    gst_tag_list_unref (demux->common.global_tags);
-    demux->common.global_tags = NULL;

I think the tags and the ptr array should be emptied in reset() already but that's not a bug in your patch

::: gst/matroska/matroska-read-common.c
@@ +2859,3 @@
+
+void
+gst_matroska_read_common_reset_ctx (GstElement * element,

I assume you made sure you copied everything over from the other two reset functions here? At least the index stuff is missing, but that can and should disappear anyway.
Comment 3 Reynaldo H. Verdejo Pinochet 2014-01-30 22:38:59 UTC
(In reply to comment #2)
> Review of attachment 266890 [details] [review]:
> 
> ::: gst/matroska/matroska-demux.c
> @@ +190,3 @@
>    GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (object);
> 
> +  gst_matroska_read_common_finalize_ctx (&demux->common);
> 
> It's called GstMatroskaReadCommon, not GstMatroskaReadCommonCtx

Yeah, figured out _ctx made more sense for these funcs but
renamed them in the latest patch.

> [...]
> ::: gst/matroska/matroska-read-common.c
> @@ +2859,3 @@
> +
> +void
> +gst_matroska_read_common_reset_ctx (GstElement * element,
> 
> I assume you made sure you copied everything over from the other two reset
> functions here? At least the index stuff is missing, but that can and should
> disappear anyway.

You mean the element_index stuff? That code was disabled
already so I just dropped it. As per the rest as far as
I can see everything is there in place.

Thanks for your review.
Comment 4 Reynaldo H. Verdejo Pinochet 2014-01-30 22:40:48 UTC
Created attachment 267679 [details] [review]
factor out common demux/parse read-context setup/reset code

Updated patch with the functions renamed (dropped the _ctx postfix).
Comment 5 Sebastian Dröge (slomo) 2014-02-04 12:35:19 UTC
Review of attachment 267679 [details] [review]:

Looks good but:

::: gst/matroska/matroska-read-common.c
@@ +2852,3 @@
+  if (ctx->global_tags) {
+    gst_tag_list_unref (ctx->global_tags);
+    ctx->global_tags = NULL;

Move this to reset() in a second commit
Comment 6 Reynaldo H. Verdejo Pinochet 2014-02-07 15:15:25 UTC
As reset() is creating a new list after unrefing,
unless I'm missing something, I don't see a way
to easily move that section around. Can you elaborate\
please?

Thanks a lot for your review. Patch has been committed
now and I'm closing this once we clear the above out.
Comment 7 Sebastian Dröge (slomo) 2014-02-11 19:37:30 UTC
Nevermind, it's all good :)
Comment 8 Reynaldo H. Verdejo Pinochet 2014-02-11 20:53:40 UTC
Cool, thanks for taking a look.