openvidu-server: Better format for force codec debug logs

pull/567/head
cruizba 2020-11-19 17:14:04 +01:00
parent 7a25233b8b
commit 7ddde2fbc4
1 changed files with 21 additions and 9 deletions

View File

@ -151,33 +151,45 @@ public class SDPMunging {
* Return a SDP modified to force a specific codec * Return a SDP modified to force a specific codec
*/ */
public String forceCodec(Participant participant, String sdp, boolean isOffer, Session session, boolean isPublisher, public String forceCodec(Participant participant, String sdp, boolean isOffer, Session session, boolean isPublisher,
boolean isReconnecting, boolean isTranscodingAllowed, VideoCodec forcedVideoCodec) throws OpenViduException { boolean isReconnecting, boolean isTranscodingAllowed, VideoCodec forcedVideoCodec) throws OpenViduException {
try { try {
if (supportedVideoCodecs.contains(forcedVideoCodec)) { if (supportedVideoCodecs.contains(forcedVideoCodec)) {
String mungedSdpOffer; String mungedSdpOffer;
log.debug("PARTICIPANT '{}' in Session '{}'. Is Publisher: '{}'. Is Subscriber: '{}'. Is Offer SDP: '{}'. " +
"Is Answer SDP: '{}'. Is Reconnecting '{}'. SDP before munging: \n {}", participant.getParticipantPublicId(), log.debug("PARTICIPANT '{}' in Session '{}'. Is Publisher: '{}'. Is Subscriber: '{}'."
+ " Is Offer SDP: '{}'. Is Answer SDP: '{}'. Is Reconnecting '{}'."
+ " SDP before munging: \n {}", participant.getParticipantPublicId(),
session.getSessionId(), isPublisher, !isPublisher, isOffer, !isOffer, isReconnecting, sdp); session.getSessionId(), isPublisher, !isPublisher, isOffer, !isOffer, isReconnecting, sdp);
mungedSdpOffer = this.setCodecPreference(forcedVideoCodec, sdp); mungedSdpOffer = this.setCodecPreference(forcedVideoCodec, sdp);
log.debug("PARTICIPANT '{}' in Session '{}'. Is Publisher: '{}'. Is Subscriber: '{}'. Is Offer SDP: '{}'. " +
"Is Answer SDP: '{}'. Is Reconnecting '{}'. SDP after munging: \n {}", participant.getParticipantPublicId(), log.debug("PARTICIPANT '{}' in Session '{}'. Is Publisher: '{}'. Is Subscriber: '{}'."
+ " Is Offer SDP: '{}'. Is Answer SDP: '{}'. Is Reconnecting '{}'."
+ " SDP after munging: \n {}", participant.getParticipantPublicId(),
session.getSessionId(), isPublisher, !isPublisher, isOffer, !isOffer, isReconnecting, mungedSdpOffer); session.getSessionId(), isPublisher, !isPublisher, isOffer, !isOffer, isReconnecting, mungedSdpOffer);
return mungedSdpOffer; return mungedSdpOffer;
} else { } else {
throw new OpenViduException(Code.FORCED_CODEC_NOT_FOUND_IN_SDPOFFER, "Codec not supported by Media Server"); throw new OpenViduException(Code.FORCED_CODEC_NOT_FOUND_IN_SDPOFFER, "Codec not supported by Media Server");
} }
} catch (OpenViduException e) { } catch (OpenViduException e) {
String errorMessage = "Error forcing codec: '" + forcedVideoCodec + "', for PARTICIPANT: '" + participant.getParticipantPublicId()
+ "' in Session: '" + session.getSessionId() + "'. Is publishing: '" + isPublisher + "'. Is Subscriber: '" + !isPublisher String errorMessage = "Error forcing codec: '" + forcedVideoCodec + "', for PARTICIPANT: '"
+ participant.getParticipantPublicId() + "' in Session: '" + session.getSessionId()
+ "'. Is publishing: '" + isPublisher + "'. Is Subscriber: '" + !isPublisher
+ "'. Is Offer: '" + isOffer + "'. Is Answer: '" + !isOffer + "'. Is Reconnecting: '" + "'. Is Offer: '" + isOffer + "'. Is Answer: '" + !isOffer + "'. Is Reconnecting: '"
+ isReconnecting + "'.\nException: " + e.getMessage() + "\nSDP:\n" + sdp; + isReconnecting + "'.\nException: " + e.getMessage() + "\nSDP:\n" + sdp;
if(!isTranscodingAllowed) { if(!isTranscodingAllowed) {
throw new OpenViduException(Code.FORCED_CODEC_NOT_FOUND_IN_SDPOFFER, errorMessage); throw new OpenViduException(Code.FORCED_CODEC_NOT_FOUND_IN_SDPOFFER, errorMessage);
} }
log.info("Codec: '{}' is not supported for PARTICIPANT: '{}' in Session: '{}'. Is publishing: '{}'. Is Subscriber: '{}' "
+ "Is Offer SDP: '{}'. Is Answer SDP: '{}'. Is Reconnecting: '{}'. Transcoding will be allowed", forcedVideoCodec, participant.getParticipantPublicId(), log.info("Codec: '{}' is not supported for PARTICIPANT: '{}' in Session: '{}'. Is publishing: '{}'. "
+ "Is Subscriber: '{}' Is Offer SDP: '{}'. Is Answer SDP: '{}'. Is Reconnecting: '{}'."
+ " Transcoding will be allowed", forcedVideoCodec, participant.getParticipantPublicId(),
session.getSessionId(), isPublisher, !isPublisher, isOffer, !isOffer, isReconnecting); session.getSessionId(), isPublisher, !isPublisher, isOffer, !isOffer, isReconnecting);
return sdp; return sdp;
} }
} }