DVD insert notification more then 3 times (1 Viewer)

josch.hh

MP Donator
  • Premium Supporter
  • March 29, 2008
    476
    77
    Hamburg
    Home Country
    Germany Germany
    TV-Server Version: 1.0
    MediaPortal Version: 1.0
    MediaPortal Skin: Xface
    Windows Version: Vista 32bit SP1
    CPU Type: AMD Athlon 4850e
    HDD: Samsung SpinPoint M5S HM160HI
    Memory: 4GB DDR2-800
    Motherboard: Asus M3N78-EM
    Video Card: Nvidia 9500GT
    Video Card Driver: 182
    Sound Card: Onboard Realtek ALC1200
    Sound Card AC3: optical out
    Sound Card Driver: 2.13
    1. TV Card: Technotrendt S2-3200
    1. TV Card Type: DVB-S
    1. TV Card Driver: 5.0.1.8
    2. TV Card:
    2. TV Card Type:
    2. TV Card Driver:
    3. TV Card:
    3. TV Card Type:
    3. TV Card Driver:
    4. TV Card:
    4. TV Card Type:
    4. TV Card Driver:
    MPEG2 Video Codec: PowerDVD Ultra 7.3
    MPEG2 Audio Codec: AC3-Filter 1.51
    h.264 Video Codec: PowerDVD Ultra 7.3
    Satelite/CableTV Provider: Astra 19.2°E
    HTPC Case: Silverstone GD02
    Cooling: Silverstone
    Power Supply: Sesonic S12II-330
    Remote: MCE Remote
    TV: Philips Aurea 42PFL9903H/10
    TV - HTPC Connection: Hdmi



    The insert notification for DVD's comes up more the 3 times when inserting a dvd. Even if i press the "yes" button to play the disk it comes up several times (when the disk is already playing).

    Any ideas?
     

    tyrann

    MP Donator
  • Premium Supporter
  • February 16, 2006
    14
    0
    44
    Stockholm, Sweden
    Home Country
    Sweden Sweden
    MediaPortal Version: 1.0.1
    MediaPortal Skin: Blue3 Wide
    Windows Version: XP SP3
    CPU Type: AMD X2 BE-2350
    HDD: Samsung 60GB 2.5"
    Memory: 2GB DDR2
    Motherboard: Gigabyte GA-MA69GM-S2H
    Video Card: Asus GF 8600 GT
    Video Card Driver: 182.08
    Sound Card: Realtek ALC883
    Sound Card AC3: optical out
    Sound Card Driver: 5.10.0.5449
    1. TV Card: Floppy DTV
    1. TV Card Type: DVB-C
    1. TV Card Driver: 4.8.0
    MPEG2 Video Codec: CyberLink Video/SP Decoder (PDVD7)
    MPEG2 Audio Codec: MPA
    h.264 Video Codec: CyberLink H.264/AVC Decoder (PDVD7.x)
    Satelite/CableTV Provider: ComHem
    TV - HTPC Connection: VGA to 22". DVI to projector.

    I can confirm this also for audio CDs. Wanting to import a pile of CDs I noticed this.

    This is what happens: First time I insert a CD I get notified once. I imported the CD. Then inserted a second one and I got notified twice. Loading the third CD I was notified five times, and the fourth time i was asked eight times. See MediaPortal.log attached to this post, it's all there.

    EDIT: Perhaps I should mention that the exact same thing happens if I don't import the CDs, i.e. if I only insert CD, answer notification, eject and insert a new one, and so on.
     

    herluf

    Portal Member
    March 19, 2009
    6
    2
    Home Country
    Denmark Denmark
    Hi - I have been looking at this, since i usually play my music from cd's. The first time a cd is inserted everything plays well, but the next time a cd is inserted it seems a new deviceVolumeMonitor is created and the old one is still listening, so there are now two monitors receiving the "insert" event. The 3rd time a cd is inserted two more monitors are created and so 4 monitors now receive the "insert" event, and so on...

    The only thing changed as far as i can tell is the following in the Dispose method of DeviceVolumeMonitor.cs:

    // handle should not be released as this is the handle for MediaPortal itself (just borrowing
    // it for wndproc message purposes). Just nulling the reference and letting the garbage collector
    // clean up is enough to free resources for device monitoring.
    //fInternal.ReleaseHandle();

    Instead fInternal is just set = null. As mentioned the garbage collector should remove the monitor, but it seems this doesn't happen.

    I tried setting DeviceMonitor.Enabled = false; instead of calling dispose from Autoplay.cs and that works (at least for cd's haven't tried dvd's). Enabled = false, calls the releaseHandle by the way.

    I'm not sure if the correct solution would be to set Enabled = false in the Dispose method just before setting the fInternal = null, but this is just a heads up to anyone willing to correct this or knows how to submit a patch.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    There are two different issues:

    #1 device monitor instances aren't cleaned properly

    Code:
    StopListeningForEvents()
    
    should have
    
            _deviceMonitor.OnVolumeInserted -= new DeviceVolumeAction(VolumeInserted);
            _deviceMonitor.OnVolumeRemoved -= new DeviceVolumeAction(VolumeRemoved);

    #2 DeviceVolumeMonitor objects aren't disposed (GC won't remove those when the handle is not released by fInternal.ReleaseHandle();

    1st one is easy to fix (this will slow down the system resource leaking as it will not leak the resources in power of two...) but the 2nd one is nasty as the previos fix was done to cure some bug with music visualization and Moving Pictures plugin (if I remember correctly).

    DeviceMonitor.Enabled = false; is doing the same as the commented code i.e. releasing the handle.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    after reading the NativeWindow.AssignHandle Method (System.Windows.Forms) to me looks like the comment in Dispose() is not correct.

    // handle should not be released as this is the handle for MediaPortal itself (just borrowing
    // it for wndproc message purposes). Just nulling the reference and letting the garbage collector
    // clean up is enough to free resources for device monitoring.
     

    Users who are viewing this thread

    Top Bottom