You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Protected audio decoding in a omp_critical, and removed some debug code
This commit is contained in:
@@ -574,53 +574,11 @@ void FFmpegReader::ProcessAudioPacket(int requested_frame, int target_frame, int
|
||||
// re-initialize buffer size (it gets changed in the avcodec_decode_audio2 method call)
|
||||
int buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE;
|
||||
|
||||
// decode audio packet into samples (put samples in the audio_buf array)
|
||||
#pragma omp critical (debug)
|
||||
{
|
||||
cout << "FRAME: " << target_frame << ", Starting Sample: " << starting_sample << ", Thread #: " << omp_get_thread_num() << endl;
|
||||
cout << "&audio_buf: " << &audio_buf << endl;
|
||||
cout << "audio_buf[0]: " << audio_buf[0] << endl;
|
||||
cout << "audio_buf[1]: " << audio_buf[1] << endl;
|
||||
cout << "audio_buf[2]: " << audio_buf[2] << endl;
|
||||
cout << "audio_buf[3]: " << audio_buf[3] << endl;
|
||||
cout << "audio_buf[4]: " << audio_buf[4] << endl;
|
||||
cout << "audio_buf[5]: " << audio_buf[5] << endl;
|
||||
cout << "my_packet.pts: " << my_packet->pts << endl;
|
||||
cout << "&my_packet: " << &my_packet << endl;
|
||||
}
|
||||
|
||||
if (target_frame > 282)
|
||||
sleep(1);
|
||||
|
||||
#pragma omp critical (debug)
|
||||
{
|
||||
cout << "FRAME: " << target_frame << ", Starting Sample: " << starting_sample << ", Thread #: " << omp_get_thread_num() << endl;
|
||||
cout << "&audio_buf: " << &audio_buf << endl;
|
||||
cout << "audio_buf[0]: " << audio_buf[0] << endl;
|
||||
cout << "audio_buf[1]: " << audio_buf[1] << endl;
|
||||
cout << "audio_buf[2]: " << audio_buf[2] << endl;
|
||||
cout << "audio_buf[3]: " << audio_buf[3] << endl;
|
||||
cout << "audio_buf[4]: " << audio_buf[4] << endl;
|
||||
cout << "audio_buf[5]: " << audio_buf[5] << endl;
|
||||
cout << "my_packet.pts: " << my_packet->pts << endl;
|
||||
cout << "&my_packet: " << &my_packet << endl;
|
||||
}
|
||||
|
||||
int used = avcodec_decode_audio3(aCodecCtx, audio_buf, &buf_size, my_packet);
|
||||
int used = -1;
|
||||
#pragma omp critical (audio_codec)
|
||||
used = avcodec_decode_audio3(aCodecCtx, audio_buf, &buf_size, my_packet);
|
||||
|
||||
if (used < 0) {
|
||||
#pragma omp critical (debug)
|
||||
{
|
||||
cout << "FRAME: " << target_frame << ", Starting Sample: " << starting_sample << ", Thread #: " << omp_get_thread_num() << endl;
|
||||
cout << "used: " << used << endl;
|
||||
cout << "buf_size: " << buf_size << endl;
|
||||
cout << "my_packet->size: " << my_packet->size << endl;
|
||||
cout << "&audio_buf: " << &audio_buf << endl;
|
||||
cout << "aCodecCtx: " << aCodecCtx << endl;
|
||||
cout << "my_packet.pts: " << my_packet->pts << endl;
|
||||
cout << "&my_packet: " << &my_packet << endl;
|
||||
}
|
||||
|
||||
// Throw exception
|
||||
throw ErrorDecodingAudio("Error decoding audio samples", target_frame);
|
||||
my_packet->size = 0;
|
||||
|
||||
Reference in New Issue
Block a user