コード例 #1
0
/**
 * Set the audio device which should be used for playback. Can be set to AAUDIO_UNSPECIFIED if
 * you want to use the default playback device (which is usually the built-in speaker if
 * no other audio devices, such as headphones, are attached).
 *
 * @param deviceId the audio device id, can be obtained through an {@link AudioDeviceInfo} object
 * using Java/JNI.
 */
void PlayAudioEngine::setDeviceId(int32_t deviceId){

  playbackDeviceId_ = deviceId;

  // If this is a different device from the one currently in use then restart the stream
  int32_t currentDeviceId = AAudioStream_getDeviceId(playStream_);
  if (deviceId != currentDeviceId) restartStream();
}
コード例 #2
0
void BOSHConnectionPool::handleConnectFinished(bool error, BOSHConnection::ref connection) {
	if (error) {
		onSessionTerminated(boost::make_shared<BOSHError>(BOSHError::UndefinedCondition));
		/*TODO: We can probably manage to not terminate the stream here and use the rid/ack retry
		 * logic to just swallow the error and try again (some number of tries).
		 */
	}
	else {
		if (sid.empty()) {
			connection->startStream(to, rid);
		}
		if (pendingRestart) {
			restartStream();
		}
		tryToSendQueuedData();
	}
}