Bug 122524

Summary: kio_audiocd status update affects audio CD playback
Product: [Unmaintained] kdemultimedia Reporter: Ingo van Lil <inguin>
Component: generalAssignee: Multimedia Developers <kde-multimedia>
Status: RESOLVED NOT A BUG    
Severity: normal CC: finex, sitter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ingo van Lil 2006-02-23 00:01:41 UTC
Version:            (using KDE KDE 3.5.1DevelKDE 3.4.3)
Installed from:    Compiled From SourcesCompiled From SourcesGentoo Packages
Compiler:          gcc 3.3.6 
OS:                Linux

I noticed a pretty annoying bug when the KDE desktop device icons are enabled: Whenever I mount or unmount anything (no matter wheter I use the desktop icon or just enter the mount command in a terminal) while playing back an audio CD (which I do most of the time) the CD playback immediately skips to another track or even stops. I'm not using digital audio playback, I'm just sending a play command to the drive and let it do all the work.

I placed serveral debug messages into the kernel cdrom driver and did a lot of source code digging and I'm pretty sure I found the reason for this unusual behaviour: The kio_audiocd slaves calls cdda_open() from the cdparanoia library on any CD drive that contains an audio CD. cdda_open() reads several parameters for the given device and finally performs a single digital audio read (CDROMREADAUDIO ioctl in Linux) to make sure it can successfully use the device. Unfortunately this read operation causes rather unpleasant effect if the drive is already busy playing an audio CD.

I really wonder why nobody seems to have complained about this problem by now. Has everybody switched to digital playback already?
Comment 1 MO 2007-09-12 10:06:40 UTC
I think I have additional information for this extremely annoying bug.  

The KDE manual for configuring this program (  http://docs.kde.org/development/en/kdemultimedia/kscd/kscd-options-tab.html ) states that the device that /dev/cdrom points to must NOT have write permissions.  I took write permissions off of /dev/scd0, but left them on for /dev/sg0, and kscd no longer stops.

Funny, no other CD player programs have this issue. 

MO


Comment 2 Tobias 2008-05-15 23:26:12 UTC
I still have an (maybe the same) problem.
Symptoms: 
1. kscd/cdplay stops playing not using digital playback
2. kscd has skips (~100ms) using digital playback
3. beside the source code, it is very hard to find documentation about kio_audiocd. Is there any?

Problem:
* It seems kio_audiocd is gathering information from the optical drive.
* kscd stops playing, at the same time kio_audiocd disappears automatically from the process list. Thus kio_audiocd seems to stop the playback when it quits itself.

Background:
* Kubuntu, happened in all releases since I installed it, from 5.10 (breezy badger) to 8.04 (hardy heron, KDE3)
* The non-digital playback also stops using cdplay from the cdtools package, so kscd is not the problem.
* The digital playback on amarok works. 
* I surveilled access to /dev/scd0 using lsof:
* I can view kio_audiocd at work, if I start another kdeinit in a console.
* On cdclose, kio_audiocd does:
kdecore (KLibLoader): WARNING: KLibrary: /usr/lib/kde3/libaudiocd_encoder_flac.so: undefined symbol: create_audiocd_encoders
Checking /dev/scd0 for cdrom...
        Testing /dev/scd0 for SCSI/MMC interface
                SG_IO device: /dev/scd0

CDROM model sensed sensed: _NEC DVD_RW ND-3520AW 3.07

Checking for SCSI emulation...
        Drive is ATAPI (using SG_IO host adaptor emulation)

Checking for MMC style command set...
kdecore (KLibLoader): WARNING: KLibrary: /usr/lib/kde3/libaudiocd_encoder_flac.so: undefined symbol: create_audiocd_encoders
        Drive is MMC style
        DMA scatter/gather table entries: 1
        table entry size: 131072 bytes
        maximum theoretical transfer: 55 sectors
        Setting default read size to 13 sectors (30576 bytes).

Verifying CDDA command set...
Checking /dev/scd0 for cdrom...
        Testing /dev/scd0 for SCSI/MMC interface
<...>

Does not help:
* setting /dev/scd0 from 660 to 440 

Helps:
* Under control center service administration I can disable the KDE(d?) service mediaadministration (which surveils media:/ mount/umount etc.) then the symptoms are completely gone. Also no kio_audiocds are spawned (Thus it makes sense to say kio_audiocd is the evil).
* Above does not help the skipping in the digital playback. Thus kscd seems to be the evil with digital playback.

If there is anything one can do, can you please help me, e.g.
* How to disable kio_audiocd completely and not disabling the whole media:/ handling...
* How to configure behaviour of kio_audiocd (systemwide)?

Grateful for any response, 
marvin
Comment 3 Michel Briand 2008-06-10 00:53:07 UTC
I can confirm this on Debian Lenny.

kscd 4:3.5.9-1
kdemultimedia-kio-plugins 4:3.5.9-1

Comment 4 Michel Briand 2008-06-11 12:10:53 UTC
I modified the code to see if I can help...

--- kdemultimedia-3.5.9.orig/kioslave/audiocd/audiocd.cpp
+++ kdemultimedia-3.5.9/kioslave/audiocd/audiocd.cpp
@@ -762,13 +762,13 @@
                return 0;
        }
 
-       if (0 != cdda_open(drive))
-       {
-               kdDebug(7117) << "cdda_open failed" << endl;
-               error(KIO::ERR_CANNOT_OPEN_FOR_READING, d->device);
-               cdda_close(drive);
-               return 0;
-       }
+//     if (0 != cdda_open(drive))
+//     {
+//             kdDebug(7117) << "cdda_open failed" << endl;
+//             error(KIO::ERR_CANNOT_OPEN_FOR_READING, d->device);
+//             cdda_close(drive);
+//             return 0;
+//     }
 
        return drive;
 }

And I installed the new kio_audiocd.so in /usr/lib/kde3.

The behavior is different, but similar.
/dev/cdrom is accessed (open/close) and the music playing stops !
I tested like this :
- start playing with kscd 
- verify that there is no kio_audiocd.so running
- verify /dev/cdrom with lsof: only kscd currently open it
- lauch konqueror and go to "storage...", press "refresh"...

Before my modif, openning konqueror would have stop immediately the CD.
With my new kio_audiocd.so, the playing don't stops when "storage" is openned.
It takes a little time to display the list of storage devices... Pressing "refresh" multiple times finaly display all devices and stops the CD.

[11/Jun/2008 12:07:38] * Command: lsof /dev/cdrom|sed -e 1d
kscd       6359 michel   10r   BLK   3,64      2148 /dev/hdb
kio_audio 19946 michel   11u   BLK   3,64      2148 /dev/hdb
kio_audio 19946 michel   12u   BLK   3,64      2148 /dev/hdb
kio_audio 19946 michel   13r   BLK   3,64      2148 /dev/hdb

Another time, the CD don't stop after multiple refresh presses but after 3 min of playing...

Comment 5 FiNeX 2008-12-26 18:15:12 UTC
Is this a valid issue using KDE 3.5.10?
Comment 6 Harald Sitter 2011-08-14 22:12:16 UTC
Closing due to lack of feedback.