Ignore:
Timestamp:
May 9, 2019 7:24:57 AM (5 years ago)
Author:
nanang
Message:

Re #1298: Updated PJMEDIA* to use PJ_ERROR consistently.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/stream.c

    r5968 r5982  
    3939#define THIS_FILE                       "stream.c" 
    4040#define ERRLEVEL                        1 
    41 #define LOGERR_(expr)                   stream_perror expr 
     41#define LOGERR_(expr)                   PJ_PERROR(4,expr); 
    4242#define TRC_(expr)                      PJ_LOG(5,expr) 
    4343 
     
    269269static pj_int16_t zero_frame[2 * 30 * 16000 / 1000]; 
    270270 
    271 /* 
    272  * Print error. 
    273  */ 
    274 static void stream_perror(const char *sender, const char *title, 
    275                           pj_status_t status) 
    276 { 
    277     char errmsg[PJ_ERR_MSG_SIZE]; 
    278  
    279     pj_strerror(status, errmsg, sizeof(errmsg)); 
    280     PJ_LOG(4,(sender, "%s: %s [err:%d]", title, errmsg, status)); 
    281 } 
    282271 
    283272static void on_rx_rtcp( void *data, 
     
    749738                                           &frame_out); 
    750739            if (status != 0) { 
    751                 LOGERR_((port->info.name.ptr, "codec decode() error", 
    752                          status)); 
     740                LOGERR_((port->info.name.ptr, status, 
     741                         "codec decode() error")); 
    753742 
    754743                if (use_dec_buf) { 
     
    862851                                           0, frame); 
    863852            if (status != PJ_SUCCESS) { 
    864                 LOGERR_((port->info.name.ptr, "codec decode() error", 
    865                          status)); 
     853                LOGERR_((port->info.name.ptr, status, 
     854                         "codec decode() error")); 
    866855                pjmedia_frame_ext_append_subframe(f, NULL, 0, 
    867856                                            (pj_uint16_t)samples_per_frame); 
     
    13971386                                       &frame_out); 
    13981387        if (status != PJ_SUCCESS) { 
    1399             LOGERR_((stream->port.info.name.ptr, 
    1400                     "Codec encode() error", status)); 
     1388            LOGERR_((stream->port.info.name.ptr, status, 
     1389                    "Codec encode() error")); 
    14011390            return status; 
    14021391        } 
     
    14211410                                       &frame_out); 
    14221411        if (status != PJ_SUCCESS) { 
    1423             LOGERR_((stream->port.info.name.ptr, 
    1424                     "Codec encode() error", status)); 
     1412            LOGERR_((stream->port.info.name.ptr, status, 
     1413                    "Codec encode() error")); 
    14251414            return status; 
    14261415        } 
     
    14451434 
    14461435    if (status != PJ_SUCCESS) { 
    1447         LOGERR_((stream->port.info.name.ptr, 
    1448                 "RTP encode_rtp() error", status)); 
     1436        LOGERR_((stream->port.info.name.ptr, status, 
     1437                "RTP encode_rtp() error")); 
    14491438        return status; 
    14501439    } 
     
    17761765                                    &hdr, &payload, &payloadlen); 
    17771766    if (status != PJ_SUCCESS) { 
    1778         LOGERR_((stream->port.info.name.ptr, "RTP decode error", status)); 
     1767        LOGERR_((stream->port.info.name.ptr, status, "RTP decode error")); 
    17791768        stream->rtcp.stat.rx.discard++; 
    17801769        return; 
     
    19311920                                     payloadlen, &ts, &count, frames); 
    19321921        if (status != PJ_SUCCESS) { 
    1933             LOGERR_((stream->port.info.name.ptr, 
    1934                      "Codec parse() error", 
    1935                      status)); 
     1922            LOGERR_((stream->port.info.name.ptr, status, 
     1923                     "Codec parse() error")); 
    19361924            count = 0; 
    19371925        } else if (stream->detect_ptime_change && 
     
    20592047 
    20602048    if (status != 0) { 
    2061         LOGERR_((stream->port.info.name.ptr, "Jitter buffer put() error", 
    2062                 status)); 
     2049        LOGERR_((stream->port.info.name.ptr, status, 
     2050                 "Jitter buffer put() error")); 
    20632051        pkt_discarded = PJ_TRUE; 
    20642052        goto on_return; 
     
    21222110    if (bytes_read < 0) { 
    21232111        if (bytes_read != -PJ_STATUS_FROM_OS(OSERR_EWOULDBLOCK)) { 
    2124             LOGERR_((stream->port.info.name.ptr, "RTCP recv() error", 
    2125                     (pj_status_t)-bytes_read)); 
     2112            LOGERR_((stream->port.info.name.ptr, (pj_status_t)-bytes_read, 
     2113                     "RTCP recv() error")); 
    21262114        } 
    21272115        return; 
     
    27792767                         TRACE_JB_PATH_PREFIX "%s.csv", 
    27802768                         stream->port.info.name.ptr); 
    2781         status = pj_file_open(pool, trace_name, PJ_O_WRONLY, &stream->trace_jb_fd); 
     2769        status = pj_file_open(pool, trace_name, PJ_O_WRONLY, 
     2770                              &stream->trace_jb_fd); 
    27822771        if (status != PJ_SUCCESS) { 
    27832772            stream->trace_jb_fd = TRACE_JB_INVALID_FD; 
    2784             PJ_LOG(3,(THIS_FILE, "Failed creating RTP trace file '%s'", 
    2785                       trace_name)); 
     2773            PJ_PERROR(3,(THIS_FILE, status, 
     2774                         "Failed creating RTP trace file '%s'", trace_name)); 
    27862775        } else { 
    27872776            stream->trace_jb_buf = (char*)pj_pool_alloc(pool, PJ_LOG_MAX_SIZE); 
Note: See TracChangeset for help on using the changeset viewer.