[vlc-devel] Strange behavior with stream_UrlNew()

Ron Crocker ron.crocker at nsn.com
Thu Aug 30 05:08:42 CEST 2012


Still new, but the last bit of advice was helpful so I thought I'd try 
again for a little more. I've made it to the point where I'm trying to 
load that JSON file I mentioned before. I've modified the HLS code to 
ask for this file prior to loading any of the media, since that's pretty 
close to what I want in the end. I'm asking for the file using 
stream_UrlNew(), and I'm struggling with it a bit.

Here's the code:

         msg_Dbg(s,"Loading JSON file from URL: %s",p_sys->abc_url);

         stream_t *p_ts = stream_UrlNew(s,p_sys->abc_url);

         if (!p_ts) {
             return VLC_EGENERIC;
         }
         
         uint64_t storedSize = stream_Size(p_ts);
         msg_Dbg(s," -- url returns %"PRIu64" bytes?",storedSize);

and here's the corresponding log output:

    stream_filter_abc stream debug: Loading JSON file from URL: http://localhost:80/~qa1007/cgi-bin/abc.cgi
    [0x10a5579a0] main stream debug: creating access 'http' location='localhost:80/~qa1007/cgi-bin/abc.cgi', path='(null)'
    [0x10a555f80] main access debug: looking for access module: 2 candidates
    [0x10a555f80] access_http access debug: http: server='localhost' port=80 file='/~qa1007/cgi-bin/abc.cgi'
    [0x10a555f80] main access debug: net: connecting to localhost port 80
    [0x10a555f80] main access debug: connection succeeded (socket = 17)
    [0x10a555f80] access_http access debug: protocol 'HTTP' answer code 200
    [0x10a555f80] access_http access debug: Server: Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r
    [0x10a555f80] access_http access debug: Connection: close
    [0x10a555f80] access_http access debug: Transfer-Encoding: chunked
    [0x10a555f80] access_http access debug: Content-Type: application/json
    [0x10a555f80] main access debug: using access module "access_http"
    [0x10a55c3e0] main stream debug: Using stream method for AStream*
    [0x10a55c3e0] main stream debug: starting pre-buffering
    [0x10a55c3e0] main stream debug: received first data after 0 ms
    [0x10a55c3e0] main stream debug: pre-buffering done 180 bytes in 0s - 621 KiB/s
    [0x10a5579a0] stream_filter_abc stream debug:  -- url returns 0 bytes?

I'm loading the URL (http://localhost:80/~qa1007/cgi-bin/abc.cgi) using 
stream_UrlNew(). It seems to access the URL correctly and occasionally 
it actually works. But here's an example where it doesn't seem to get 
the data into the stream buffer.

Any thoughts about what's going on? It seems to have received the data 
(180 bytes) but doesn't want to put it into the buffer, so when I ask 
the stream for it's size it thinks it's empty?

I'm definitely trying to do this synchronously, blocking the calling 
thread until the data arrives. That might not be the best approach, so 
if there's something I should do differently here (recommendations of 
"look at module XYZ" are welcome too) please share.

Thanks for your help!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120829/e71fb20a/attachment.html>


More information about the vlc-devel mailing list