wbokslag has uploaded this change for review.
when traffic dump directory is specified, now prints error message and exits instead of crashing when traffic file cannot be written
Change-Id: I273e07aefd9faea13662f6699a6f3b074c8efe88
---
M src/lower_mac/tetra_lower_mac.c
1 file changed, 69 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-tetra refs/changes/26/28926/1
diff --git a/src/lower_mac/tetra_lower_mac.c b/src/lower_mac/tetra_lower_mac.c
index ca1b72e..cd6440c 100644
--- a/src/lower_mac/tetra_lower_mac.c
+++ b/src/lower_mac/tetra_lower_mac.c
@@ -196,6 +196,10 @@
snprintf(fname, sizeof(fname), "%s/traffic_%d_%d.out", tms->dumpdir,
tms->cur_burst.is_traffic, tms->tsn);
f = fopen(fname, "ab");
+ if (!f) {
+ fprintf(stderr, "could not open dump file %s for writing\n", fname);
+ exit(1);
+ }
/* Generate a block */
memset(block, 0x00, sizeof(int16_t) * 690);
@@ -218,12 +222,77 @@
fwrite(block, sizeof(int16_t), 690, f);
fclose(f);
+
/* Write used ssi */
snprintf(fname, sizeof(fname), "%s/traffic_%d_%d.txt", tms->dumpdir,
tms->cur_burst.is_traffic, tms->tsn);
f = fopen(fname, "a");
fprintf(f, "%d\n", tms->ssi);
fclose(f);
+
+ printf("\nVOICE TYPE4: %s\n", osmo_ubit_dump(type4, 432));
+
+
+#if 0
+ /* Experimental code attempting channel decoding in FOSS instead of relying on ETSI codec */
+
+ // Desinterleaving_Speech():
+
+ /* FIXME support frame stealing */
+ int frame_stealing = 0;
+ if (frame_stealing) {
+ block_deinterleave(216, 101, type4, type3);
+ printf("\nVOICE TYPE3 block_deinterleave: %s\n", osmo_ubit_dump(type3, 432));
+ } else {
+ /* FIXME deinterleave differs from codec impl
+ Is identical when using: out[index_lines * columns + index_columns] = in[index_columns * lines + index_lines]; */
+ matrix_deinterleave(24, 18, type4, type3);
+ printf("\nVOICE TYPE3 matrix_deinterleave: %s\n", osmo_ubit_dump(type3, 432));
+ }
+
+ // Channel_Decoding():
+ if (!frame_stealing) {
+ /* FIXME determine how to depuncture */
+ // memset(type3dp, 0, sizeof(type3dp));
+ // tetra_rcpc_depunct(TETRA_RCPC_PUNCT_2_3, type3, 432, type3dp);
+ // printf("\nVOICE TYPE3DP: %s\n", osmo_ubit_dump(type3dp, 432));
+
+ } else {
+ /* FIXME support frame stealing */
+ }
+
+ /* FIXME implement bad frame indicator */
+ int badframeindicator = Bfi(frame_stealing,type3dp);
+ // Untransform_Class_0() :
+
+#define N0 51 /* One Frame : Less sensitive class (class 0) */
+#define N0_2 102 /* Two Frames : Less sensitive class (class 0) */
+
+ int Size_Class0;
+ if (!frame_stealing)
+ Size_Class0 = N0_2;
+ else
+ Size_Class0 = N0;
+
+ for (i = 0; i < Size_Class0; i++) {
+ if (type3dp[i] >= 0)
+ type3dp[i] = 0;
+ else
+ type3dp[i] = 1;
+ } /* End Loop Size_Class0 */
+
+
+
+ if (!frame_stealing) {
+ /* Reordering of the three classes in two speech frames */
+ // Unbuild_Sensitivity_Classes(frame_stealing,Decoded_array, Output_Frame);
+ } else {
+ /* Reordering of the three classes in one speech frame */
+ // Unbuild_Sensitivity_Classes(frame_stealing,Decoded_array, Output_Frame + 137);
+ }
+ return(badframeindicator);
+#endif
+
}
if (tbp->interleave_a) {
To view, visit change 28926. To unsubscribe, or for help writing mail filters, visit settings.