fork download
  1. void Decoder::ReadPackets()
  2. {
  3. AVPacket pkt;
  4. int ret;
  5.  
  6. av_init_packet(&pkt);
  7.  
  8. ret = av_read_frame(_format_ctx, &pkt);
  9. if (ret < 0)
  10. {
  11. LOG "RET is less than zero. Unpredictable behaviour. Need fix it"<< std::endl;
  12. return;
  13. }
  14. if (pkt.stream_index == _audio_index || pkt.stream_index == _video_index)
  15. {
  16. if(av_dup_packet(&pkt) < 0)
  17. {
  18. LOG "Dup packet is < 0"EL;
  19. return;
  20. }
  21. if (pkt.stream_index == _audio_index)
  22. {
  23. if(!_audio_decoder->Push(pkt))
  24. {
  25. av_free_packet(&pkt);
  26. return;
  27. }
  28. }
  29. else
  30. {
  31. if(!_video_decoder->Push(pkt))
  32. {
  33. av_free_packet(&pkt);
  34. return;
  35. }
  36. }
  37. }
  38. else
  39. av_free_packet(&pkt);
  40. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty