-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to turn on/off DTX mode? #204
Comments
Should totally be possible. We would need to create a patch to expose that
option.
…On Mon, May 11, 2020 at 12:08 PM Chapay ***@***.***> wrote:
Hey
In c/c++ i can turn on DTX by code below
opus_encoder_ctl(enc, OPUS_SET_DTX(enable ? 1 : 0));
and can skip data without voice
int32_t r = opus_encode(enc, data, static_cast<int>(len), buffer, 4096);if ( r<=0 ) {
//some error
} else if( r<=2 ) {
//https://stackoverflow.com/questions/39718307/how-to-use-opus-dtx-from-opensource-opus-demo-binary
/* When using Opus over a network, using a protocol such as RTP where the packets are timestamped, DTX may be enabled if you want to reduce the packets sent during periods where there is no voice activity. A packet would still be sent about every 400 ms, updating background noise. Using the packet timestamps the receiver can determine the duration of any gaps and fill them in with the background noise to keep it sounding natural. Enable DTX in the encoder using opus_encoder_ctl(enc, OPUS_SET_DTX(1)); , or with the -dtx option on opus_demo. Then, simply do not send any packets produced by the encoder with a length of 2 bytes or less. (These "DTX packets" are just zero-length frames, with a normal 1- or 2-byte packet header (TOC), and do not contain any audio data.) Packets with a length larger than 2 bytes should be sent as usual. The receiver should use normal packet loss concealment to handle missing packets, in the same manner as it would handle packet loss. In particular it can call opus_decode() with data = NULL, len = 0, and frame_size equal to the size of the missing frame(s), and the decoder will generate audio data to conceal the missing frame(s). */
} else {
//r contains size of encoded data
}
Can I do the same with JS? and how ;) ?
Sorry I`m newbie in JS
Thank you!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#204>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD3XA2YIJ2VLKWPKA5D6S3RRAPG7ANCNFSM4M6BJRPQ>
.
|
Great news! ))) Thank you! |
@chapayGhub Feel free to make a pull request to add this feature. If you need some pointers I will try to make some time to help you out. |
is this not possible to call already via exposed setOpusControl() function ? |
Hey
In c/c++ i can turn on DTX by code below
and can skip data without voice
Can I do the same with JS? and how ;) ?
Sorry I`m newbie in JS
Thank you!
The text was updated successfully, but these errors were encountered: