summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2009-06-06 13:27:41 +0000
committerphintuka <phintuka>2009-06-06 13:27:41 +0000
commit97a5245de77e0829ebdbf364cebc381cf60ae666 (patch)
treec8498d9ff71e63e8088e4867ff2bc4eb6fce0d71
parent1e3a3f89110f9aaf08ca78a4c9b245d11110e318 (diff)
downloadxineliboutput-unlabeled-1.34.2.tar.gz
xineliboutput-unlabeled-1.34.2.tar.bz2
Merge from trunk:unlabeled-1.34.2
revision 1.39 date: 2009/06/01 14:33:11; author: phintuka; state: Exp; lines: +10 -11 Eliminated warning (dereferencing type-punned pointer will break strict-aliasing rules). Initialize data in declaration. ---------------------------- revision 1.38 date: 2009/03/31 10:34:32; author: phintuka; state: Exp; lines: +2 -2 Fixed missing packet range when replying to resend request
-rw-r--r--tools/udp_pes_scheduler.c23
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);
}
}