ffplay analysis (operation of audio decoding thread)

"Analysis of data structure of
ffplay " "Analysis of ffplay (from startup to operation of reading thread)"
"Analysis of ffplay (operation of video decoding thread)"
"ffplay source code (version: ffmpeg-4.2.1)"


)

1. Analysis:

1. stream_component_open(): Open the audio decoding thread audio_thread()

Insert picture description here

2. audio_thread(): Assign AVframe work before decoding

Insert picture description here

3. Audio_thread(): call decoder_decode_frame() to get a frame of data after decoding

Insert picture description here

4. audio_thread(): call avcodec_receive_frame() to get the decoded frame

Insert picture description here
Insert picture description here

5. audio_thread(): The result obtained by avcodec_receive_frame() determines whether it returns normally or exits the loop and goes down

Insert picture description here

6. audio_thread(): Get a new Packet from the Packet (before decoding) queue

Insert picture description here

7. audio_thread(): Determine whether the obtained Packet is a flush Packet

Insert picture description here

8. audio_thread(): call avcodec_send_packet() to decode

Insert picture description here

9. audio_thread(): call frame_queue_peek_writable() to get the writable Frame, and set the corresponding parameters

Insert picture description here

10. audio_thread(): call av_frame_move_ref() to move AVFrame->buffer, call frame_queue_push() to add to the frame (after decoding) queue

Insert picture description here

11. audio_thread(): The audio decoding thread ends processing, except for requesting exit or abnormal exit, otherwise it will not.

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_37599645/article/details/113006167