Revision 636790a9 plugins/janus_nosip.c
plugins/janus_nosip.c | ||
---|---|---|
733 | 733 |
video ? "video" : "audio", |
734 | 734 |
video ? session->media.video_ssrc : session->media.audio_ssrc); |
735 | 735 |
} |
736 |
if((video && session->media.has_video && session->media.video_rtp_fd) || |
|
737 |
(!video && session->media.has_audio && session->media.audio_rtp_fd)) { |
|
736 |
if((video && session->media.has_video && session->media.video_rtp_fd != -1) ||
|
|
737 |
(!video && session->media.has_audio && session->media.audio_rtp_fd != -1)) {
|
|
738 | 738 |
/* Save the frame if we're recording */ |
739 | 739 |
janus_recorder_save_frame(video ? session->vrc : session->arc, buf, len); |
740 | 740 |
/* Is SRTP involved? */ |
... | ... | |
773 | 773 |
return; |
774 | 774 |
} |
775 | 775 |
/* Forward to our NoSIP peer */ |
776 |
if((video && session->media.has_video && session->media.video_rtcp_fd) || |
|
777 |
(!video && session->media.has_audio && session->media.audio_rtcp_fd)) { |
|
776 |
if((video && session->media.has_video && session->media.video_rtcp_fd != -1) ||
|
|
777 |
(!video && session->media.has_audio && session->media.audio_rtcp_fd != -1)) {
|
|
778 | 778 |
/* Fix SSRCs as the gateway does */ |
779 | 779 |
JANUS_LOG(LOG_HUGE, "[NoSIP-%p] Fixing %s SSRCs (local %u, peer %u)\n", |
780 | 780 |
session, video ? "video" : "audio", |
... | ... | |
1781 | 1781 |
int i = 0; |
1782 | 1782 |
for(i=0; i<num; i++) { |
1783 | 1783 |
if(fds[i].revents & (POLLERR | POLLHUP)) { |
1784 |
/* If we just updated the session, let's wait until things have calmed down */ |
|
1784 | 1785 |
if(session->media.updated) |
1785 | 1786 |
break; |
1786 |
/* Socket error? */ |
|
1787 |
JANUS_LOG((errno == 0 ? LOG_WARN : LOG_ERR), "[NoSIP-%p] Error polling: %s... errno=%d (%s)\n", |
|
1788 |
session, fds[i].revents & POLLERR ? "POLLERR" : "POLLHUP", errno, strerror(errno)); |
|
1789 |
if(errno == 0) { |
|
1790 |
/* Maybe not a breaking error? */ |
|
1787 |
/* Check the socket error */ |
|
1788 |
int error = 0; |
|
1789 |
socklen_t errlen = sizeof(error); |
|
1790 |
getsockopt(fds[i].fd, SOL_SOCKET, SO_ERROR, (void *)&error, &errlen); |
|
1791 |
if(error == 0) { |
|
1792 |
/* Maybe not a breaking error after all? */ |
|
1793 |
continue; |
|
1794 |
} else if(error == 111) { |
|
1795 |
/* ICMP error? If it's related to RTCP, let's just close the RTCP socket and move on */ |
|
1796 |
if(fds[i].fd == session->media.audio_rtcp_fd) { |
|
1797 |
JANUS_LOG(LOG_WARN, "[NoSIP-%p] Got a '%s' on the audio RTCP socket, closing it\n", |
|
1798 |
session, strerror(error)); |
|
1799 |
close(session->media.audio_rtcp_fd); |
|
1800 |
session->media.audio_rtcp_fd = -1; |
|
1801 |
} else if(fds[i].fd == session->media.video_rtcp_fd) { |
|
1802 |
JANUS_LOG(LOG_WARN, "[NoSIP-%p] Got a '%s' on the video RTCP socket, closing it\n", |
|
1803 |
session, strerror(error)); |
|
1804 |
close(session->media.video_rtcp_fd); |
|
1805 |
session->media.video_rtcp_fd = -1; |
|
1806 |
} |
|
1807 |
/* FIXME Should we do the same with the RTP sockets as well? We may risk overreacting, there... */ |
|
1791 | 1808 |
continue; |
1792 | 1809 |
} |
1810 |
JANUS_LOG(LOG_ERR, "[NoSIP-%p] Error polling %d (socket #%d): %s...\n", session, |
|
1811 |
fds[i].fd, i, fds[i].revents & POLLERR ? "POLLERR" : "POLLHUP"); |
|
1812 |
JANUS_LOG(LOG_ERR, "[NoSIP-%p] -- %d (%s)\n", session, error, strerror(error)); |
|
1793 | 1813 |
/* Can we assume it's pretty much over, after a POLLERR? */ |
1794 | 1814 |
goon = FALSE; |
1795 | 1815 |
/* FIXME Close the PeerConnection */ |
Also available in: Unified diff