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 748390 - validate: media-descriptor: remove duplicate conditions
validate: media-descriptor: remove duplicate conditions
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-devtools
unspecified
Other Linux
: Normal normal
: 1.5.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-24 00:42 UTC by Vineeth
Modified: 2015-08-16 13:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
change duplicate conditions (1019 bytes, patch)
2015-04-24 00:43 UTC, Vineeth
none Details | Review
correct trivial spelling mistake (1.42 KB, patch)
2015-07-22 07:34 UTC, Vineeth
committed Details | Review
handle proper return values (2.03 KB, patch)
2015-07-22 07:35 UTC, Vineeth
none Details | Review
change duplicate conditions (1.00 KB, patch)
2015-07-22 07:36 UTC, Vineeth
committed Details | Review
handle proper return values (1.79 KB, patch)
2015-07-24 06:38 UTC, Vineeth
committed Details | Review

Description Vineeth 2015-04-24 00:42:59 UTC
when comparing tags, two conditions in if an else if are same
 the correct way is to first check if both are NULL and return.
 changed the condition accordingly.
Comment 1 Vineeth 2015-04-24 00:43:45 UTC
Created attachment 302270 [details] [review]
change duplicate conditions
Comment 2 Vineeth 2015-05-20 10:29:23 UTC
Can someone review this :)
Comment 3 Thibault Saunier 2015-05-20 11:37:23 UTC
Review of attachment 302270 [details] [review]:

You are changing the bahaviour here, we will just never get into the else if branch in that code, we might juste remove it? Don't know.
Comment 4 Vineeth 2015-05-20 11:45:23 UTC
Hi Thibault,
   As per my understanding
   with the present code, it will never enter else if


   But my change is
   if (!rtags && !ctags)
   so it will enter if condition, when rtags == NULL and ctags == NULL
   first else if condition is when rtags == NULL and ctags has value
   second else if condition is when rtags has value and ctags == NULL.

 

Regards,
Vineeth
Comment 5 Vineeth 2015-05-29 04:32:59 UTC
Hi Thibault,
   I just rechecked the code.
   The function is to compare the tags of two streams being passed as input.
   After my patch, when both tags are NULL it is just returning without doing any comparison.
   and the else if conditions are added only to print report mentioning about the presence of tag in one and not in another.
   The actual comparison happens only when both the tags are present which is present in the end of the function.

   Before my patch, when both rtags and ctags are NULL, then there is no condition to check it and exit. Hence the comparison logic will be called and this will result in crash.


Regards,
Vineeth
Comment 6 Vineeth 2015-06-11 05:50:09 UTC
ping :)
Comment 7 Vineeth 2015-07-22 07:34:30 UTC
Created attachment 307888 [details] [review]
correct trivial spelling mistake

To make more sense of the issue, the return values should be handled properly.
First things first, corrected a spelling mistake in function name.
Comment 8 Vineeth 2015-07-22 07:35:29 UTC
Created attachment 307889 [details] [review]
handle proper return values

This patch handles the return values being provided by compare_tags and returns accordingly.
Comment 9 Vineeth 2015-07-22 07:36:55 UTC
Created attachment 307890 [details] [review]
change duplicate conditions

With the handling of return values in the above patch, this will make more sense.
We can probably merge all of these together. But just to maintain history added as different patches.
Comment 10 Thibault Saunier 2015-07-23 09:56:49 UTC
Review of attachment 307888 [details] [review]:

OK
Comment 11 Thibault Saunier 2015-07-23 09:58:12 UTC
Review of attachment 307889 [details] [review]:

::: validate/gst/validate/media-descriptor.c
@@ -304,3 +304,3 @@
     }
 
-    compare_tags (ref, rstream, cstream);
+    return compare_tags (ref, rstream, cstream);

I think it was on purpose so that it does not fail for tags issue (but simply WARNS the user)
Comment 12 Thibault Saunier 2015-07-23 09:58:57 UTC
Review of attachment 307890 [details] [review]:

OK
Comment 13 Vineeth 2015-07-23 10:15:36 UTC
(In reply to Thibault Saunier from comment #11)
> Review of attachment 307889 [details] [review] [review]:
> 
> ::: validate/gst/validate/media-descriptor.c
> @@ -304,3 +304,3 @@
>      }
>  
> -    compare_tags (ref, rstream, cstream);
> +    return compare_tags (ref, rstream, cstream);
> 
> I think it was on purpose so that it does not fail for tags issue (but
> simply WARNS the user)

Yes i just now noticed the commit in which that change was made..
should we change the return type to void.. it doesn't matter actually..
Comment 14 Vineeth 2015-07-24 06:38:04 UTC
Created attachment 308052 [details] [review]
handle proper return values

compare_tags is not a fatal error. Hence not checking the return value.
Comment 15 Thibault Saunier 2015-07-24 07:53:24 UTC
Review of attachment 308052 [details] [review]:

ok
Comment 16 Nicolas Dufresne (ndufresne) 2015-07-30 19:52:27 UTC
Ok, we must wait before merging these. I simply run validate on top, and there is 25 failing tests now. We need to figure-out is these are valid but not visible failure, or if this is test regression. Vineeth, did you run the test afterward ?
Comment 17 Nicolas Dufresne (ndufresne) 2015-07-30 19:53:53 UTC
Marking them as need-work, so we get good explanation of why these regression are normal.
Comment 18 Nicolas Dufresne (ndufresne) 2015-07-30 20:25:03 UTC
Review of attachment 308052 [details] [review]:

I really wonder why we do media check if non of the test cause failure/regression ?

::: validate/tools/gst-validate-media-check.c
@@ +122,3 @@
+    if (!gst_media_descriptors_compare (GST_MEDIA_DESCRIPTOR (reference),
+            GST_MEDIA_DESCRIPTOR (writer))) {
+      ret = 1;

This is the only thing that can cause a test to fail now. It looks like stream ID are no longer the same as when the media info was first generated.
Comment 19 Nicolas Dufresne (ndufresne) 2015-07-30 20:53:57 UTC
OK, short story, stream-ID are not guarantied to be stable across sessions. For filesrc base IDs, the ID varies depending on the path the asset is loaded from. Making adding this strict comparison will always fail for someone. In fact, we should drop stream-id from the recorded media-info.
Comment 20 Nicolas Dufresne (ndufresne) 2015-07-31 13:34:51 UTC
Arguably, a stream-id change could indicate a regression, hence this check should remain. In bug 753079, I'm suggesting some solutions to reduce the amount of false positive warnings. In any case, we need to remove the code that makes it fail the media-check.
Comment 21 Nicolas Dufresne (ndufresne) 2015-07-31 22:40:42 UTC
commit e25a6aaf78eb592315f4cc990f1bee0494420241
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Fri Jul 31 10:49:00 2015 -0400

    validate: media-descriptor: Fix reading seekable record
    
    Casting the result of g_strmp0 to boolean won't make gboolean
    value 0 or 1. We need proper 0 and 1 so we can use == comparision.

commit 8d477c6d930c3a7251a7fbdac5879d643639bf76
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Fri Jul 24 15:36:27 2015 +0900

    validate: media-descriptor: handle proper return values
    
    while comparing the media descriptor with --expected-results, the return
    values are not being handled properly, which results in wrong comparision
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748390

commit bd5fb7be260dd8a38ae069c131fae48f688bb22a
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Thu Jul 30 15:14:13 2015 -0400

    validate: media-descriptor: Add comment before ignored return value
    
    As stated in the bug, this comparison failing is not a critical
    error, warning is enough. Add a comment so nobody thinks it's a
    coding error.
    
    https://bugzilla.gnome.org/review?bug=748390

commit 2a5ff3f3c8dbc0edd57c3d19a2963639a80b0056
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Wed Jul 22 16:32:06 2015 +0900

    validate: media-descriptor: remove duplicate conditions
    
    when comparing tags, two conditions in if an else if are same
    the correct way is to first check if both are NULL and return.
    changed the condition accordingly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748390

commit f020c41d41358af35da09ce5127c722df1d9845e
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Wed Jul 22 16:07:19 2015 +0900

    validate: media-descriptor: fix trivial spelling mistakes
    
    replace comparse_stream with compare_streams
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748390