Giter Club home page Giter Club logo

Comments (11)

bbcallen avatar bbcallen commented on May 20, 2024
  1. If you want to decrease them once and for all, just modify these macros in ff_ffplay_def.h
// buffer bytes
#define DEFAULT_HIGH_WATER_MARK_IN_BYTES    (128 * 1024)

// buffer duration, in milliseconds
#define DEFAULT_MAX_HIGH_WATER_MARK_IN_MS       (5 * 1000)

// buffer duration for the 1st time, in milliseconds
#define DEFAULT_FAST_HIGH_WATER_MARK_IN_MS      (100)
  1. if you want to set them from application, add these api
// see how ijkmp_set_overlay_format() does
ijkmp_set_high_water_mark()
ffp_set_high_water_mark()
  1. if you want to change them from application while streaming, multiple-thread issues would be concerned. I would prefer to implement dynamic strategy inside read_thread() in ff_ffplay.c

from ijkplayer.

rocxteady avatar rocxteady commented on May 20, 2024

#define DEFAULT_HIGH_WATER_MARK_IN_BYTES (8 * 1024)

#define DEFAULT_MAX_HIGH_WATER_MARK_IN_MS (0.25 * 1000)
#define DEFAULT_NORMAL_HIGH_WATER_MARK_IN_MS (0.1 * 1000)
#define DEFAULT_FAST_HIGH_WATER_MARK_IN_MS (100)

I set them like these. It is still around 5 seconds...

from ijkplayer.

bbcallen avatar bbcallen commented on May 20, 2024

Could you uncomment this line in ff_ffplay.c and paste some log?

// ff_ffplay.c
#define FFP_SHOW_DEMUX_CACHE

from ijkplayer.

rocxteady avatar rocxteady commented on May 20, 2024

audio cache=%1923 (4784/250)
time cache=%1923 (4784/250)
size cache=%489 (39847/8192)
audio cache=%1942 (4830/250)
time cache=%1942 (4830/250)
size cache=%494 (40230/8192)
audio cache=%1960 (4876/250)
time cache=%1960 (4876/250)
size cache=%498 (40603/8192)
audio cache=%1979 (4922/250)
time cache=%1979 (4922/250)
size cache=%503 (40990/8192)
audio cache=%1997 (4968/250)
time cache=%1997 (4968/250)
size cache=%508 (41382/8192)
audio cache=%2016 (5014/250)
time cache=%2016 (5014/250)
size cache=%512 (41761/8192)
audio cache=%2034 (5060/250)
time cache=%2034 (5060/250)
size cache=%517 (42141/8192)
audio cache=%2053 (5106/250)
time cache=%2053 (5106/250)
size cache=%522 (42525/8192)
audio cache=%2071 (5152/250)
time cache=%2071 (5152/250)
size cache=%526 (42904/8192)
audio cache=%2090 (5198/250)
time cache=%2090 (5198/250)
size cache=%531 (43291/8192)
audio cache=%2090 (5198/250)
audio cache=%2108 (5244/250)
time cache=%2108 (5244/250)
size cache=%536 (43680/8192)
audio cache=%2127 (5290/250)
time cache=%2127 (5290/250)
size cache=%541 (44079/8192)
audio cache=%2145 (5336/250)
time cache=%2145 (5336/250)
size cache=%545 (44459/8192)
audio cache=%2145 (5336/250)
audio cache=%2164 (5382/250)
time cache=%2164 (5382/250)
size cache=%550 (44830/8192)
audio cache=%1868 (4646/250)
time cache=%1868 (4646/250)
size cache=%472 (38511/8192)
audio cache=%1886 (4692/250)
time cache=%1886 (4692/250)
size cache=%477 (38889/8192)
audio cache=%1905 (4738/250)
time cache=%1905 (4738/250)
size cache=%482 (39269/8192)
audio cache=%1923 (4784/250)
time cache=%1923 (4784/250)
size cache=%487 (39656/8192)
audio cache=%1942 (4830/250)
time cache=%1942 (4830/250)
size cache=%491 (40038/8192)
audio cache=%1960 (4876/250)
time cache=%1960 (4876/250)
size cache=%496 (40419/8192)
audio cache=%1979 (4922/250)
time cache=%1979 (4922/250)
size cache=%501 (40800/8192)
audio cache=%1997 (4968/250)
time cache=%1997 (4968/250)
size cache=%505 (41182/8192)
audio cache=%2016 (5014/250)
time cache=%2016 (5014/250)
size cache=%510 (41566/8192)
audio cache=%2034 (5060/250)
time cache=%2034 (5060/250)
size cache=%515 (41953/8192)
audio cache=%2053 (5106/250)
time cache=%2053 (5106/250)
size cache=%519 (42333/8192)
audio cache=%2071 (5152/250)
time cache=%2071 (5152/250)
size cache=%524 (42714/8192)
audio cache=%2090 (5198/250)
time cache=%2090 (5198/250)
size cache=%529 (43098/8192)
audio cache=%2108 (5244/250)
time cache=%2108 (5244/250)
size cache=%533 (43479/8192)
audio cache=%2108 (5244/250)
size cache=%532 (43403/8192)
audio cache=%2127 (5290/250)
time cache=%2127 (5290/250)
size cache=%537 (43782/8192)
audio cache=%1905 (4738/250)
time cache=%1905 (4738/250)
size cache=%483 (39400/8192)
audio cache=%1923 (4784/250)
time cache=%1923 (4784/250)
size cache=%488 (39787/8192)
audio cache=%1942 (4830/250)
time cache=%1942 (4830/250)
size cache=%493 (40173/8192)
audio cache=%1960 (4876/250)
time cache=%1960 (4876/250)
size cache=%498 (40573/8192)
audio cache=%1720 (4278/250)
time cache=%1720 (4278/250)
size cache=%438 (35709/8192)
audio cache=%1738 (4324/250)
time cache=%1738 (4324/250)
size cache=%442 (36063/8192)
audio cache=%1757 (4370/250)
time cache=%1757 (4370/250)
size cache=%447 (36432/8192)
audio cache=%1775 (4416/250)
time cache=%1775 (4416/250)
size cache=%451 (36802/8192)
audio cache=%1794 (4462/250)
time cache=%1794 (4462/250)
size cache=%456 (37171/8192)
audio cache=%1812 (4508/250)
time cache=%1812 (4508/250)
size cache=%460 (37533/8192)
audio cache=%1720 (4278/250)
time cache=%1720 (4278/250)
size cache=%437 (35619/8192)
audio cache=%1738 (4324/250)
time cache=%1738 (4324/250)
size cache=%442 (36003/8192)
audio cache=%1757 (4370/250)
time cache=%1757 (4370/250)
size cache=%446 (36385/8192)
audio cache=%1775 (4416/250)
time cache=%1775 (4416/250)
size cache=%451 (36765/8192)
audio cache=%1794 (4462/250)
time cache=%1794 (4462/250)
size cache=%456 (37157/8192)
audio cache=%1812 (4508/250)
time cache=%1812 (4508/250)
size cache=%461 (37543/8192)
audio cache=%1831 (4554/250)
time cache=%1831 (4554/250)
size cache=%465 (37921/8192)
audio cache=%1849 (4600/250)
time cache=%1849 (4600/250)
size cache=%470 (38305/8192)
audio cache=%1868 (4646/250)

from ijkplayer.

bbcallen avatar bbcallen commented on May 20, 2024

The DEFAULT_MAX_HIGH_WATER_MARK_IN_MS means the least buffer to resume.
Player only resume from "stalled buffering" when pre-read data above this size.
It effect the player start delay.

If you mean the max pre-reading size, I think it should be

// Player does pre-reading only below this size, in bytes
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)

// MIN_FRAMES=5 in original ffplay,  packets/frames in pre-reading queue.
#define MIN_FRAMES 50000

Which one did you mean when you mention ''5 seconds"?
Do you want to reduce the delay of the start, or reduce the pre-reading size?

from ijkplayer.

rocxteady avatar rocxteady commented on May 20, 2024

When I change stream on the server, in the app I see the change 5 seconds later. Then I decided to decrease the buffersize.

from ijkplayer.

bbcallen avatar bbcallen commented on May 20, 2024

Then you should reduce MIN_FRAMES or/and MAX_QUEUE_SIZE

from ijkplayer.

ened avatar ened commented on May 20, 2024

@bbcallen:

Does this API:

if you want to set them from application, add these api
// see how ijkmp_set_overlay_format() does
ijkmp_set_high_water_mark()
ffp_set_high_water_mark()

still exist?

from ijkplayer.

developeralp avatar developeralp commented on May 20, 2024

@ened

You can ,

                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "max-buffer-size", 1024*1024);
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", 0);
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "min-frames",5);
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "first-high-water-mark-ms",100);
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "next-high-water-mark-ms",100);

On IjkVideoView.

Also , you can learn variables from ,

https://github.com/Bilibili/ijkplayer/blob/master/ijkmedia/ijkplayer/ff_ffplay_def.h
https://github.com/Bilibili/ijkplayer/blob/master/ijkmedia/ijkplayer/ff_ffplay_options.h#L110

from ijkplayer.

ened avatar ened commented on May 20, 2024

HI @developeralp ,

Thank you!

I was using this before:

        opts.setPlayerOptionIntValue(5 * 1000, forKey: "first-high-water-mark-ms")
        opts.setPlayerOptionIntValue(50 * 1000, forKey: "next-high-water-mark-ms")
        opts.setPlayerOptionIntValue(100 * 1000, forKey: "last-high-water-mark-ms")
        opts.setPlayerOptionIntValue(10000, forKey: "min-frames")
        opts.setPlayerOptionIntValue((128 * 1024 * 1024), forKey: "max-buffer-size")

Will re-evaluate today, as it did not seem to work.

Why did you set ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", 0); ?

from ijkplayer.

spaul13 avatar spaul13 commented on May 20, 2024

can anyone, @rocxteady , @bbcallen @ened @developeralp @tewilove please tell me how to change the size of the video buffer? what's the size of video buffer by default?

from where it's calling the buffer to write into it and who takes the data out of the buffer?

I am getting an error
E/tv.danmaku.ijk.media.player.IjkMediaPlayer: Buffer (100%) 26468/14750

I have seen ijkfifobuffer is implemented but I want to know where the buffer is written actually? I have seen an array based contiguous allocation.

from ijkplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.