MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / dequeue_decoder

Method dequeue_decoder

framework/codec/Android/mediaCodecDecoder.cpp:394–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392 }
393
394 int mediaCodecDecoder::dequeue_decoder(unique_ptr<IAFFrame> &pFrame) {
395
396 if (!mbInit) {
397 return -EAGAIN;
398 }
399
400 int ret;
401 int index;
402 index = mDecoder->dequeueOutputBufferIndex(1000);
403
404 if (index == MC_ERROR) {
405 AF_LOGE("dequeue_out occur error. flush state %d", mFlushState);
406 return MC_ERROR;
407 } else if (index == MC_INFO_TRYAGAIN || index == MC_INFO_OUTPUT_BUFFERS_CHANGED) {
408 return -EAGAIN;
409 } else if (index == MC_INFO_OUTPUT_FORMAT_CHANGED) {
410 mc_out out{};
411 mDecoder->getOutput(index, &out, false);
412
413 if (codecType == CODEC_VIDEO) {
414 height = out.conf.video.height;
415
416 if (out.conf.video.crop_bottom != MC_ERROR && out.conf.video.crop_top != MC_ERROR) {
417 height = out.conf.video.crop_bottom + 1 - out.conf.video.crop_top;
418 }
419
420 width = out.conf.video.width;
421
422 if (out.conf.video.crop_right != MC_ERROR && out.conf.video.crop_left != MC_ERROR) {
423 width = out.conf.video.crop_right + 1 - out.conf.video.crop_left;
424 }
425 } else if (codecType == CODEC_AUDIO) {
426 channel_count = out.conf.audio.channel_count;
427 sample_rate = out.conf.audio.sample_rate;
428 format = out.conf.audio.format;
429 }
430
431 return -EAGAIN;
432 } else if (index >= 0) {
433 mc_out out{};
434 ret = mDecoder->getOutput(index, &out, codecType != CODEC_VIDEO);
435 auto item = mDiscardPTSSet.find(out.buf.pts);
436
437 if (item != mDiscardPTSSet.end()) {
438 mDecoder->releaseOutputBuffer(index, false);
439 mDiscardPTSSet.erase(item);
440 return -EAGAIN;
441 }
442
443 if (out.b_eos) {
444 return STATUS_EOS;
445 }
446
447 // AF_LOGD("mediacodec out pts %" PRId64, out.buf.pts);
448 if (codecType == CODEC_VIDEO) {
449 pFrame = unique_ptr<AFMediaCodecFrame>(
450 new AFMediaCodecFrame(IAFFrame::FrameTypeVideo, index,
451 [this](int index, bool render) {

Callers

nothing calls this directly

Calls 6

assertClass · 0.85
getOutputMethod · 0.80
findMethod · 0.80
endMethod · 0.45
releaseOutputBufferMethod · 0.45

Tested by

no test coverage detected