2b7682cdb3
- replace traditional for loop with range-based for loop for clarity
refactor(ffmpeg): simplify cut function loop
- utilize range-based for loop instead of traditional for loop
refactor(ring): update API response mapping type
- change map type from `interface{}` to `any` for better type safety
refactor(stream): handle nil source in NewStream
- add nil check for source elements before processing
refactor(webrtc): unify payload handling in GetToken
- change map type from `interface{}` to `any` for consistency
refactor(ascii): optimize nested loops in Write function
- replace traditional for loops with range-based for loops for readability
refactor(bits): enhance readability in Reader methods
- replace traditional for loops with range-based for loops in Read functions
refactor(h264): modernize loop structures in DecodeConfig
- switch to range-based for loops for cleaner code
refactor(h265): streamline profile_tier_level loops
- utilize range-based for loops instead of traditional for loops
chore(core): remove commented-out test function for clarity
refactor(core): simplify RandString function loop
- change traditional for loop to range-based for loop
refactor(flvt): optimize timestamp handling in TestTimeToRTP
- switch to range-based for loop for iterating frames
refactor(nest): improve error handling in ExchangeSDP
- format error message with printf-style formatting for clarity
refactor(tapo): enhance securityEncode function
- change traditional for loop to range-based for loop for readability
fix(tcp): correct masking in websocket Write method
- replace traditional for loop with range-based for loop
refactor(tutk): modernize encoding loops in crypto functions
- utilize range-based for loops for better readability
refactor(tuya): unify data types in MQTT message struct
- change map type from `interface{}` to `any` for consistency
refactor(webrtc): standardize codec registration
- change map type from `interface{}` to `any` for type safety
refactor(yaml): simplify Unmarshal function signature
- update parameter type from `interface{}` to `any` for better clarity
41 lines
824 B
Go
41 lines
824 B
Go
package v1
|
|
|
|
import (
|
|
"testing"
|
|
|
|
v2 "github.com/AlexxIT/go2rtc/pkg/pcm"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPCMUtoPCM(t *testing.T) {
|
|
for pcmu := range byte(255) {
|
|
pcm1 := MuLawDecompressTable[pcmu]
|
|
pcm2 := v2.PCMUtoPCM(pcmu)
|
|
require.Equal(t, pcm1, pcm2)
|
|
}
|
|
}
|
|
|
|
func TestPCMAtoPCM(t *testing.T) {
|
|
for pcma := range byte(255) {
|
|
pcm1 := ALawDecompressTable[pcma]
|
|
pcm2 := v2.PCMAtoPCM(pcma)
|
|
require.Equal(t, pcm1, pcm2)
|
|
}
|
|
}
|
|
|
|
func TestPCMtoPCMU(t *testing.T) {
|
|
for pcm := int16(-32768); pcm < 32767; pcm++ {
|
|
pcmu1 := LinearToMuLawSample(pcm)
|
|
pcmu2 := v2.PCMtoPCMU(pcm)
|
|
require.Equal(t, pcmu1, pcmu2)
|
|
}
|
|
}
|
|
|
|
func TestPCMtoPCMA(t *testing.T) {
|
|
for pcm := int16(-32768); pcm < 32767; pcm++ {
|
|
pcma1 := LinearToALawSample(pcm)
|
|
pcma2 := v2.PCMtoPCMA(pcm)
|
|
require.Equal(t, pcma1, pcma2)
|
|
}
|
|
}
|