ijkplayer阅读笔记03-视频解码线程详解

本节主要介绍视频解码线程流程,流程如下:

video_thread{
   ffpipenode_run_sync(ffp->node_vdec);{
      node->func_run_sync(node);{ // decoder_from_android_mediacodec 调用MediaCodec硬解流程
         SDL_CreateThreadEx(enqueue_thread_func){
            while (!q->abort_request) {
               feed_input_buffer{ 
                  ffp_packet_queue_get_or_buffering
                  SDL_AMediaCodec_dequeueInputBuffer
                  input_buffer_ptr = SDL_AMediaCodec_getInputBuffer
                  memcpy(input_buffer_ptr, d->pkt_temp.data, copy_size);
                  SDL_AMediaCodec_queueInputBuffer
               }
            }
         }
         while{
            drain_output_buffer{
                output_buffer_index = SDL_AMediaCodec_dequeueOutputBuffer 
            }
         }
      }
      
      
      node->func_run_sync(node);{ // decoder_from_ffplay 调用ffmpeg软解流程
          func_run_sync{
             ffp_video_thread{
                ffplay_video_thread{
                    for (;;) {
                       get_video_frame(ffp, frame);{
                           decoder_decode_frame(ffp, &is->viddec, frame){
                           avcodec_decode_video2(d->avctx, frame, &got_frame);
                           || avcodec_decode_audio4(d->avctx, frame, &got_frame);
                       }
                    }
                    queue_picture(ffp, frame, pts, duration){
                       vp = frame_queue_peek_writable(&is->pictq);
                       SDL_VoutFFmpeg_ConvertFrame(vp->bmp, src_frame){
                      
                       }
                    }
                    frame_queue_push(&is->pictq);
                }
          }
      }
   }
}

 


你可能感兴趣的:(ffmpeg,android,ijkplayer)