summaryrefslogtreecommitdiff
path: root/tools/udp_pes_scheduler.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/udp_pes_scheduler.c')
-rw-r--r--tools/udp_pes_scheduler.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/tools/udp_pes_scheduler.c b/tools/udp_pes_scheduler.c
index 13a59c48..57b20a0b 100644
--- a/tools/udp_pes_scheduler.c
+++ b/tools/udp_pes_scheduler.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: udp_pes_scheduler.c,v 1.34.2.2 2009-06-06 13:27:41 phintuka Exp $
+ * $Id: udp_pes_scheduler.c,v 1.34 2008-04-28 20:53:07 phintuka Exp $
*
*/
@@ -676,11 +676,9 @@ void cUdpScheduler::Action(void)
#endif
/* UDP Scheduler needs high priority */
- const int priority = -5;
- SetPriority(priority);
+ SetPriority(-5);
+ (void)nice(-5);
errno = 0;
- if ((nice(priority) == -1) && errno)
- LOGDBG("cUdpScheduler: Can't nice to value: %d", priority);
m_Lock.Lock();
@@ -821,10 +819,9 @@ void cUdpScheduler::ReSend(int fd, uint64_t Pos, int Seq1, int Seq2)
if(fd < 0) /* no re-send for RTP */
return;
- struct {
- stream_udp_header_t hdr;
- char mem[64-sizeof(stream_udp_header_t)];
- } udp_ctrl = {{(uint64_t)INT64_C(-1), (uint16_t)-1}, {0}};
+ char udp_ctrl[64] = {0};
+ ((stream_udp_header_t *)udp_ctrl)->seq = (uint16_t)(-1);
+ ((stream_udp_header_t *)udp_ctrl)->pos = (uint64_t)(-1);
// Handle buffer wrap
if(Seq1 > Seq2)
@@ -836,10 +833,10 @@ void cUdpScheduler::ReSend(int fd, uint64_t Pos, int Seq1, int Seq2)
LOGDBG("cUdpScheduler::ReSend: requested range too large (%d-%d)",
Seq1, Seq2);
- sprintf((char*)udp_ctrl.hdr.payload,
+ sprintf((udp_ctrl+sizeof(stream_udp_header_t)),
"UDP MISSING %d-%d %" PRIu64,
Seq1, (Seq2 & UDP_BUFFER_MASK), Pos);
- send(fd, &udp_ctrl, sizeof(udp_ctrl), 0);
+ send(fd, udp_ctrl, sizeof(udp_ctrl), 0);
return;
}
@@ -878,19 +875,21 @@ void cUdpScheduler::ReSend(int fd, uint64_t Pos, int Seq1, int Seq2)
// buffer has been lost - send packet missing info
LOGRESEND("cUdpScheduler::ReSend: missing %d-%d @%d (hdr 0x%llx 0x%x)",
- Seq1, Seq1, Pos, udp_ctrl.hdr.pos, udp_ctrl.hdr.seq);
+ Seq1, Seq1, Pos,
+ ((stream_udp_header_t *)udp_ctrl)->pos,
+ ((stream_udp_header_t *)udp_ctrl)->seq);
int Seq0 = Seq1;
- for(; Seq1 < Seq2; Seq1++) {
+ for(; Seq1 <= Seq2; Seq1++) {
stream_rtp_header_impl_t *frame = m_BackLog->Get(Seq1+1);
if(frame && (ntohull(frame->hdr_ext.pos) - Pos < 100000))
break;
}
- sprintf((char*)udp_ctrl.hdr.payload,
+ sprintf((udp_ctrl+sizeof(stream_udp_header_t)),
"UDP MISSING %d-%d %" PRIu64,
Seq0, (Seq1 & UDP_BUFFER_MASK), Pos);
- send(fd, &udp_ctrl, sizeof(udp_ctrl), 0);
+ send(fd, udp_ctrl, sizeof(udp_ctrl), 0);
}
}