保留第一个I桢之前的P桢
int iframe_find = 0;
if (pkt_queue_.size() > 300) {
std::queue<AVPacket> tmp_queue_;
while (!pkt_queue_.empty()) {
AVPacket pkt = pkt_queue_.front();
pkt_queue_.pop();
if (pkt.flags & AV_PKT_FLAG_KEY) {
//i frame
iframe_find = 1;
tmp_queue_.push(pkt);
} else {
// p frame
if (!iframe_find) {
tmp_queue_.push(pkt);
}
}
}
stopself = 1;
pkt_queue_ = tmp_queue_;
LOGE("!!!!!!!!!!!!!!!!!!!!afterempty size is %d",pkt_queue_.size());
} else {
pkt_queue_.push(pkt);
}
网友评论