Changeset d01e635 in mainline for uspace/app/dplay/dplay.c


Ignore:
Timestamp:
2012-07-12T18:29:02Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1df3018a
Parents:
1240bb9
Message:

dplay: Simplify playback stop.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/dplay/dplay.c

    r1240bb9 rd01e635  
    112112                const size_t bytes = fread(pb->buffer.position, sizeof(uint8_t),
    113113                   buffer_part, pb->source);
     114                if (bytes == 0) {
     115                        audio_pcm_stop_playback(pb->device, pb->buffer.id);
     116                }
    114117                bzero(pb->buffer.position + bytes, buffer_part - bytes);
    115118                pb->buffer.position += buffer_part;
     
    117120                if (pb->buffer.position >= (pb->buffer.base + pb->buffer.size))
    118121                        pb->buffer.position = pb->buffer.base;
    119                 if (bytes == 0) {
    120                         fibril_mutex_lock(&pb->mutex);
    121                         pb->playing = false;
    122                         fibril_condvar_signal(&pb->cv);
    123                         fibril_mutex_unlock(&pb->mutex);
    124                 }
    125122        }
    126123}
     
    152149            fibril_condvar_wait(&pb->cv, &pb->mutex));
    153150
    154         audio_pcm_stop_playback(pb->device, pb->buffer.id);
    155         for (pb->playing = true; pb->playing;
    156                 fibril_condvar_wait(&pb->cv, &pb->mutex));
    157151        fibril_mutex_unlock(&pb->mutex);
    158152        printf("\n");
Note: See TracChangeset for help on using the changeset viewer.