mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-12-01 02:05:06 +00:00
Add start and stop callbacks for audio and video renderers
This commit is contained in:
1 parent
92951e1309
commit
86447399a9
4 files changed
+53
-2
No files matched your search
@@ -151,6 +151,8 @@ int readFirstFrame(void) {
|
||||
|
||||
// Terminate the video stream
|
||||
void stopVideoStream(void) {
|
||||
VideoCallbacks.stop();
|
||||
|
||||
// Wake up client code that may be waiting on the decode unit queue
|
||||
stopVideoDepacketizer();
|
||||
|
||||
@@ -209,8 +211,11 @@ int startVideoStream(void* rendererContext, int drFlags) {
|
||||
return LastSocketError();
|
||||
}
|
||||
|
||||
VideoCallbacks.start();
|
||||
|
||||
err = PltCreateThread(ReceiveThreadProc, NULL, &receiveThread);
|
||||
if (err != 0) {
|
||||
VideoCallbacks.stop();
|
||||
closeSocket(rtpSocket);
|
||||
VideoCallbacks.cleanup();
|
||||
return err;
|
||||
@@ -219,6 +224,7 @@ int startVideoStream(void* rendererContext, int drFlags) {
|
||||
if ((VideoCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||
err = PltCreateThread(DecoderThreadProc, NULL, &decoderThread);
|
||||
if (err != 0) {
|
||||
VideoCallbacks.stop();
|
||||
PltInterruptThread(&receiveThread);
|
||||
PltJoinThread(&receiveThread);
|
||||
PltCloseThread(&receiveThread);
|
||||
@@ -233,6 +239,7 @@ int startVideoStream(void* rendererContext, int drFlags) {
|
||||
firstFrameSocket = connectTcpSocket(&RemoteAddr, RemoteAddrLen,
|
||||
FIRST_FRAME_PORT, FIRST_FRAME_TIMEOUT_SEC);
|
||||
if (firstFrameSocket == INVALID_SOCKET) {
|
||||
VideoCallbacks.stop();
|
||||
stopVideoDepacketizer();
|
||||
PltInterruptThread(&receiveThread);
|
||||
if ((VideoCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||
@@ -256,6 +263,7 @@ int startVideoStream(void* rendererContext, int drFlags) {
|
||||
// to send UDP data
|
||||
err = PltCreateThread(UdpPingThreadProc, NULL, &udpPingThread);
|
||||
if (err != 0) {
|
||||
VideoCallbacks.stop();
|
||||
stopVideoDepacketizer();
|
||||
PltInterruptThread(&receiveThread);
|
||||
if ((VideoCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||
|
||||
Reference in new issue
Block a user