roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.06k stars 213 forks source link

add secure_random and change random to fast_random #340

Closed fusuiyi123 closed 4 years ago

fusuiyi123 commented 4 years ago

fixes https://github.com/roc-project/roc/issues/102

gavv commented 4 years ago

Hi,

Please target PRs to develop branch, as stated in CONTRIBUTING.md. Note that in develop branch random.h and random.cpp have changed.

how to add test for secure_random?

I think we can go without tests in this case. This function is trivial and yet hard to test.

is pthread and void random_init() still needed in secure_random?

Blindly copy-pasting code is not a good idea. If you read carefully what random_init() does, you'll see that it initializes a seed for nrand48(), which you don't use here.

I don't understand how to add ifdef from your comments

What exactly do you have troubles with? If you don't know how to use preprocessor, you should go to the C manual. If you don't know how to gather libuv version, you should go to the libuv manual.

I really appreciate any help (we need it), but if you ask for advice or a piece of code for every minor issue, this help will become pretty meaningless. On the other hand, feel free to ask anything specific to this project which you can't learn from widely available sources. Also, I'd recommend this read (as well as other Eric's reads; they're inspiring).

but after changed the version to 1.33.0 it compiles successfully.

Actually two build jobs failed:

rocproject/cross-aarch64-linux-gnu:gcc-7.4 https://travis-ci.org/github/roc-project/roc/jobs/668487440?utm_medium=notification&utm_source=github_status

rocproject/cross-aarch64-linux-android:api28 https://travis-ci.org/github/roc-project/roc/jobs/668487443?utm_medium=notification&utm_source=github_status

We should investigate why. Travis don't give enough details, so please try to reproduce them locally. See https://roc-project.github.io/roc/docs/development/continuous_integration.html#run-locally

Yeah, and thanks for taking the time on this project!

fusuiyi123 commented 4 years ago

thanks for your advice! I will make sure to follow the good question practice.