PHZ76/rtmp

Error writing trailer of rtmp://127.0.0.1/live/stream: Connection reset by peer

deansay opened this issue · 3 comments

ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, h264, from 'test.h264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
Press [q] to stop, [?] for help
Output #0, flv, to 'rtmp://127.0.0.1/live/stream':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 1280x720, q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 flv
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
av_interleaved_write_frame(): Connection reset by peer
[flv @ 0x5618c42ad2c0] Failed to update header with correct duration.
[flv @ 0x5618c42ad2c0] Failed to update header with correct filesize.

Error writing trailer of rtmp://127.0.0.1/live/stream: Connection reset by peer

frame= 2 fps=0.0 q=2.0 Lsize= 155kB time=00:00:00.04 bitrate=30912.4kbits/s speed=0.107x
video:168kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
dean@dean:~/workspace/s32v/rtmp-push$

auto& rtmpMsg = m_rtmpMsgs[csid];
rtmpMsg.csid = csid;

if (headerLen >= 7) // type 1
{
uint32_t length = readUint24BE((char*)header.length);
//if(length > 60000) the length is more then 65291???
if(length > 80000)
{
printf("heer error.+179 length %d\n", length);
return false;
}

        if(rtmpMsg.length != length)
        {                
            rtmpMsg.length = length;
            rtmpMsg.data.reset(new char[rtmpMsg.length]);   
        }            
        rtmpMsg.index = 0;
        rtmpMsg.typeId = header.typeId;

}

PHZ76 commented

谢谢你,已修复。

sorry, I can't understand how you solve it. Could u explain it more specifically?