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 738292 - directsoundsrc: hRes unckecked, which may cause a endless loop
directsoundsrc: hRes unckecked, which may cause a endless loop
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal normal
: 1.6.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-10 11:50 UTC by Yongjian Xu
Modified: 2015-12-11 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A patch for the bug (1.00 KB, patch)
2014-10-10 11:51 UTC, Yongjian Xu
needs-work Details | Review
fix Bug 738292 - directsoundsrc: hRes unckecked, which may cause a endless loop (1.83 KB, patch)
2015-12-11 10:42 UTC, Thomas Roos
committed Details | Review

Description Yongjian Xu 2014-10-10 11:50:24 UTC
In gst_directsound_src_read, line 533 and line 547, hRes not checked.
When recording with a usb recorder, it may come to a endless loop if the recorder is plugged out.
Comment 1 Yongjian Xu 2014-10-10 11:51:20 UTC
Created attachment 288213 [details] [review]
A patch for the bug

Add the check of hRes
Comment 2 Sebastian Dröge (slomo) 2014-10-14 08:22:07 UTC
Review of attachment 288213 [details] [review]:

::: gstdirectsoundsrc.c
@@ +536,2 @@
   /* Starting capturing if not already */
+  if (SUCCEEDED (hRes) && !(dwStatus & DSCBSTATUS_CAPTURING)) {

I think if not succeeded it should return here already instead of going into the loop below
Comment 3 Tim-Philipp Müller 2014-12-13 11:58:16 UTC
Yongjian Xu, do you agree with Sebastian's suggestion? If yes, could you update the patch accordingly and test it to make sure that fixes your issue as well?
Comment 4 Thomas Roos 2015-12-04 07:35:04 UTC
I would like to fix all the Error Handling Bugs in directsoundsrc and directsoundsink. Same here: https://bugzilla.gnome.org/show_bug.cgi?id=734098
I think Sebastian is right - the check should be before the loop what about that:
if (FAILED (hRes))
    {
        GST_DSOUND_UNLOCK (dsoundsrc);
        return -1;        
    }
Comment 5 Sebastian Dröge (slomo) 2015-12-04 08:00:52 UTC
Thomas, feel free to take up those patches and get them ready for merging. That would be great :)
Comment 6 Thomas Roos 2015-12-11 10:42:25 UTC
Created attachment 317196 [details] [review]
fix Bug 738292 - directsoundsrc: hRes unckecked, which may cause a endless loop

there you are
Comment 7 Sebastian Dröge (slomo) 2015-12-11 10:47:49 UTC
commit d794908dfdb726a2156512a495044a3941cad1a9
Author: Thomas Roos <thomas.roos@industronic.de>
Date:   Fri Dec 11 11:39:08 2015 +0100

    directsoundsrc: Check return values of DirectSound functions in read loop
    
    Otherwise we might end up in an infinite loop because of errors.
    
    Also take the element's mutex in unprepare().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738292