diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-12 23:36:30 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-12 23:36:30 +0000 |
commit | f9b562623b7ff9b80749cb08fa9eedbec8832fe2 (patch) | |
tree | 568c175aa61122a44041bcdfddc2552c6aab92c3 | |
parent | d94bfac675d0ab17df7feb2955d918030335d5bf (diff) | |
parent | 86d4e9fe1d6b2f00a56fa1873f9ac046b221f13c (diff) | |
download | tinyalsa-f9b562623b7ff9b80749cb08fa9eedbec8832fe2.tar.gz |
Merge "Snap for 11566117 from 3c60c0ae7f1d223bb301d85f279981ca712a8caf to sdk-release" into sdk-releaseplatform-tools-35.0.1
-rw-r--r-- | include/tinyalsa/asoundlib.h | 3 | ||||
-rw-r--r-- | pcm.c | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index 063a256..c0f4746 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -290,6 +290,9 @@ int pcm_get_poll_fd(struct pcm *pcm); */ int pcm_set_avail_min(struct pcm *pcm, int avail_min); +/* Gets the count of underruns for playback and count of overruns for capture. */ +int pcm_get_xruns(struct pcm *pcm); + /* * MIXER API */ @@ -256,7 +256,7 @@ struct pcm { unsigned int flags; bool running:1; bool prepared:1; - int underruns; + int xruns; unsigned int buffer_size; unsigned long boundary; char error[PCM_ERROR_MAX]; @@ -561,7 +561,7 @@ int pcm_write(struct pcm *pcm, const void *data, unsigned int count) /* we failed to make our window -- try to restart if we are * allowed to do so. Otherwise, simply allow the EPIPE error to * propagate up to the app level */ - pcm->underruns++; + pcm->xruns++; if (pcm->flags & PCM_NORESTART) return -EPIPE; continue; @@ -595,7 +595,7 @@ int pcm_read(struct pcm *pcm, void *data, unsigned int count) pcm->running = false; if (errno == EPIPE) { /* we failed to make our window -- try to restart */ - pcm->underruns++; + pcm->xruns++; continue; } return oops(pcm, errno, "cannot read stream data"); @@ -1055,7 +1055,7 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, } #endif - pcm->underruns = 0; + pcm->xruns = 0; return pcm; fail: @@ -1382,3 +1382,7 @@ int pcm_ioctl(struct pcm *pcm, int request, ...) return pcm->ops->ioctl(pcm->data, request, arg); } + +int pcm_get_xruns(struct pcm *pcm) { + return pcm->xruns; +} |