Code Monkey home page Code Monkey logo

mylive's Issues

性能优化

synchronize 没啥必要,去掉后延时降到了1秒左右;unpooldriectbuf内存优化计还有一定空间,测试环境
OBS studio

test
1713882079618

RTMP 請教

您好,目前我自己也想實作一個 RTMP 直播 server,但苦於看不太懂 RTMP Specification,現在只實作完成 handshake 的部分。
您只留下了 QQ 群的聯絡方式,但在我在台灣 創 QQ 帳號不成功,希望能透過信件聯絡,如果 email 您不想公開,且您願意交流的話再請您寄第一封信給我。

[email protected]

Handshakes

It appears you are not handling the handshake correctly.

Below is the correct method.
You are not verifying that the received handshake client sends s1 is correct and you are not sending back c1...

`

public static final int HANDSHAKE_LENGTH = 1536, VERSION_LENGTH = 1;

public static boolean startHandshake(InputStream in, OutputStream out)throws IOException {
    if(in.available() < HANDSHAKE_LENGTH+VERSION_LENGTH){
        return false;
    }

    in.read();

    //C0&1
    byte[] clientHandshake = new byte[HANDSHAKE_LENGTH];
    in.read(clientHandshake);

    //S0&1
    byte[] serverHandshake = new byte[HANDSHAKE_LENGTH];
    serverHandshake[0] = ((byte) (0xff & (0 >> 24)));
    serverHandshake[1] = ((byte) (0xff & (0 >> 16)));
    serverHandshake[2] = ((byte) (0xff & (0 >> 8)));
    serverHandshake[3] = ((byte) (0xff & 0));

    serverHandshake[4] = ((byte) (0xff & (0 >> 24)));
    serverHandshake[5] = ((byte) (0xff & (0 >> 16)));
    serverHandshake[6] = ((byte) (0xff & (0 >> 8)));
    serverHandshake[7] = ((byte) (0xff & 0));

    byte[] random = generateRandomData(HANDSHAKE_LENGTH-8);
    System.arraycopy(random, 0, serverHandshake, 8, random.length);

    out.write(0x03);
    out.write(serverHandshake);
    out.write(clientHandshake);

    byte[] s1 = new byte[HANDSHAKE_LENGTH];
    in.read(s1);

    if(!Arrays.equals(serverHandshake, s1)){
        return false;
    }

    return true;
}

public static byte[] generateRandomData(int size){
    Random random = new Random();

    byte[] bytes = new byte[size];
    random.nextBytes(bytes);

    return bytes;
}
`

Hi, how to test it?

Hi 兄弟, 对你些的东西很感兴趣,这个实时推流直播要如何测试,能有一个推流的测试类吗? 请赐教。

延迟比较高

首先,非常感谢作者开源的项目,给了我很大的启发。

在这里,想向作者请教一个问题:

我使用OBS推流,然后VLC播放推上去的流,对比测试了MyLive与nginx-http-flv-modulepingos,发现MyLive的延迟比较高,约在10s以上,而nginx-http-flv-module和pingos在没有开启GOP缓存的模式下延迟约3s,开启后约5秒

请问作者知道这个吗,要降低这个延迟的话,有什么思路吗?

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.