diff options
Diffstat (limited to 'tools/udp_pes_scheduler.c')
-rw-r--r-- | tools/udp_pes_scheduler.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/tools/udp_pes_scheduler.c b/tools/udp_pes_scheduler.c index a3c589af..13a59c48 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.1 2009-02-12 11:18:37 phintuka Exp $ + * $Id: udp_pes_scheduler.c,v 1.34.2.2 2009-06-06 13:27:41 phintuka Exp $ * */ @@ -821,9 +821,10 @@ void cUdpScheduler::ReSend(int fd, uint64_t Pos, int Seq1, int Seq2) if(fd < 0) /* no re-send for RTP */ return; - 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); + 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}}; // Handle buffer wrap if(Seq1 > Seq2) @@ -835,10 +836,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((udp_ctrl+sizeof(stream_udp_header_t)), + sprintf((char*)udp_ctrl.hdr.payload, "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; } @@ -877,21 +878,19 @@ 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, - ((stream_udp_header_t *)udp_ctrl)->pos, - ((stream_udp_header_t *)udp_ctrl)->seq); + Seq1, Seq1, Pos, udp_ctrl.hdr.pos, udp_ctrl.hdr.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((udp_ctrl+sizeof(stream_udp_header_t)), + sprintf((char*)udp_ctrl.hdr.payload, "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); } } |