|
@@ -36,6 +36,7 @@ class FfmpegOutputer {
|
|
|
}
|
|
|
|
|
|
int output_initialize(){
|
|
|
+ std::cout<<"init. "<<std::endl;
|
|
|
int ret = 0;
|
|
|
if (!(m_ofmt_ctx->oformat->flags & AVFMT_NOFILE)) {
|
|
|
ret = avio_open(&m_ofmt_ctx->pb, m_url.c_str(), AVIO_FLAG_WRITE);
|
|
@@ -64,6 +65,8 @@ class FfmpegOutputer {
|
|
|
}
|
|
|
|
|
|
m_output_state = SERVICE;
|
|
|
+ std::cout<<"init "<<m_url<<" ok.service."<<std::endl;
|
|
|
+ m_list_packets.clear();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -71,7 +74,7 @@ class FfmpegOutputer {
|
|
|
int ret = 0;
|
|
|
if(m_list_packets.size() == 0)
|
|
|
{
|
|
|
- std::this_thread::sleep_for(std::chrono::microseconds(100));
|
|
|
+ std::this_thread::sleep_for(std::chrono::microseconds(3000));
|
|
|
return;
|
|
|
}
|
|
|
while(m_list_packets.size() > 0) {
|
|
@@ -85,8 +88,14 @@ class FfmpegOutputer {
|
|
|
m_output_state = DOWN;
|
|
|
break;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+#ifdef SHOWINFO
|
|
|
+ int64_t now = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
|
|
|
+ std::cout<<now<<" "<<m_url<<" up a frame. "<<std::endl;
|
|
|
+#endif
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
void output_down() {
|
|
@@ -204,7 +213,8 @@ public:
|
|
|
int InputPacket(AVPacket *pkt) {
|
|
|
if(m_list_packets.size()>90)
|
|
|
{
|
|
|
- std::cout<<" ignore packete. buffer full."<<std::endl;
|
|
|
+ int64_t now = std::chrono::system_clock::now().time_since_epoch().count()/1000000;
|
|
|
+ std::cout<<now<<" ignore packete. buffer full."<<std::endl;
|
|
|
return -1;
|
|
|
}
|
|
|
AVPacket *pkt1 = av_packet_alloc();
|