use of com.aliyun.oss.model.LiveChannelStat.AudioStat in project aliyun-oss-java-sdk by aliyun.
the class ResponseParsers method parseGetLiveChannelStat.
/**
* Unmarshall get live channel stat response body to corresponding result.
*/
public static LiveChannelStat parseGetLiveChannelStat(InputStream responseBody) throws ResponseParseException {
try {
Element root = getXmlRootElement(responseBody);
LiveChannelStat result = new LiveChannelStat();
result.setPushflowStatus(PushflowStatus.parse(root.getChildText("Status")));
if (root.getChild("ConnectedTime") != null) {
result.setConnectedDate(DateUtil.parseIso8601Date(root.getChildText("ConnectedTime")));
}
if (root.getChild("RemoteAddr") != null) {
result.setRemoteAddress(root.getChildText("RemoteAddr"));
}
Element videoElem = root.getChild("Video");
if (videoElem != null) {
VideoStat videoStat = new VideoStat();
videoStat.setWidth(Integer.parseInt(videoElem.getChildText("Width")));
videoStat.setHeight(Integer.parseInt(videoElem.getChildText("Height")));
videoStat.setFrameRate(Integer.parseInt(videoElem.getChildText("FrameRate")));
videoStat.setBandWidth(Integer.parseInt(videoElem.getChildText("Bandwidth")));
videoStat.setCodec(videoElem.getChildText("Codec"));
result.setVideoStat(videoStat);
}
Element audioElem = root.getChild("Audio");
if (audioElem != null) {
AudioStat audioStat = new AudioStat();
audioStat.setBandWidth(Integer.parseInt(audioElem.getChildText("Bandwidth")));
audioStat.setSampleRate(Integer.parseInt(audioElem.getChildText("SampleRate")));
audioStat.setCodec(audioElem.getChildText("Codec"));
result.setAudioStat(audioStat);
}
return result;
} catch (JDOMParseException e) {
throw new ResponseParseException(e.getPartialDocument() + ": " + e.getMessage(), e);
} catch (Exception e) {
throw new ResponseParseException(e.getMessage(), e);
}
}
Aggregations