Add some statistics to pulseaudio plugin

This patch adds counters for packets and frames for debugging purposes.
This commit is contained in:
fryshorts
2014-05-19 21:24:30 +02:00
parent f3d9d248b6
commit ac4a054bdd

View File

@@ -25,18 +25,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
struct pulse_data {
obs_source_t source;
pa_stream *stream;
/* user settings */
bool ostime;
char *device;
/* server info */
enum speaker_layout speakers;
pa_sample_format_t format;
uint_fast32_t samples_per_sec;
uint_fast32_t bytes_per_frame;
uint_fast8_t channels;
uint_fast32_t bytes_per_frame;
pa_stream *stream;
bool ostime;
/* statistics */
uint_fast32_t packets;
uint_fast64_t frames;
};
static void pulse_stop_recording(struct pulse_data *data);
@@ -136,8 +140,10 @@ static void pulse_stream_read(pa_stream *p, size_t nbytes, void *userdata)
out.timestamp = pa_time - (pa_latency * 1000);
obs_source_output_audio(data->source, &out);
pa_stream_drop(data->stream);
data->packets++;
data->frames += out.frames;
pa_stream_drop(data->stream);
exit:
pulse_signal(0);
}
@@ -244,6 +250,9 @@ static void pulse_stop_recording(struct pulse_data *data)
blog(LOG_INFO, "pulse-input: Stopped recording from '%s'",
data->device);
blog(LOG_INFO, "pulse-input: Got %"PRIuFAST32
" packets with %"PRIuFAST64" frames",
data->packets, data->frames);
}
/**