mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Quality reporting: fix unit test segfault in case of invalid mediastream pointer
This commit is contained in:
parent
de947f4403
commit
d4f2c4a099
2 changed files with 8 additions and 12 deletions
|
|
@ -28,14 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include <math.h>
|
||||
|
||||
/***************************************************************************
|
||||
* TODO / REMINDER LIST
|
||||
***************************************************************************
|
||||
- negative cum loss without duplications?
|
||||
***************************************************************************
|
||||
* END OF TODO / REMINDER LIST
|
||||
****************************************************************************/
|
||||
|
||||
#define STR_REASSIGN(dest, src) {\
|
||||
if (dest != NULL) \
|
||||
ms_free(dest); \
|
||||
|
|
|
|||
|
|
@ -26,11 +26,15 @@
|
|||
#define __strstr(x, y) ((x==NULL)?NULL:strstr(x,y))
|
||||
|
||||
void on_report_send_mandatory(const LinphoneCall *call, int stream_type, const LinphoneContent *content){
|
||||
const MediaStream * ms = ((stream_type == LINPHONE_CALL_STATS_AUDIO)?&call->audiostream->ms:&call->videostream->ms);
|
||||
char * body = (char *)content->data;
|
||||
char * remote_metrics_start = __strstr(body, "RemoteMetrics:");
|
||||
reporting_session_report_t * report = call->log->reporting.reports[stream_type];
|
||||
|
||||
MediaStream * ms;
|
||||
if (stream_type == LINPHONE_CALL_STATS_AUDIO){
|
||||
ms = (MediaStream*)call->audiostream;
|
||||
}else{
|
||||
ms = (MediaStream*)call->videostream;
|
||||
}
|
||||
CU_ASSERT_TRUE(
|
||||
__strstr(body, "VQIntervalReport\r\n") == body ||
|
||||
__strstr(body, "VQSessionReport\r\n") == body ||
|
||||
|
|
@ -66,7 +70,7 @@ void on_report_send_mandatory(const LinphoneCall *call, int stream_type, const L
|
|||
|
||||
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "DialogID:"));
|
||||
|
||||
if (report->remote_metrics.rtcp_sr_count&&ms->rc!=NULL){
|
||||
if (report->remote_metrics.rtcp_sr_count&&ms!=NULL&&ms->rc!=NULL){
|
||||
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "AdaptiveAlg:"));
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +82,7 @@ char * on_report_send_verify_metrics(const reporting_content_metrics_t *metrics,
|
|||
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:"));
|
||||
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:"));
|
||||
}
|
||||
if (metrics->rtcp_sr_count){
|
||||
if (metrics->rtcp_sr_count+metrics->rtcp_xr_count>0){
|
||||
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue