Changeset 7364c6ee in mainline


Ignore:
Timestamp:
2012-07-05T22:16:06Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d5244f
Parents:
4bbfb93
Message:

libdrv,audio: Fix sending of shared memory flags.

Fix calling buffer release in error paths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_audio_pcm_buffer.c

    r4bbfb93 r7364c6ee  
    9494        if (ret == EOK) {
    9595                void *dst = NULL;
    96                 // FIXME Do we need to know the flags?
    9796                int ret = async_share_in_start_0_0(exch, buffer_size, &dst);
    9897                if (ret != EOK) {
     
    238237        size_t share_size = 0;
    239238        ipc_callid_t share_id = 0;
    240         ddf_msg(LVL_DEBUG2, "Calling share receive.");
     239
     240        ddf_msg(LVL_DEBUG2, "Receiving share request.");
    241241        if (!async_share_in_receive(&share_id, &share_size)) {
    242242                ddf_msg(LVL_DEBUG, "Failed to share pcm buffer.");
    243                 if (pcm_iface->release_buffer)
    244                         pcm_iface->release_buffer(fun, id);
     243                pcm_iface->release_buffer(fun, id);
    245244                async_answer_0(share_id, EPARTY);
    246245                return;
    247246        }
    248         ddf_msg(LVL_DEBUG2, "Checking requested share size");
     247
     248        ddf_msg(LVL_DEBUG2, "Checking requested share size.");
    249249        if (share_size != size) {
    250250                ddf_msg(LVL_DEBUG, "Incorrect pcm buffer size requested.");
    251                 if (pcm_iface->release_buffer)
    252                         pcm_iface->release_buffer(fun, id);
     251                pcm_iface->release_buffer(fun, id);
    253252                async_answer_0(share_id, ELIMIT);
    254253                return;
    255254        }
    256         ddf_msg(LVL_DEBUG2, "Calling share finalize");
    257         ret = async_share_in_finalize(share_id, buffer, 0);
     255
     256        ddf_msg(LVL_DEBUG2, "Calling share finalize.");
     257        ret = async_share_in_finalize(share_id, buffer, AS_AREA_WRITE
     258        | AS_AREA_READ);
    258259        if (ret != EOK) {
    259                 ddf_msg(LVL_DEBUG, "Failed to share buffer");
    260                 if (pcm_iface->release_buffer)
    261                         pcm_iface->release_buffer(fun, id);
    262                 return;
    263 
    264         }
     260                ddf_msg(LVL_DEBUG, "Failed to share buffer.");
     261                pcm_iface->release_buffer(fun, id);
     262                return;
     263        }
     264
    265265        ddf_msg(LVL_DEBUG2, "Buffer shared with size %zu, creating callback.",
    266266            share_size);
     
    280280                        ddf_msg(LVL_DEBUG, "Failed to set event callback.");
    281281                        pcm_iface->release_buffer(fun, id);
    282                 }
    283                 async_answer_0(callid, ret);
     282                        async_answer_0(callid, ret);
     283                        return;
     284                }
     285                ddf_msg(LVL_DEBUG2, "Buffer and event session setup OK.");
     286                async_answer_0(callid, EOK);
    284287        }
    285288}
Note: See TracChangeset for help on using the changeset viewer.