Message224159
$ ./python -mtest -uaudio test_ossaudiodev
[1/1] test_ossaudiodev
test test_ossaudiodev failed -- Traceback (most recent call last):
File "./Lib/test/test_ossaudiodev.py", line 148, in test_playback
self.play_sound_file(*sound_info)
File "./Lib/test/test_ossaudiodev.py", line 89, in play_sound_file
(elapsed_time, expected_time))
AssertionError: False is not true : elapsed time (0.0590214729309082) > 10% off of expected time (3.5127309036445333)
1 test failed:
test_ossaudiodev
The failure is caused by dsp.write(data) that doesn't write all data
on my machine. If it is replaced with dsp.writeall(data) then the test
passes.
The docs [1] say that dsp.write() should write all data by default:
oss_audio_device.write(data)
Write the Python string data to the audio device and return the
number of bytes written. If the audio device is in blocking mode
(the default), the entire string is always written
[1] https://docs.python.org/3.4/library/ossaudiodev.html
The comments in Modules/ossaudiodev.c suggest that dsp.write(data) should
write *all* data unless dsp.nonblock() is called:
/* Open with O_NONBLOCK to avoid hanging on devices that only allow
one open at a time. This does *not* affect later I/O; OSS
provides a special ioctl() for non-blocking read/write, which is
exposed via oss_nonblock() below. */
fd = _Py_open(devicename, imode|O_NONBLOCK);
...
/* And (try to) put it back in blocking mode so we get the
expected write() semantics. */
if (fcntl(fd, F_SETFL, 0) == -1) {
close(fd);
PyErr_SetFromErrnoWithFilename(PyExc_IOError, devicename);
return NULL;
} |
|
Date |
User |
Action |
Args |
2014-07-28 10:29:20 | akira | set | recipients:
+ akira |
2014-07-28 10:29:20 | akira | set | messageid: <1406543360.46.0.562125681265.issue22094@psf.upfronthosting.co.za> |
2014-07-28 10:29:20 | akira | link | issue22094 messages |
2014-07-28 10:29:19 | akira | create | |
|