| | |
| | | ,audio_(false) |
| | | ,gb_(0) |
| | | ,cpu_(0) |
| | | ,devid_(-1) |
| | | ,run_dec_(false) |
| | | ,run_stream_(true) |
| | | ,run_rec_(false) |
| | |
| | | ,audio_(false) |
| | | ,gb_(0) |
| | | ,cpu_(0) |
| | | ,devid_(-1) |
| | | ,run_dec_(false) |
| | | ,run_stream_(true) |
| | | ,run_rec_(false) |
| | |
| | | prop.url_ = input; |
| | | prop.rtsp_tcp_ = true; |
| | | prop.gpu_acc_ = !cpu_; |
| | | prop.gpu_index_ = devid_; |
| | | |
| | | std::unique_ptr<FormatIn> in(new FormatIn(prop.gpuAccl())); |
| | | std::unique_ptr<FormatIn> in(new FormatIn(prop, prop.gpuAccl())); |
| | | int flag = -1; |
| | | if (gb_){ |
| | | flag = in->openGb28181(input, NULL); |
| | |
| | | |
| | | bool exist = access(input_url_.c_str(), 0) == 0; |
| | | if (exist){ |
| | | wTime <<= 1; |
| | | wTime += wTime/2; |
| | | file_rebootime++; |
| | | } |
| | | |
| | |
| | | id++; |
| | | |
| | | //本地文件太快sleep一下 |
| | | if (exist){ |
| | | usleep(wTime); |
| | | if (exist && in->isVideoPkt(&data->getAVPacket())){ |
| | | // 记录解码的文件有多少帧 |
| | | file_frame++; |
| | | usleep(wTime); |
| | | } |
| | | |
| | | } |
| | |
| | | if (exist) { |
| | | // 三次一帧都没解出来,退出 |
| | | if (file_frame == 0 && file_rebootime < 3){ |
| | | logIt("libcffmpeg.so-> run %lld time, current frames %lld", file_rebootime, file_frame); |
| | | continue; |
| | | } |
| | | // 最小需要解出多少帧 |
| | | if (file_frame < min_duration_ * fps_){ |
| | | logIt("libcffmpeg.so-> run %lld time, current frames %lld, mind %d, fps: %d", |
| | | file_rebootime, file_frame, min_duration_, fps_); |
| | | continue; |
| | | } |
| | | logIt("libcffmpeg.so-> local file %s run %lld time, all frames %lld", input_url_.c_str(), file_rebootime, file_frame); |
| | | logIt("libcffmpeg.so-> local file %s run %lld time, all frames %lld, mind %d, fps: %d", |
| | | input_url_.c_str(), file_rebootime, file_frame, min_duration_, fps_); |
| | | file_finished_ = true; |
| | | break; |
| | | } |