Comments (20)
I have tested publishing overnight.
- Does it happen each time?
- What is the exception thrown?
- Is your networking all right?
from yasea.
It happen each time
The network is normal
Sorry, I forget to see the exception
from yasea.
Enough, if it happens each time, the exception might well be EPIPE
. I have got it.
from yasea.
What I can do to avoid the this exception.
In other places I have seen this exception,and the most people say it's it's caused by and extend the timestamp。
from yasea.
Nothing but re-connection since it is the Nginx-RTMP that closes the socket. Today I will verify it on Nginx-RTMP.
from yasea.
Ah, I see. This article illustrates the reason.
ngx_rtmp_recv(ngx_event_t *rev)
{
for( ;; ) {
/* parse headers */
if (b->pos == b->start) {
/* chunk basic header */
fmt = (*p >> 6) & 0x03;
csid = *p++ & 0x3f;
if (fmt <= 2 ) {
/* timestamp: big-endian 3b -> little-endian 4b */
pp = (u_char*)timestamp;
ext = (timestamp == 0x00ffffff);
if (fmt <= 1) {
/* size: big-endian 3b -> little-endian 4b type*/
pp = (u_char*)&h->mlen;
h->type = *(uint8_t*)p++;
if (fmt == 0) {
/* stream: little-endian 4b -> little-endian 4b */
pp = (u_char*)&h->msid;
}
}
}
/* extended header */
if (ext) {
pp = (u_char*)timestamp;
pp[3] = *p++;
pp[2] = *p++;
pp[1] = *p++;
pp[0] = *p++;
}
In ngx_rtmp_recv
function, once Nginx-RTMP receives extended time stamp in chunk type less than 3, then it will always parses extended time stamp in the subsequent packets whatever the chunk type is.
from yasea.
Try 9e35f22 please.
from yasea.
I get the latest code, find a new exception : java.net.UnknownHostException: Host is unresolved
It happened before.
from yasea.
That is your URL or networking issue.
from yasea.
But I use the old code can push stream.
from yasea.
Are you sure? I downloaded and tried just now you were saying.
from yasea.
Sorry, Should be a network problem. Just in time is a coincidence
from yasea.
It seem still have the same problem
And I will test again.
from yasea.
Maybe you can refer to this blog librtmp 时间戳
from yasea.
A rapid reappearance approach is adding code in rtmp/io/WriteThread.java
. It can help find the bug though no solution occurs to me currently.
while (!writeQueue.isEmpty()) {
RtmpPacket rtmpPacket = writeQueue.poll();
ChunkStreamInfo chunkStreamInfo = rtmpSessionInfo.getChunkStreamInfo(rtmpPacket.getHeader().getChunkStreamId());
chunkStreamInfo.setPrevHeaderTx(rtmpPacket.getHeader());
if (rtmpPacket instanceof Video || rtmpPacket instanceof Audio) {
rtmpPacket.getHeader().setAbsoluteTimestamp((int) chunkStreamInfo.markAbsoluteTimestampTx() + 0xffffff);
} else {
rtmpPacket.getHeader().setAbsoluteTimestamp((int) chunkStreamInfo.markAbsoluteTimestampTx());
}
rtmpPacket.writeTo(out, rtmpSessionInfo.getTxChunkSize(), chunkStreamInfo);
Log.d(TAG, "WriteThread: wrote packet: " + rtmpPacket + ", size: " + rtmpPacket.getHeader().getPacketLength());
if (rtmpPacket instanceof Command) {
rtmpSessionInfo.addInvokedCommand(((Command) rtmpPacket).getTransactionId(), ((Command) rtmpPacket).getCommandName());
}
if (rtmpPacket instanceof Video) {
publisher.getVideoFrameCacheNumber().getAndDecrement();
calcFps();
}
}
out.flush();
from yasea.
Final patch on this issue: 5ee43c6
from yasea.
I did the test Yesterday night,and It seem still exist
from yasea.
Stream disconnect after 10 hours.
from yasea.
Can I catch the exception and reconnect.
from yasea.
10 hours? That might not be extended time stamp. Maybe the video cache number is full and your network is weak? You may do it yourself.
from yasea.
Related Issues (20)
- How to introduce it in Android Studio? HOT 1
- Can we use .acv file in filter? HOT 1
- Add APK to releases HOT 1
- 请问如何获取camera的流(帧)呢? HOT 1
- 请问如何无预览推流呢?
- 推屏幕 HOT 1
- 测试低带宽出现Network weak HOT 2
- 如何支持RTMPS HOT 4
- 小屏幕推流导致拉流清晰度低 HOT 6
- 推流成功几分钟后就闪退
- 空指针异常 HOT 3
- Error in decoding the stream when using Hardware Encoder HOT 2
- 华为meat40 pro中切换摄像头报错
- 安卓11和12框架使用问题
- Heavy pixelated video
- 推流界面处于onpause状态时怎么让摄像头继续采集数据 HOT 1
- Is Streaming possible over 5G? HOT 1
- Video streaming paused when screen locked HOT 1
- 收音问题 HOT 7
- 推流的视频很糊 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yasea.