From: drowe67 Date: Sat, 12 Sep 2015 05:47:18 +0000 (+0000) Subject: fixed seg fault with modem_stats X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=4b20994ad004c8ae746d2a81393843a4a0dec529;p=freetel-svn-tracking.git fixed seg fault with modem_stats git-svn-id: https://svn.code.sf.net/p/freetel/code@2318 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/freedv_api.c b/codec2-dev/src/freedv_api.c index a480644f..c130d9f2 100644 --- a/codec2-dev/src/freedv_api.c +++ b/codec2-dev/src/freedv_api.c @@ -911,7 +911,7 @@ void freedv_get_modem_stats(struct freedv *f, int *sync, float *snr_est) if (f->mode == FREEDV_MODE_1600) fdmdv_get_demod_stats(f->fdmdv, &f->stats); #ifndef CORTEX_M4 - if (f->mode == FREEDV_MODE_700) + if ((f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B)) cohpsk_get_demod_stats(f->cohpsk, &f->stats); #endif if (sync) *sync = f->stats.sync; @@ -973,7 +973,14 @@ int freedv_get_sz_error_pattern (struct freedv *f) {return f->sz_erro struct CODEC2 *freedv_get_codec2 (struct freedv *f){return f->codec2;} void freedv_get_modem_extended_stats(struct freedv *f, struct MODEM_STATS *stats) - { memcpy(stats, &f->stats, sizeof(struct MODEM_STATS)); } +{ + if (f->mode == FREEDV_MODE_1600) + fdmdv_get_demod_stats(f->fdmdv, stats); +#ifndef CORTEX_M4 + if ((f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B)) + cohpsk_get_demod_stats(f->cohpsk, stats); +#endif +} /*-- Functions below this line are private, and not meant for public use --*/ /*---------------------------------------------------------------------------*\ diff --git a/codec2-dev/src/freedv_rx.c b/codec2-dev/src/freedv_rx.c index a577fcde..80c17d22 100644 --- a/codec2-dev/src/freedv_rx.c +++ b/codec2-dev/src/freedv_rx.c @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) { freedv = freedv_open(mode); assert(freedv != NULL); - if ( (argc > 3) && (strcmp(argv[4], "--testframes") == 0) ) { + if ( (argc > 4) && (strcmp(argv[4], "--testframes") == 0) ) { freedv_set_test_frames(freedv, 1); } freedv_set_snr_squelch_thresh(freedv, -100.0);