| 278 | } |
| 279 | |
| 280 | int mediaCodecDecoder::enqueue_decoder(unique_ptr<IAFPacket> &pPacket) { |
| 281 | |
| 282 | if (!mbInit && mDrmHandler != nullptr) { |
| 283 | int ret = initDrmHandler(); |
| 284 | if (ret == -EAGAIN) { |
| 285 | return -EAGAIN; |
| 286 | } else if (ret < 0) { |
| 287 | return ret; |
| 288 | } else if (ret == 0) { |
| 289 | ret = configDecoder(); |
| 290 | |
| 291 | if (ret < 0) { |
| 292 | return ret; |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | if (pPacket != nullptr && pPacket->getInfo().extra_data != nullptr) { |
| 298 | updateCSD(&mMeta, pPacket->getInfo().extra_data, pPacket->getInfo().extra_data_size); |
| 299 | } |
| 300 | |
| 301 | if (!mCSDList.empty()) { |
| 302 | mDecoder->setCodecSpecificData(mCSDList); |
| 303 | mCSDList.clear(); |
| 304 | } |
| 305 | |
| 306 | int index = mDecoder->dequeueInputBufferIndex(1000); |
| 307 | |
| 308 | if (index == MC_ERROR) { |
| 309 | AF_LOGE("dequeue_in error."); |
| 310 | // TODO: value |
| 311 | return -ENOSPC; |
| 312 | } else if (index == MC_INFO_TRYAGAIN) { |
| 313 | return -EAGAIN; |
| 314 | } |
| 315 | |
| 316 | int ret = 0; |
| 317 | |
| 318 | if (index >= 0) { |
| 319 | // if (pPacket != nullptr) |
| 320 | // AF_LOGD("mediacodec in pts %" PRId64 " size %d", pPacket->getInfo().pts, pPacket->getSize()); |
| 321 | uint8_t *data = nullptr; |
| 322 | int size = 0; |
| 323 | int64_t pts = 0; |
| 324 | |
| 325 | if (pPacket != nullptr) { |
| 326 | data = pPacket->getData(); |
| 327 | size = static_cast<int>(pPacket->getSize()); |
| 328 | pts = pPacket->getInfo().pts; |
| 329 | |
| 330 | if (pPacket->getDiscard()) { |
| 331 | mDiscardPTSSet.insert(pts); |
| 332 | } |
| 333 | } else { |
| 334 | AF_LOGD("queue eos codecType = %d\n", codecType); |
| 335 | } |
| 336 | |
| 337 | if (mDrmHandler != nullptr) { |
nothing calls this directly
no test coverage detected