Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start rtsp only in tcp mode #26

Closed
tulkas85 opened this issue May 29, 2014 · 20 comments
Closed

start rtsp only in tcp mode #26

tulkas85 opened this issue May 29, 2014 · 20 comments

Comments

@tulkas85
Copy link

Hi, How can I force MediaPlayer to prepare video only using Tcp ?
Sometimes udp stream does not pass through 3G connections

thanks

@bbcallen
Copy link
Contributor

http://www.ffmpeg.org/ffmpeg-protocols.html

‘rtsp_transport’
Set RTSP trasport protocols.

It accepts the following values:

‘udp’
Use UDP as lower transport protocol.

@tulkas85
Copy link
Author

tulkas85 commented Jun 3, 2014

thank you, but I don't know how can I set this property.
I try with below code in ijkMediaPlayer but doesn't works.

@Override
    public void start() throws IllegalStateException {
        stayAwake(true);
        setAvFormatOption("rtsp_transport", "tcp");
        _start();
    }

@tulkas85
Copy link
Author

tulkas85 commented Jun 3, 2014

I try this and works.
In your opinion, is the right way to do it?

 @Override
    public void setDataSource(String path) throws IOException,
            IllegalArgumentException, SecurityException, IllegalStateException {
        mDataSource = path;
        _setDataSource(path, null, null);
        setAvFormatOption("rtsp_transport", "tcp");
    }

@bbcallen
Copy link
Contributor

bbcallen commented Jun 3, 2014

Most options should be set before the call to prepareAsync().

@tulkas85
Copy link
Author

tulkas85 commented Jun 4, 2014

I see that using rtsp over tcp the video quality is poor, the player often goes in onInfo state and blocking, or ffmpeg's error occur

@tulkas85
Copy link
Author

tulkas85 commented Jun 5, 2014

how can I improve the stability of the connection via tcp?

@bbcallen
Copy link
Contributor

bbcallen commented Jun 6, 2014

Sorry, I don't known much about rtsp stuffs.
I suggest you to test ffplay directly.
If ffplay is OK, there must be something wrong in my ff_ffplay.c

@tulkas85
Copy link
Author

In other question you suggest me to change some constant for reduce delay (https://github.com/bbcallen/ijkplayer/issues/20) , maybe playing with these value could help ?

I don't know how run ffplay in android....

@tulkas85 tulkas85 reopened this Jun 11, 2014
@tulkas85
Copy link
Author

My problem with tcp is that player goes on Info state, this cause the stop of playback, what causes onInfo state ?

@bbcallen
Copy link
Contributor

I mean build/test/debug original ffplay on pc, It's much easier than in android.

@tulkas85
Copy link
Author

ok, thanks.
And what about onInfo state ?

I have two different behavior when onInfo state occurs.
1)
When source stream has audio enabled, I see buffering start and then stop. This causes playback pause and then restart with a jump of live stream. Why this buffering sometime happen ?

06-20 12:21:12.281: W/IJKMEDIA(8473): FFP_MSG_BUFFERING_START:
06-20 12:21:12.281: I/tv.danmaku.ijk.media.player.IjkMediaPlayer(8473): Info (701,0)
06-20 12:21:12.281: D/tv.danmaku.ijk.media.widget.VideoView(8473): onInfo: (701, 0)
06-20 12:21:12.281: D/tv.danmaku.ijk.media.widget.VideoView(8473): onInfo: (MEDIA_INFO_BUFFERING_START)
06-20 12:21:14.390: D/IJKMEDIA(8473): ffp_toggle_buffering_l: end
06-20 12:21:14.390: W/IJKMEDIA(8473): FFP_MSG_BUFFERING_END:
06-20 12:21:14.390: I/tv.danmaku.ijk.media.player.IjkMediaPlayer(8473): Info (702,0)
06-20 12:21:14.390: D/tv.danmaku.ijk.media.widget.VideoView(8473): onInfo: (702, 0)
06-20 12:21:14.390: D/tv.danmaku.ijk.media.widget.VideoView(8473): onInfo: (MEDIA_INFO_BUFFERING_END)
06-20 12:23:41.203: D/IJKMEDIA(8473): ffp_toggle_buffering_l: start
06-20 12:23:41.203: W/IJKMEDIA(8473): FFP_MSG_BUFFERING_START:

When audio is disabled I get that buffering starts but then remains stationary, the video is blocked and never restarts.

06-20 13:10:26.515: D/IJKMEDIA(10190): ffp_toggle_buffering_l: start
06-20 13:10:26.515: W/IJKMEDIA(10190): FFP_MSG_BUFFERING_START:
06-20 13:10:26.515: I/tv.danmaku.ijk.media.player.IjkMediaPlayer(10190): Info (701,0)
06-20 13:10:26.515: D/tv.danmaku.ijk.media.widget.VideoView(10190): onInfo: (701, 0)

@bbcallen
Copy link
Contributor

uncomment this macro in ff_ffplay.c, rebuild and see how buffer grows.

// #define FFP_SHOW_DEMUX_CACHE

@tulkas85
Copy link
Author

ok I tried it , but this only log cache information. Not solved problem of buffering_start and never ended when stream is without audio. You can see log in previous post of this case.
I can tell you that looking at the new log, after FFP_MSG_BUFFERING_START I see that buffer forever grows , but player is locked in onInfo state becouse it never exit from buffering

In all my test I'm using stable release, now I try with master version, I see that you made some commit for buffering last week

thanks

06-23 11:27:29.078: E/IJKMEDIA(7841): size cache=%169 (220478/131072)
06-23 11:27:29.312: E/IJKMEDIA(7841): size cache=%182 (237836/131072)
06-23 11:27:29.312: E/IJKMEDIA(7841): size cache=%183 (238380/131072)
06-23 11:27:29.539: E/IJKMEDIA(7841): size cache=%196 (256161/131072)
06-23 11:27:29.539: E/IJKMEDIA(7841): size cache=%197 (256696/131072)
06-23 11:27:29.789: E/IJKMEDIA(7841): size cache=%211 (274574/131072)
06-23 11:27:30.000: E/IJKMEDIA(7841): size cache=%210 (273981/131072)
06-23 11:27:30.007: E/IJKMEDIA(7841): size cache=%211 (274875/131072)
06-23 11:27:33.601: D/IJKMEDIA(7841): ffp_toggle_buffering_l: start
06-23 11:27:33.601: W/IJKMEDIA(7841): FFP_MSG_BUFFERING_START:
06-23 11:27:33.601: I/tv.danmaku.ijk.media.player.IjkMediaPlayer(7841): Info (701,0)
06-23 11:27:33.601: D/tv.danmaku.ijk.media.widget.VideoView(7841): onInfo: (701, 0)
06-23 11:27:33.601: D/tv.danmaku.ijk.media.widget.VideoView(7841): onInfo: (MEDIA_INFO_BUFFERING_START)
06-23 11:27:47.789: E/IJKMEDIA(7841): size cache=%13 (17498/131072)
06-23 11:27:48.085: E/IJKMEDIA(7841): size cache=%14 (17940/131072)
06-23 11:27:48.328: E/IJKMEDIA(7841): size cache=%27 (35779/131072)
06-23 11:27:48.523: E/IJKMEDIA(7841): size cache=%41 (53241/131072)
06-23 11:27:48.796: E/IJKMEDIA(7841): size cache=%55 (71547/131072)
06-23 11:27:49.023: E/IJKMEDIA(7841): size cache=%68 (88877/131072)
06-23 11:27:49.023: E/IJKMEDIA(7841): size cache=%69 (89392/131072)
06-23 11:27:49.281: E/IJKMEDIA(7841): size cache=%82 (106989/131072)
06-23 11:27:49.492: E/IJKMEDIA(7841): size cache=%95 (124266/131072)
06-23 11:27:49.492: E/IJKMEDIA(7841): size cache=%96 (124801/131072)
06-23 11:27:49.742: E/IJKMEDIA(7841): size cache=%109 (142354/131072)
06-23 11:27:49.953: E/IJKMEDIA(7841): size cache=%122 (159568/131072)
06-23 11:27:49.953: E/IJKMEDIA(7841): size cache=%123 (160209/131072)
06-23 11:27:50.179: E/IJKMEDIA(7841): size cache=%136 (177864/131072)
06-23 11:27:50.390: E/IJKMEDIA(7841): size cache=%150 (195063/131072)
06-23 11:27:50.609: E/IJKMEDIA(7841): size cache=%163 (212922/131072)
06-23 11:27:50.625: E/IJKMEDIA(7841): size cache=%164 (213378/131072)
06-23 11:27:50.851: E/IJKMEDIA(7841): size cache=%177 (231007/131072)
06-23 11:27:51.445: E/IJKMEDIA(7841): size cache=%190 (248230/131072)
06-23 11:27:51.445: E/IJKMEDIA(7841): size cache=%191 (248713/131072)
06-23 11:27:51.445: E/IJKMEDIA(7841): size cache=%204 (266267/131072)
06-23 11:27:51.726: E/IJKMEDIA(7841): size cache=%217 (283448/131072)
06-23 11:27:51.726: E/IJKMEDIA(7841): size cache=%218 (283936/131072)

@bbcallen
Copy link
Contributor

The buffering start/stop strategy based on valid AVPacket.duration, AVStream.time_base
Search hwm_in_bytes in ff_ffplay.c. The whole strategy is implemented in the do {...} while(0)

The most simple way is removing the whole do {...} while(0) and call ffp_toggle_buffering(ffp, 0);

if (is->audioq.size > SOME_REASONABLE_SIZE &&
    is->videoq.size > SOME_REASONABLE_SIZE) {
    ffp_toggle_buffering(ffp, 0);
}

@tulkas85
Copy link
Author

Ok thanks , meanwhile I tried not stable version (master on git) but doesn't work for me. The last working master-version I tried is in 12/06/2014.
Now I have this :

06-23 16:07:02.695: E/IJKMEDIA(15518): rtsp://192.168.30.200:554/axis-media/media.amp: Protocol not found
06-23 16:07:02.695: W/IJKMEDIA(15518): FFP_MSG_ERROR: 0
06-23 16:07:02.804: E/tv.danmaku.ijk.media.player.IjkMediaPlayer(15518): Error (-10000,0)
06-23 16:07:02.804: D/tv.danmaku.ijk.media.widget.VideoView(15518): Error: -10000, 0

@bbcallen
Copy link
Contributor

I have dropped rtsp support in latest master to reduce the size as small as I can.
You need to reenable them in /tools/ffmpeg-common-profiles.sh

@johnitvn
Copy link

johnitvn commented Aug 9, 2014

I'm can not find /tools/ffmpeg-common-profiles.sh
And I'm an error occurred same as tulkas85

06-23 16:07:02.804: E/tv.danmaku.ijk.media.player.IjkMediaPlayer(15518): Error (-10000,0)

I'm build with version 0.1.3

@bbcallen
Copy link
Contributor

/tools/ffmpeg-common-profiles.sh has been moved to config/module-lite.sh
https://github.com/bbcallen/ijkplayer/tree/master/config

@spaul13
Copy link

spaul13 commented Feb 19, 2018

@tulkas85 @bbcallen can anyone please tell me how to enable the RTSP streaming? I have a video on my server (strong desktop). I want to take that video and play it on my android phone using ijkmediaplayer.

@spaul13
Copy link

spaul13 commented Feb 19, 2018

@tulkas85 I am getting an error similar to you where it's showing my buffer gets full (100%) and after that, the video streaming on android stops. It does n't go far from 100%.

But I have noticed for your cache size is going >100 %, how you did that? and secondly how to resolve the issue where buffer gets full.

02-14 07:56:11.320 22174-22174/? D/EasyMovieTexture: OnBufferUpdate()
02-14 07:56:11.888 22174-22174/? I/System.out: I am in Media_buffering update, msg.arg174122 and buffer position 74122
02-14 07:56:11.888 22174-22174/? E/tv.danmaku.ijk.media.player.IjkMediaPlayer: Buffer (100%) 74122/14750

liuming2049 pushed a commit to liuming2049/ijkplayer that referenced this issue Apr 6, 2021
feat: support custom "pos-update-interval", min 10 ms, max 1000 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants