Add audio context and flags

This commit is contained in:
Iwan Timmer 2017-05-28 15:34:56 +02:00
parent 6e31c21815
commit d3fe286eb7
5 changed files with 10 additions and 8 deletions

View File

@ -280,11 +280,11 @@ void stopAudioStream(void) {
AudioCallbacks.cleanup(); AudioCallbacks.cleanup();
} }
int startAudioStream(void) { int startAudioStream(void* audioContext, int arFlags) {
int err; int err;
err = AudioCallbacks.init(StreamConfig.audioConfiguration, err = AudioCallbacks.init(StreamConfig.audioConfiguration,
opusConfigArray[StreamConfig.audioConfiguration]); opusConfigArray[StreamConfig.audioConfiguration], audioContext, arFlags);
if (err != 0) { if (err != 0) {
return err; return err;
} }

View File

@ -216,7 +216,8 @@ static int resolveHostName(const char* host)
// Starts the connection to the streaming machine // Starts the connection to the streaming machine
int LiStartConnection(PSERVER_INFORMATION serverInfo, PSTREAM_CONFIGURATION streamConfig, PCONNECTION_LISTENER_CALLBACKS clCallbacks, int LiStartConnection(PSERVER_INFORMATION serverInfo, PSTREAM_CONFIGURATION streamConfig, PCONNECTION_LISTENER_CALLBACKS clCallbacks,
PDECODER_RENDERER_CALLBACKS drCallbacks, PAUDIO_RENDERER_CALLBACKS arCallbacks, void* renderContext, int drFlags) { PDECODER_RENDERER_CALLBACKS drCallbacks, PAUDIO_RENDERER_CALLBACKS arCallbacks, void* renderContext, int drFlags,
void* audioContext, int arFlags) {
int err; int err;
NegotiatedVideoFormat = 0; NegotiatedVideoFormat = 0;
@ -352,7 +353,7 @@ int LiStartConnection(PSERVER_INFORMATION serverInfo, PSTREAM_CONFIGURATION stre
Limelog("Starting audio stream..."); Limelog("Starting audio stream...");
ListenerCallbacks.stageStarting(STAGE_AUDIO_STREAM_START); ListenerCallbacks.stageStarting(STAGE_AUDIO_STREAM_START);
err = startAudioStream(); err = startAudioStream(audioContext, arFlags);
if (err != 0) { if (err != 0) {
Limelog("Audio stream start failed: %d\n", err); Limelog("Audio stream start failed: %d\n", err);
ListenerCallbacks.stageFailed(STAGE_AUDIO_STREAM_START, err); ListenerCallbacks.stageFailed(STAGE_AUDIO_STREAM_START, err);

View File

@ -14,7 +14,7 @@ static DECODER_RENDERER_CALLBACKS fakeDrCallbacks = {
.submitDecodeUnit = fakeDrSubmitDecodeUnit, .submitDecodeUnit = fakeDrSubmitDecodeUnit,
}; };
static int fakeArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig) { return 0; } static int fakeArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) { return 0; }
static void fakeArStart(void) {} static void fakeArStart(void) {}
static void fakeArStop(void) {} static void fakeArStop(void) {}
static void fakeArCleanup(void) {} static void fakeArCleanup(void) {}

View File

@ -56,7 +56,7 @@ void stopVideoStream(void);
void initializeAudioStream(void); void initializeAudioStream(void);
void destroyAudioStream(void); void destroyAudioStream(void);
int startAudioStream(void); int startAudioStream(void* audioContext, int arFlags);
void stopAudioStream(void); void stopAudioStream(void);
int initializeInputStream(void); int initializeInputStream(void);

View File

@ -159,7 +159,7 @@ typedef struct _OPUS_MULTISTREAM_CONFIGURATION {
// This callback initializes the audio renderer. The audio configuration parameter // This callback initializes the audio renderer. The audio configuration parameter
// provides the negotiated audio configuration. This may differ from the one // provides the negotiated audio configuration. This may differ from the one
// specified in the stream configuration. Returns 0 on success, non-zero on failure. // specified in the stream configuration. Returns 0 on success, non-zero on failure.
typedef int(*AudioRendererInit)(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig); typedef int(*AudioRendererInit)(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags);
// This callback notifies the decoder that the stream is starting. No audio can be submitted before this callback returns. // This callback notifies the decoder that the stream is starting. No audio can be submitted before this callback returns.
typedef void(*AudioRendererStart)(void); typedef void(*AudioRendererStart)(void);
@ -260,7 +260,8 @@ void LiInitializeServerInformation(PSERVER_INFORMATION serverInfo);
// This function is not thread-safe. // This function is not thread-safe.
// //
int LiStartConnection(PSERVER_INFORMATION serverInfo, PSTREAM_CONFIGURATION streamConfig, PCONNECTION_LISTENER_CALLBACKS clCallbacks, int LiStartConnection(PSERVER_INFORMATION serverInfo, PSTREAM_CONFIGURATION streamConfig, PCONNECTION_LISTENER_CALLBACKS clCallbacks,
PDECODER_RENDERER_CALLBACKS drCallbacks, PAUDIO_RENDERER_CALLBACKS arCallbacks, void* renderContext, int drFlags); PDECODER_RENDERER_CALLBACKS drCallbacks, PAUDIO_RENDERER_CALLBACKS arCallbacks, void* renderContext, int drFlags,
void* audioContext, int arFlags);
// This function stops streaming. This function is not thread-safe. // This function stops streaming. This function is not thread-safe.
void LiStopConnection(void); void LiStopConnection(void);