Commit c9386eb6 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Improve error reporting in CodecPayloadType.

parent 99a73027
...@@ -3,6 +3,7 @@ package group ...@@ -3,6 +3,7 @@ package group
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"io/fs" "io/fs"
"log" "log"
"net/url" "net/url"
...@@ -203,7 +204,8 @@ func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, erro ...@@ -203,7 +204,8 @@ func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, erro
case "2": case "2":
return 100, nil return 100, nil
default: default:
return 0, errors.New("unknown VP9 profile") return 0, fmt.Errorf("unknown VP9 profile %v", profile)
} }
case "video/av1": case "video/av1":
return 35, nil return 35, nil
...@@ -218,7 +220,9 @@ func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, erro ...@@ -218,7 +220,9 @@ func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, erro
case "42e0": case "42e0":
return 108, nil return 108, nil
default: default:
return 0, errors.New("unknown H.264 profile") return 0, fmt.Errorf(
"unknown H.264 profile %v", profile,
)
} }
case "audio/opus": case "audio/opus":
return 111, nil return 111, nil
...@@ -229,7 +233,7 @@ func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, erro ...@@ -229,7 +233,7 @@ func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, erro
case "audio/pcma": case "audio/pcma":
return 8, nil return 8, nil
default: default:
return 0, errors.New("unknown codec") return 0, fmt.Errorf("unknown codec %v", codec.MimeType)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment