Readme and godoc strings

This commit is contained in:
elinor 2018-04-02 15:54:07 +03:00
parent 5745b2b2ae
commit 5429761d87
2 changed files with 13 additions and 2 deletions

View file

@ -108,6 +108,15 @@ for i := 0; i < n; i++ {
}
```
Note regarding Forward Error Correction (FEC):
> When a packet is considered "lost", `DecodeFEC` and `DecodeFECFloat32` methods
> can be called on the next packet in order to try and recover some of the lost
> data. The PCM needs to be exactly the duration of audio that is missing.
> `LastPacketDuration()` can be used on the decoder to get the length of the
> last packet.
> Note also that in order to use this feature the encoder needs to be configured
> with `SetInBandFEC(true)` and `SetPacketLossPerc(x)` options.
### Streams (and files)
To decode a .opus file (or .ogg with Opus data), or to decode a "Opus stream"

View file

@ -113,7 +113,8 @@ func (dec *Decoder) DecodeFloat32(data []byte, pcm []float32) (int, error) {
}
// DecodeFEC encoded Opus data into the supplied buffer with forward error
// correction. The supplied buffer will be entirely filled.
// correction. It is to be used on the packet directly following the lost one.
// The supplied buffer needs to be exactly the duration of audio that is missing
func (dec *Decoder) DecodeFEC(data []byte, pcm []int16) error {
if dec.p == nil {
return errDecUninitialized
@ -139,7 +140,8 @@ func (dec *Decoder) DecodeFEC(data []byte, pcm []int16) error {
}
// DecodeFECFloat32 encoded Opus data into the supplied buffer with forward error
// correction. The supplied buffer will be entirely filled.
// correction. It is to be used on the packet directly following the lost one.
// The supplied buffer needs to be exactly the duration of audio that is missing
func (dec *Decoder) DecodeFECFloat32(data []byte, pcm []float32) error {
if dec.p == nil {
return errDecUninitialized