complete list of reasons

This commit is contained in:
Daniel Gultsch 2020-04-14 18:18:16 +02:00
parent dd42a6b850
commit bfb9a6267a
2 changed files with 32 additions and 13 deletions

View file

@ -120,11 +120,13 @@ public class RtpContentMap {
rtpDescription = (RtpDescription) description;
} else {
Log.d(Config.LOGTAG, "description was " + description);
//todo throw unsupported application
throw new IllegalArgumentException("Content does not contain RtpDescription");
}
if (transportInfo instanceof IceUdpTransportInfo) {
iceUdpTransportInfo = (IceUdpTransportInfo) transportInfo;
} else {
//TODO throw UNSUPPORTED_TRANSPORT exception
throw new IllegalArgumentException("Content does not contain ICE-UDP transport");
}
return new DescriptionTransport(rtpDescription, iceUdpTransportInfo);

View file

@ -5,19 +5,36 @@ import android.support.annotation.NonNull;
import com.google.common.base.CaseFormat;
public enum Reason {
SUCCESS, DECLINE, BUSY, CANCEL, CONNECTIVITY_ERROR, FAILED_TRANSPORT, FAILED_APPLICATION, TIMEOUT, UNKNOWN;
ALTERNATIVE_SESSION,
BUSY,
CANCEL,
CONNECTIVITY_ERROR,
DECLINE,
EXPIRED,
FAILED_APPLICATION,
FAILED_TRANSPORT,
GENERAL_ERROR,
GONE,
INCOMPATIBLE_PARAMETERS,
MEDIA_ERROR,
SECURITY_ERROR,
SUCCESS,
TIMEOUT,
UNSUPPORTED_APPLICATIONS,
UNSUPPORTED_TRANSPORTS,
UNKNOWN;
public static Reason of(final String value) {
try {
return Reason.valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, value));
} catch (Exception e) {
return UNKNOWN;
}
}
public static Reason of(final String value) {
try {
return Reason.valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, value));
} catch (Exception e) {
return UNKNOWN;
}
}
@Override
@NonNull
public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, super.toString());
}
@Override
@NonNull
public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, super.toString());
}
}