function maybePreferH264SendCodec(sdp) {
  var sdpLines = sdp.split('\r\n');

  var mLineIndex = findLine(sdpLines, 'm=', 'video');
  if (mLineIndex === null) {
    failTest('No |m=video| line found in the sdp.');
    return sdp;
  }

  var payload = getCodecPayloadType(sdpLines, 'h264');
  if (payload === null) {
    console.log("H264 is not available on this target.");
    return sdp;
  }

  // If h264 is available, set it as the default in m line.
  sdpLines[mLineIndex] = setDefaultCodec(sdpLines[mLineIndex], payload);
  sdp = sdpLines.join('\r\n');
  return sdp;
}
// Promotes H264 to be the first in the m=video line, if available.
Promotes H264 to be the first in the m=video line, if available.
Promotes H264 to be the first in the m = video line if available .
function maybePreferH264SendCodec(sdp) {
  var sdpLines = sdp.split('\r\n');
  var mLineIndex = findLine(sdpLines, 'm=', 'video');
  if (mLineIndex === null) {
    failTest('No |m=video| line found in the sdp.');
    return sdp;
  }
  var payload = getCodecPayloadType(sdpLines, 'h264');
  if (payload === null) {
    console.log("H264 is not available on this target.");
    return sdp;
  }
  sdpLines[mLineIndex] = setDefaultCodec(sdpLines[mLineIndex], payload);
  sdp = sdpLines.join('\r\n');
  return sdp;
}
function maybePreferH264SendCodec ( sdp ) { var sdpLines = sdp . split ( '\r\n' ) ; var mLineIndex = findLine ( sdpLines , 'm=' , 'video' ) ; if ( mLineIndex === null ) { failTest ( 'No |m=video| line found in the sdp.' ) ; return sdp ; } var payload = getCodecPayloadType ( sdpLines , 'h264' ) ; if ( payload === null ) { console . log ( "H264 is not available on this target." ) ; return sdp ; } sdpLines [ mLineIndex ] = setDefaultCodec ( sdpLines [ mLineIndex ] , payload ) ; sdp = sdpLines . join ( '\r\n' ) ; return sdp ; }
Promotes H264 to be the first in the m=video line, if available.
Promotes H264 to be the first in the m = video line if available .
// If h264 is available, set it as the default in m line.