Skip to content

Commit af80d59

Browse files
committed
removed XOR (FEC)
1 parent f19183f commit af80d59

File tree

6 files changed

+18
-468
lines changed

6 files changed

+18
-468
lines changed

ultragrid/Makefile.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ OBJS = @OBJS@ \
4545
src/tv.o \
4646
src/transmit.o \
4747
src/tfrc.o \
48-
src/rtp/xor.o \
4948
src/rtp/ldgm.o \
5049
src/rtp/pbuf.o \
5150
src/rtp/decoders.o \

ultragrid/src/rtp/decoders.c

Lines changed: 10 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include "perf.h"
4848
#include "rtp/ldgm.h"
4949
#include "rtp/ll.h"
50-
#include "rtp/xor.h"
5150
#include "rtp/rtp.h"
5251
#include "rtp/rtp_callback.h"
5352
#include "rtp/pbuf.h"
@@ -734,7 +733,6 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
734733
uint32_t substream;
735734
int fps_pt, fpsd, fd, fi;
736735

737-
struct xor_session **xors = calloc(10, sizeof(struct xor_session *));
738736
int i;
739737
struct linked_list **pckt_list = malloc(decoder->max_substreams * sizeof(struct linked_list *));
740738
uint32_t *buffer_len = malloc(decoder->max_substreams * sizeof(uint32_t));
@@ -754,60 +752,8 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
754752

755753
while (cdata != NULL) {
756754
pckt = cdata->data;
757-
#if 0
758-
hdr = (video_payload_hdr_t *) pckt->data;
759-
if(pckt->pt >= 98) {
760-
struct xor_session *xor;
761-
xor = xors[pckt->pt - 98];
762-
if(xor && last_rtp_seq < pckt->seq) {
763-
xor_restore_invalidate(xor);
764-
}
765-
last_rtp_seq = pckt->seq;
766-
if(!xor) {
767-
xor = xors[pckt->pt - 98] =
768-
xor_restore_init();
769-
/* register the xor packet */
770-
xor_restore_start(xor, pckt->data);
771-
cdata = cdata->nxt;
772-
/* and jump to next */
773-
continue;
774-
} else {
775-
int ret = FALSE;
776-
uint16_t payload_len;
777-
rtp_packet *pckt_old = pckt;
778-
/* try to restore packet */
779-
ret = xor_restore_packet(xor, (char **) &hdr, &payload_len);
780-
/* register current xor packet */
781-
xor_restore_start(xor, pckt_old->data);
782-
/* if we didn't recovered any packet, jump to next */
783-
if(!ret) {
784-
cdata = cdata->nxt;
785-
continue;
786-
}
787-
/* otherwise process the restored packet */
788-
data = (char *) hdr + sizeof(video_payload_hdr_t);
789-
len = payload_len;
790-
goto packet_restored;
791-
}
792-
} else {
793-
int i = 0;
794-
while (xors[i]) {
795-
if(xors[i]) {
796-
if(last_rtp_seq >= pckt->seq) {
797-
xor_add_packet(xors[i], (char *) hdr, (char *) hdr + sizeof(video_payload_hdr_t), pckt->data_len - sizeof(video_payload_hdr_t));
798-
} else {
799-
xor_restore_invalidate(xors[i]);
800-
}
801755

802-
last_rtp_seq = pckt->seq;
803-
}
804-
i++;
805-
}
806-
}
807-
packet_restored:
808-
#endif
809-
810-
if(pckt->pt == 20) {
756+
if(pckt->pt == PT_VIDEO) {
811757
video_payload_hdr_t *hdr;
812758
hdr = (video_payload_hdr_t *) pckt->data;
813759
len = pckt->data_len - sizeof(video_payload_hdr_t);
@@ -832,7 +778,7 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
832778
fi = (tmp >> 13) & 0x1;
833779

834780
fps = compute_fps(fps_pt, fpsd, fd, fi);
835-
} else if (pckt->pt == 22) {
781+
} else if (pckt->pt == PT_VIDEO_LDGM) {
836782
ldgm_payload_hdr_t *hdr;
837783
hdr = (ldgm_payload_hdr_t *) pckt->data;
838784
len = pckt->data_len - sizeof(ldgm_payload_hdr_t);
@@ -878,7 +824,7 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
878824

879825
ll_insert(pckt_list[substream], data_pos, len);
880826

881-
if (pckt->pt == 20) {
827+
if (pckt->pt == PT_VIDEO) {
882828
/* Critical section
883829
* each thread *MUST* wait here if this condition is true
884830
*/
@@ -903,7 +849,7 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
903849
goto cleanup;
904850
}
905851
}
906-
} else if (pckt->pt == 22) {
852+
} else if (pckt->pt == PT_VIDEO_LDGM) {
907853
if(!decoder->fec_state) {
908854
decoder->fec_state = ldgm_decoder_init(k, m, c, seed);
909855
if(decoder->fec_state == NULL) {
@@ -920,7 +866,7 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
920866
memcpy(ext_recv_buffer, decoder->ext_recv_buffer, decoder->max_substreams * sizeof(char *));
921867
}
922868

923-
if (pckt->pt == 20) {
869+
if (pckt->pt == PT_VIDEO) {
924870
if(!decoder->postprocess) {
925871
if (!decoder->merged_fb) {
926872
tile = vf_get_tile(frame, substream);
@@ -1017,7 +963,7 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
1017963
memcpy(decoder->ext_recv_buffer[substream] + data_pos, (unsigned char*)(pckt->data + sizeof(video_payload_hdr_t)),
1018964
len);
1019965
}
1020-
} else {
966+
} else { /* PT_VIDEO_LDGM */
1021967
memcpy(fec_buffers[substream] + data_pos, (unsigned char*)(pckt->data + sizeof(ldgm_payload_hdr_t)),
1022968
len);
1023969
}
@@ -1026,10 +972,11 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
1026972
}
1027973

1028974
if(!pckt) {
1029-
return FALSE;
975+
ret = FALSE;
976+
goto cleanup;
1030977
}
1031978

1032-
if (pckt->pt == 22) {
979+
if (pckt->pt == PT_VIDEO_LDGM) {
1033980
int x,y;
1034981
for (x = 0; x < get_video_mode_tiles_x(decoder->video_mode); ++x) {
1035982
for (y = 0; y < get_video_mode_tiles_y(decoder->video_mode); ++y) {
@@ -1102,7 +1049,7 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
11021049
}
11031050
}
11041051
}
1105-
} else {
1052+
} else { /* PT_VIDEO */
11061053
for(i = 0; i < (int) decoder->max_substreams; ++i) {
11071054
if(buffer_len[i] != ll_count_bytes(pckt_list[i])) {
11081055
fprintf(stderr, "Frame incomplete - substream %d, buffer %d: expected %u bytes, got %u. ", i,
@@ -1185,12 +1132,5 @@ int decode_frame(struct coded_data *cdata, void *decode_data)
11851132
free(buffer_num);
11861133
free(fec_buffers);
11871134

1188-
i = 0;
1189-
while (xors[i]) {
1190-
xor_restore_destroy(xors[i]);
1191-
++i;
1192-
}
1193-
free(xors);
1194-
11951135
return ret;
11961136
}

ultragrid/src/rtp/rtp_callback.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,9 @@
4646
* Packet formats:
4747
* http://www.cesnet.cz/doc/techzpravy/2010/4k-packet-format/
4848
*/
49-
50-
#if 0
51-
typedef struct {
52-
uint16_t width; /* pixels */
53-
uint16_t height; /* pixels */
54-
uint32_t offset; /* in bytes */
55-
uint16_t length; /* octets */
56-
uint8_t colorspc;
57-
uint8_t flags;
58-
uint32_t fps; /* fixed point fps. take care! */
59-
uint32_t aux; /* auxiliary data */
60-
uint32_t tileinfo; /* info about tile position (if tiled) */
61-
} payload_hdr_t;
62-
#endif
49+
#define PT_VIDEO 20
50+
#define PT_AUDIO 21
51+
#define PT_VIDEO_LDGM 22
6352

6453
typedef struct {
6554
/* first word */

0 commit comments

Comments
 (0)