Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.34k stars 10.74k forks source link

Invalid data found when processing input #1235

Closed mengyanshou closed 1 year ago

mengyanshou commented 4 years ago

i want refactoring this client use Flutter,but i have some problem. some trouble when i use ffmpeg decoding the video from socket.

    SocketConnection *socketConnection;
    LOGD("正在连接");
    socketConnection = new SocketConnection();
    if (!socketConnection->connect_server()) {
        return;
    }
    //连接成功。
    LOGD("连接成功");
    uint8_t size[1];
    socketConnection->recv_from_(reinterpret_cast<uint8_t *>(size), 1);
    LOGD("接收字符===========>%d",size[0]);
    avformat_network_init();
    AVFormatContext *formatContext = avformat_alloc_context();
    unsigned char *buffer = static_cast<unsigned char *>(av_malloc(BUF_SIZE));
    AVIOContext *avio_ctx = avio_alloc_context(buffer, BUF_SIZE,
                                               0, socketConnection,
                                               read_socket_buffer, NULL,
                                               NULL);
    formatContext->pb = avio_ctx;
    int ret = avformat_open_input(&formatContext, NULL, NULL, NULL);
    if (ret < 0) {
        LOGD("avformat_open_input error ==>%s\n", av_err2str(ret));
        return ;
    }

and it always has error :avformat_open_input error==>Invalid data found when processing input i had read the server code and client code, this is started args

adb shell 'CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.12.1 0 8000000 0 true - false true

Can you give me some help,thanks

PrincEddy commented 4 years ago

i want refactoring this client use Flutter,but i have some problem. some trouble when i use ffmpeg decoding the video from socket.

    SocketConnection *socketConnection;
    LOGD("正在连接");
    socketConnection = new SocketConnection();
    if (!socketConnection->connect_server()) {
        return;
    }
    //连接成功。
    LOGD("连接成功");
    uint8_t size[1];
    socketConnection->recv_from_(reinterpret_cast<uint8_t *>(size), 1);
    LOGD("接收字符===========>%d",size[0]);
    avformat_network_init();
    AVFormatContext *formatContext = avformat_alloc_context();
    unsigned char *buffer = static_cast<unsigned char *>(av_malloc(BUF_SIZE));
    AVIOContext *avio_ctx = avio_alloc_context(buffer, BUF_SIZE,
                                               0, socketConnection,
                                               read_socket_buffer, NULL,
                                               NULL);
    formatContext->pb = avio_ctx;
    int ret = avformat_open_input(&formatContext, NULL, NULL, NULL);
    if (ret < 0) {
        LOGD("avformat_open_input error ==>%s\n", av_err2str(ret));
        return ;
    }

and it always has error :avformat_open_input error==>Invalid data found when processing input i had read the server code and client code, this is started args

adb shell 'CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.12.1 0 8000000 0 true - false true

Can you give me some help,thanks

Hello, I want to recreate the client with flutter also. do you use some plugins or you are using platform channel to communicate with the android side. can you help me to start the development. if its an open source we can help each other.

mengyanshou commented 4 years ago

thank you for you replay,and i also want do that,rebuild this client of scrcpy use Flutter,and I tried for a long time,Here are three more of my notes on this, https://juejin.im/post/5e74268fe51d452704118c4c https://juejin.im/post/5e788f045188255e1667a38e https://juejin.im/post/5e8322936fb9a03c6f66ea91 i hava two big problem

PrincEddy commented 4 years ago

okay thank you very much. i will check your posts. and if I manage to solve some problems I will contact you.

mengyanshou commented 4 years ago

As you know,I have initially transplanted scrcpy to the end of Flutter,but just on android,and I had used client which code by mine(It didn't do very well) I am now ready to transplant scrcpy client completely to the Flutter,and i am so bad at c/cpp launage compile,i want compile this client through CMakelist,so that i can migrate it to my android project. This is my plan: