bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.46k stars 8.12k forks source link

Wrong video output in RTSP connection with different ports #4308

Open PineapplePie opened 6 years ago

PineapplePie commented 6 years ago

I have a strange issue. Steps to reproduce: 1) Connect to rtsp with url like "rtsp://user:pass@[ip][:port]". 2) Release, set to null IjkMediaPlayer object and remove a parent view, which contains my TextureView. 3) After reinitializing view and IjkMediaPlayer object set the same url, but with another port. In logcat I see, that I've passed the correct url, but the video output is wrong - I have the previous video, not the new one. In other players like VLC with these links I get the correct data. And no matter how much times I'll reconnect, it still shows me the video from first link I've set.

Does anybody face the similar problem?

PineapplePie commented 6 years ago

@raymond1012 or maybe somebody, who had worked on this project?

PineapplePie commented 6 years ago

I've recompiled from version 0.8.8 to 0.8.0 - all works perfectly, but I want the latest release

rafalmodrzynski commented 6 years ago

The same problem

rafalmodrzynski commented 6 years ago

Problem is in libavutil/tcp.c and dns_cache.c

int add_dns_cache_entry(char hostname, struct addrinfo cur_ai, int64_t timeout)

I disabled cache and works. if (!dns_entry) { -> if (1) {

zainali84 commented 5 years ago

I am facing same problem. I am playing multiple rtsp streams with same ip and different ports but getting same output on all players. I tried playing on vlc and it works fine on vlc. simulator screen shot - iphone 6 - 2018-10-28 at 18 23 40

yourchanges commented 5 years ago

patch : https://patchwork.ffmpeg.org/patch/10543/mbox/

374601404 commented 5 years ago

@yourchanges Thanks! And the same problem I came in had been resolved.

JPhillipsCamcloud commented 4 years ago

@rafalmodrzynski we have come across an issue with the cached dns system that was added inside ffmpeg as well, we want to disable it. I looked at your comment above and you disable it somehow. i have the ffmpeg code infront of me. What exactly do i have to change inside tcp.c, and do i also have to change something inside dns_cache.c? Thank you.

rafalmodrzynski commented 4 years ago

I don't remember exactly, but finally we don't need anything changed in ffmpeg. Let's try with: IJK_FFMPEG_COMMIT=ff4.0--ijk0.8.25--20190531--001 or IJK_FFMPEG_COMMIT=ff4.0--ijk0.8.25--20180724--001 or IJK_FFMPEG_COMMIT=ff3.4--ijk0.8.7--20180612--001

and ijkplayer commit SHA1cced91e3ae3730f5c63f3605b00d25eafcf5b97b [k0.8.8]

374601404 commented 4 years ago

@rafalmodrzynski we have come across an issue with the cached dns system that was added inside ffmpeg as well, we want to disable it. I looked at your comment above and you disable it somehow. i have the ffmpeg code infront of me. What exactly do i have to change inside tcp.c, and do i also have to change something inside dns_cache.c? Thank you.

while ijk work in ipv6,the dns cache will return the wrong cached IP address,so we can unable the dns cache,in tcp.c tcp_open(URLContext h, const char uri, int flags),find "get_dns_cache_reference(hostname, portstr)" and comment out that line.Or we can also fix the ipv6 cached bug.