Skip to content

Add input stream latency test#590

Merged
achronop merged 2 commits intomozilla:masterfrom
Koalab99:master
May 29, 2020
Merged

Add input stream latency test#590
achronop merged 2 commits intomozilla:masterfrom
Koalab99:master

Conversation

@Koalab99
Copy link
Copy Markdown
Contributor

It calls the stream ops and ask for input latency if the device
has type INPUT.

It calls the stream ops and ask for input latency if the output device
has type INPUT.
@padenot padenot requested a review from achronop May 28, 2020 17:17
@padenot
Copy link
Copy Markdown
Collaborator

padenot commented May 28, 2020

@achronop if you can have a look.

Copy link
Copy Markdown
Contributor

@achronop achronop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot Koalab99, I'll check them all together tomorrow morning.

Copy link
Copy Markdown
Contributor

@achronop achronop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thank you very much. I see something that does not work as expected and that's why I request changes. Other than that I have added a couple of reformatting changes. TBH half of them are not your fault. The problems pre-existed and it would be great if you would like to improve them since you are updating that part. They are small things.

Comment thread tools/cubeb-test.cpp Outdated
uint64_t pos = cl.get_stream_position();
uint64_t latency = cl.get_stream_latency();
fprintf(stderr, "stream position %" PRIu64 " (latency %" PRIu64 ")\n", pos, latency);
if(op->collection_device_type & CUBEB_DEVICE_TYPE_INPUT) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing the collection device type which is used for cubeb_register_device_collection_changed(). Here we need to check if the mic is open. This happens when the operation_data::play::mode is RECORD or DUBLEX so we need something like: op->pm == RECORD || op->pm == DUPLEX

Can you please go one step further and update the output case as well in a similar way. Right now the code assumes that we always have the output open which is not the case. This is not your fault but it would be great if you can update it since we are dealing with this part.

Comment thread tools/cubeb-test.cpp Outdated
fprintf(stderr, "stream position %" PRIu64 " (latency %" PRIu64 ")\n", pos, latency);
if(op->collection_device_type & CUBEB_DEVICE_TYPE_INPUT) {
latency = cl.get_input_stream_latency();
fprintf(stderr, "input stream latency %" PRIu64 ")\n", latency);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a parenthesis close ) but not a parenthesis open in the message.

That said can you please make it in an away that it will print in one line. Routhly something like:

get possition;
fprintf("position message"); // note no endl '\n'
if (DUBLEX || PLAYBACK)
  get output latency
  fprintf("output latency"); // again no endl 
if (DUBLEX || RECORD)
  get input latency
  fprintf("input latency"); // again no endl
fprinf("\n");

Comment thread tools/cubeb-test.cpp Outdated
void set_latency_frames(uint32_t latency_frames);
uint64_t get_stream_position() const;
uint32_t get_stream_latency() const;
uint32_t get_input_stream_latency() const;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change the get_input_stream_latency() to get_stream_input_latency.

Can you please also change the get_stream_latency() to get_stream_output_latency for clarity. This is a wrapper not cubeb itself so we can change the ABI without tears.

Comment thread tools/cubeb-test.cpp Outdated
@@ -439,6 +450,10 @@ bool choose_action(cubeb_client& cl, operation_data * op, int c) {
uint64_t pos = cl.get_stream_position();
uint64_t latency = cl.get_stream_latency();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_stream_*_latency() return uint32_t but we store it in a uint64_t. It's not your fault that code was there. Do you mind if you change it to use uint32_t and replace the format specifiers in the print messages?

@Koalab99
Copy link
Copy Markdown
Contributor Author

I think it fixed the issues, let me know if something is wrong with it

Copy link
Copy Markdown
Contributor

@achronop achronop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's perfect, thank you.

@achronop achronop merged commit d5b033d into mozilla:master May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants