summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChinyue Chen <chinyue@google.com>2017-04-18 15:03:31 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-05-03 03:31:29 -0700
commit5082f2462775c1e215d187496cc8fda3058ddd86 (patch)
tree9b0d3c191eaf16f28c00ef694f40697d525aa63b
parent8c14662b903b2cd16358ebdc060dce77a6fc98d7 (diff)
downloadadhd-5082f2462775c1e215d187496cc8fda3058ddd86.tar.gz
CRAS: test_client - Display stream type in audio thread info.
BUG=chromium:643039 TEST=Start playback and verify the stream type is displayed in cras_test_client --dump_a output. Change-Id: I4eb0d9835260a01fc7c07b56e19b41ffbbd61131 Reviewed-on: https://chromium-review.googlesource.com/479515 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org>
-rw-r--r--cras/src/common/cras_types.h17
-rw-r--r--cras/src/server/audio_thread.c1
-rw-r--r--cras/src/tests/cras_test_client.c2
3 files changed, 20 insertions, 0 deletions
diff --git a/cras/src/common/cras_types.h b/cras/src/common/cras_types.h
index b9dfc127..6c0ce0f0 100644
--- a/cras/src/common/cras_types.h
+++ b/cras/src/common/cras_types.h
@@ -112,6 +112,22 @@ enum CRAS_STREAM_TYPE {
CRAS_STREAM_NUM_TYPES,
};
+#define ENUM_STR(x) case x: return #x;
+
+static inline const char *cras_stream_type_str(
+ enum CRAS_STREAM_TYPE stream_type)
+{
+ switch(stream_type) {
+ ENUM_STR(CRAS_STREAM_TYPE_DEFAULT)
+ ENUM_STR(CRAS_STREAM_TYPE_MULTIMEDIA)
+ ENUM_STR(CRAS_STREAM_TYPE_VOICE_COMMUNICATION)
+ ENUM_STR(CRAS_STREAM_TYPE_SPEECH_RECOGNITION)
+ ENUM_STR(CRAS_STREAM_TYPE_PRO_AUDIO)
+ default:
+ return "INVALID_STREAM_TYPE";
+ }
+}
+
/* Information about a client attached to the server. */
struct __attribute__ ((__packed__)) cras_attached_client_info {
uint32_t id;
@@ -224,6 +240,7 @@ struct __attribute__ ((__packed__)) audio_stream_debug_info {
uint64_t stream_id;
uint32_t dev_idx;
uint32_t direction;
+ uint32_t stream_type;
uint32_t buffer_frames;
uint32_t cb_threshold;
uint32_t flags;
diff --git a/cras/src/server/audio_thread.c b/cras/src/server/audio_thread.c
index 84d9cc68..8b349146 100644
--- a/cras/src/server/audio_thread.c
+++ b/cras/src/server/audio_thread.c
@@ -802,6 +802,7 @@ static void append_stream_dump_info(struct audio_debug_info *info,
si->stream_id = stream->stream->stream_id;
si->dev_idx = dev_idx;
si->direction = stream->stream->direction;
+ si->stream_type = stream->stream->stream_type;
si->buffer_frames = stream->stream->buffer_frames;
si->cb_threshold = stream->stream->cb_threshold;
si->frame_rate = stream->stream->format.frame_rate;
diff --git a/cras/src/tests/cras_test_client.c b/cras/src/tests/cras_test_client.c
index 5e26b1af..6db3e116 100644
--- a/cras/src/tests/cras_test_client.c
+++ b/cras/src/tests/cras_test_client.c
@@ -597,6 +597,8 @@ static void audio_debug_info(struct cras_client *client)
printf("direction: %s\n",
(info->streams[i].direction == CRAS_STREAM_INPUT)
? "Input" : "Output");
+ printf("stream_type: %s\n",
+ cras_stream_type_str(info->streams[i].stream_type));
printf("buffer_frames: %u\n"
"cb_threshold: %u\n"
"frame_rate: %u\n"