Hi.
I'm trying to play streams from network and I faced with strange
trouble that limits me with only one stream at a time. I have several
threads in my application. Each thread doing something like that:
loking mutex;
av_register_all();
AVProbeData pd;
pd.filename = url;
pd.buf = streamBuf_;
pd.buf_size = streamBufSize_;
readFromStream(_to_buffer_);
AVInputFormat* avif = av_probe_input_format(&pd, 1);
avif->flags |= AVFTM_NOFILE;
init_put_byte(&ByteIOCtx_, streamBuf_, streamBufSize_, 0, this,
readFromStream, NULL, NULL);
av_open_input_stream(&avFormatContext_, &ByteIOCtx_, "", avif, NULL);
av_find_stream_info(avFormatContext_);
dump_format(avFormatContext_, 0, url.c_str(), false);
avcodec_find_decoder(...);
unlocking mutex;
For each thread streamBuf_, avFormatContext_ and ByteIOCtx_ are
unique, so I don't think that problem is in sharing data between
threads. Buf, currently only one of stream can be opened, other one
always fail at av_probe_input_format, av_open_input_stream or
avcodec_find_decoder. It fails because on one of this steps input format
is detected incorrectly.
Both stream are almost identical and both can be played just fine if I
run them separately. If I replace code before av_find_stream_info with
av_open_input_file to play data from file it works just file and I can
play multiple files in parallel.
I was trying to dump data that it returning to libav to file and then
it plays just fine with ffplay. So, I'm pretty sure that my function
works fine and there is some problem with stream detection if libav. I
tried to locate this problem, but have no luck nor have luck with
google. The only one similar problem I can find described here
https://trac.videolan.org/vlc/ticket/1022 but there is no information
about how it was resolved.
I'm confused and I'll appreciate for any help.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user