torchaudio/csrc/ffmpeg/streamer.cpp
////////////////////////////////////////////////////////////////////////////////
// Stream methods
////////////////////////////////////////////////////////////////////////////////
// Note
// return value (to be finalized)
// 0: caller should keep calling this function
// 1: It's done, caller should stop calling
// <0: Some error happened
Stream methods
Note
return value (to be finalized)
0: caller should keep calling this function
1: It's done, caller should stop calling
<0: Some error happened
Stream methods Note return value ( to be finalized ) 0 : caller should keep calling this function 1 : It ' s done caller should stop calling <0 : Some error happened
int Streamer::process_packet() {
  int ret = av_read_frame(pFormatContext, pPacket);
  if (ret == AVERROR_EOF) {
    ret = drain();
    return (ret < 0) ? ret : 1;
  }
  if (ret < 0)
    return ret;
  AutoPacketUnref packet{pPacket};
  auto& processor = processors[pPacket->stream_index];
  if (!processor)
    return 0;
  ret = processor->process_packet(packet);
  return (ret < 0) ? ret : 0;
}
int Streamer :: process_packet ( ) { int ret = av_read_frame ( pFormatContext , pPacket ) ; if ( ret == AVERROR_EOF ) { ret = drain ( ) ; return ( ret < 0 ) ? ret : 1 ; } if ( ret < 0 ) return ret ; AutoPacketUnref packet { pPacket } ; auto & processor = processors [ pPacket -> stream_index ] ; if ( ! processor ) return 0 ; ret = processor -> process_packet ( packet ) ; return ( ret < 0 ) ? ret : 0 ; }
Stream methods
Note
return value (to be finalized)
0: caller should keep calling this function
1: It's done, caller should stop calling
<0: Some error happened
Stream methods Note return value ( to be finalized ) 0 : caller should keep calling this function 1 : It ' s done caller should stop calling <0 : Some error happened