/** * Begins broadcast using the given VideoParams. * * @param videoParams The video params * @return Whether or not successfully broadcasting */ public boolean startBroadcasting(VideoParams videoParams) { if (videoParams == null || !this.getIsReadyToBroadcast()) { return false; } m_VideoParams = videoParams.clone(); // Setup the audio parameters m_AudioParams = new AudioParams(); m_AudioParams.audioEnabled = m_EnableAudio && getIsAudioSupported(); // // only enable audio if possible if (!allocateBuffers()) { m_VideoParams = null; m_AudioParams = null; return false; } ErrorCode ret = m_Stream.start(videoParams, m_AudioParams, m_IngestServer, StartFlags.None, true); if (ErrorCode.failed(ret)) { cleanupBuffers(); String err = ErrorCode.getString(ret); reportError(String.format("Error while starting to broadcast: %s", err)); m_VideoParams = null; m_AudioParams = null; return false; } setBroadcastState(BroadcastState.Starting); return true; }