void common_log_capture(CAPTURE_POINT_t log_point, struct snd_pcm_substream *substream_new) { struct snd_pcm_substream *substream; if (audio_log.audio_log_on <= 0) return; if (log_point == AUD_LOG_PCMOUT) { substream = &audio_log.substream_playback; if (mutex_lock_interruptible(&audio_log.playback_mutex)) return; } else { substream = &audio_log.substream_record; if (mutex_lock_interruptible(&audio_log.record_mutex)) return; } memcpy(substream, substream_new, sizeof(*substream)); if (log_point == AUD_LOG_PCMOUT) mutex_unlock(&audio_log.playback_mutex); else mutex_unlock(&audio_log.record_mutex); logmsg_ready(substream, log_point); }
void voip_log_capture(CAPTURE_POINT_t log_point, unsigned char *buf, int size) { struct snd_pcm_substream *substream; struct snd_pcm_runtime *runtime; if (voip_log.voip_log_on <= 0) return; if (log_point == AUD_LOG_VOCODER_UL) { substream = &voip_log.substream_ul; runtime = &voip_log.runtime_ul; if (mutex_lock_interruptible(&voip_log.voip_ul_mutex)) return; } else { substream = &voip_log.substream_dl; runtime = &voip_log.runtime_dl; if (mutex_lock_interruptible(&voip_log.voip_dl_mutex)) return; } runtime->rate = AUDIO_SAMPLING_RATE_16000; runtime->sample_bits = 16; runtime->channels = AUDIO_CHANNEL_MONO; runtime->dma_area = buf; runtime->dma_bytes = 2*size; substream->runtime = runtime; if (log_point == AUD_LOG_VOCODER_UL) mutex_unlock(&voip_log.voip_ul_mutex); else mutex_unlock(&voip_log.voip_dl_mutex); logmsg_ready(substream, log_point); }