562 | 562 |
bool _sendSTMu = false;
|
563 | 563 |
bool _sendSTMo = false;
|
564 | 564 |
bool _sendSTMn = false;
|
565 | |
disconnect_code disconnect;
|
|
565 |
bool _stream_disconnect = false;
|
|
566 |
disconnect_code disconnect_code;
|
566 | 567 |
static char header[MAX_HEADER];
|
567 | 568 |
size_t header_len = 0;
|
568 | 569 |
last = now;
|
|
574 | 575 |
status.stream_state = stream.state;
|
575 | 576 |
|
576 | 577 |
if (stream.state == DISCONNECT) {
|
577 | |
disconnect = stream.disconnect;
|
|
578 |
disconnect_code = stream.disconnect;
|
578 | 579 |
stream.state = STOPPED;
|
579 | 580 |
_sendDSCO = true;
|
580 | 581 |
}
|
|
627 | 628 |
_sendSTMt = true;
|
628 | 629 |
status.last = now;
|
629 | 630 |
}
|
630 | |
if (decode.state == DECODE_COMPLETE) {
|
631 | |
_sendSTMd = true;
|
632 | |
decode.state = DECODE_STOPPED;
|
633 | |
}
|
634 | |
if (decode.state == DECODE_ERROR) {
|
635 | |
_sendSTMn = true;
|
636 | |
decode.state = DECODE_STOPPED;
|
637 | |
}
|
638 | 631 |
if ((status.stream_state == STREAMING_HTTP || status.stream_state == STREAMING_FILE) && !sentSTMl
|
639 | 632 |
&& decode.state == DECODE_STOPPED) {
|
640 | 633 |
if (autostart == 0) {
|
|
650 | 643 |
}
|
651 | 644 |
// autostart 2 and 3 require cont to be received first
|
652 | 645 |
}
|
|
646 |
if (decode.state == DECODE_COMPLETE || decode.state == DECODE_ERROR) {
|
|
647 |
if (decode.state == DECODE_COMPLETE) _sendSTMd = true;
|
|
648 |
if (decode.state == DECODE_ERROR) _sendSTMn = true;
|
|
649 |
decode.state = DECODE_STOPPED;
|
|
650 |
if (status.stream_state == STREAMING_HTTP || status.stream_state == STREAMING_FILE) {
|
|
651 |
_stream_disconnect = true;
|
|
652 |
}
|
|
653 |
}
|
653 | 654 |
UNLOCK_D;
|
654 | 655 |
|
|
656 |
if (_stream_disconnect) stream_disconnect();
|
|
657 |
|
655 | 658 |
// send packets once locks released as packet sending can block
|
656 | |
if (_sendDSCO) sendDSCO(disconnect);
|
|
659 |
if (_sendDSCO) sendDSCO(disconnect_code);
|
657 | 660 |
if (_sendSTMs) sendSTAT("STMs", 0);
|
658 | 661 |
if (_sendSTMd) sendSTAT("STMd", 0);
|
659 | 662 |
if (_sendSTMt) sendSTAT("STMt", 0);
|