]> Sergey Matveev's repositories - go-opus.git/commitdiff
Readme and godoc strings
authorelinor <elinor.alp@gmail.com>
Mon, 2 Apr 2018 12:54:07 +0000 (15:54 +0300)
committerelinor <elinor.alp@gmail.com>
Mon, 2 Apr 2018 12:54:07 +0000 (15:54 +0300)
README.md
decoder.go

index 152737d8e06b3583ad958c95dfe9b6964a1d0d0b..28a67f8ef504ef24367cb04b9c48fc9cdb4f0187 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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"
index fe888ac1e323cabb5da65575f5725115662fc5d7..a3760ce2421a0fb333ec8fc01e75df66142bef7e 100644 (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