Changeset 705 for pjproject/trunk


Ignore:
Timestamp:
Sep 11, 2006 10:56:26 PM (18 years ago)
Author:
bennylp
Message:

Fixed bug in media UDP transport: when transport is created with create(), no IP address is given. This caused get_info() to return 0.0.0.0 as the transport address.

File:
1 edited

Legend:

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

    r637 r705  
    1818 */ 
    1919#include <pjmedia/transport_udp.h> 
     20#include <pj/addr_resolv.h> 
    2021#include <pj/assert.h> 
    2122#include <pj/errno.h> 
     
    243244    tp->rtcp_addr_name = si->rtcp_addr_name; 
    244245 
     246    /* If address is 0.0.0.0, use host's IP address */ 
     247    if (tp->rtp_addr_name.sin_addr.s_addr == 0) { 
     248        pj_hostent he; 
     249        const pj_str_t *hostname = pj_gethostname(); 
     250        status = pj_gethostbyname(hostname, &he); 
     251        if (status != PJ_SUCCESS) { 
     252            goto on_error; 
     253        } 
     254        tp->rtp_addr_name.sin_addr = *(pj_in_addr*)he.h_addr; 
     255    } 
     256 
     257    /* Same with RTCP */ 
     258    if (tp->rtcp_addr_name.sin_addr.s_addr == 0) { 
     259        tp->rtcp_addr_name.sin_addr.s_addr = tp->rtp_addr_name.sin_addr.s_addr; 
     260    } 
    245261 
    246262    /* Setup RTP socket with the ioqueue */ 
Note: See TracChangeset for help on using the changeset viewer.