Commit 49b01043 authored by David Reid's avatar David Reid

OSS: Fix a bug when starting a playback device.

parent 375cdd68
...@@ -6475,12 +6475,9 @@ static mal_result mal_device__start_backend__oss(mal_device* pDevice) ...@@ -6475,12 +6475,9 @@ static mal_result mal_device__start_backend__oss(mal_device* pDevice)
// call to read(). // call to read().
if (pDevice->type == mal_device_type_playback) { if (pDevice->type == mal_device_type_playback) {
// Playback. // Playback.
mal_uint32 samplesRead = mal_device__read_frames_from_client(pDevice, pDevice->oss.fragmentSizeInFrames, pDevice->oss.pIntermediaryBuffer); mal_device__read_frames_from_client(pDevice, pDevice->oss.fragmentSizeInFrames, pDevice->oss.pIntermediaryBuffer);
if (samplesRead == 0) {
return mal_post_error(pDevice, "[OSS] Failed to read initial chunk of data from the client.", MAL_FAILED_TO_READ_DATA_FROM_CLIENT);
}
int bytesWritten = write(pDevice->oss.fd, pDevice->oss.pIntermediaryBuffer, samplesRead * mal_get_sample_size_in_bytes(pDevice->internalFormat)); int bytesWritten = write(pDevice->oss.fd, pDevice->oss.pIntermediaryBuffer, pDevice->oss.fragmentSizeInFrames * pDevice->internalChannels * mal_get_sample_size_in_bytes(pDevice->internalFormat));
if (bytesWritten == -1) { if (bytesWritten == -1) {
return mal_post_error(pDevice, "[OSS] Failed to send initial chunk of data to the device.", MAL_FAILED_TO_SEND_DATA_TO_DEVICE); return mal_post_error(pDevice, "[OSS] Failed to send initial chunk of data to the device.", MAL_FAILED_TO_SEND_DATA_TO_DEVICE);
} }
...@@ -10246,6 +10243,7 @@ void mal_pcm_f32_to_s32(int* pOut, const float* pIn, unsigned int count) ...@@ -10246,6 +10243,7 @@ void mal_pcm_f32_to_s32(int* pOut, const float* pIn, unsigned int count)
// - ALSA: Add support for excluding the "null" device using the alsa.excludeNullDevice context config variable. // - ALSA: Add support for excluding the "null" device using the alsa.excludeNullDevice context config variable.
// - ALSA: Fix a bug with channel mapping which causes an assertion to fail. // - ALSA: Fix a bug with channel mapping which causes an assertion to fail.
// - Fix errors with enumeration when pInfo is set to NULL. // - Fix errors with enumeration when pInfo is set to NULL.
// - OSS: Fix a bug when starting a device when the client sends 0 samples for the initial buffer fill.
// //
// v0.4 - 2017-11-05 // v0.4 - 2017-11-05
// - API CHANGE: The log callback is now per-context rather than per-device and as is thus now passed to // - API CHANGE: The log callback is now per-context rather than per-device and as is thus now passed to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment