mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-11 01:06:42 +00:00
Catch exceptions in VideoThread
This commit is contained in:
parent
2042a66cf3
commit
de37ca8e2c
2 changed files with 37 additions and 29 deletions
|
@ -121,6 +121,7 @@
|
||||||
Bug #5975: NIF controllers from sheath meshes are used
|
Bug #5975: NIF controllers from sheath meshes are used
|
||||||
Bug #5991: Activate should always be allowed for inventory items
|
Bug #5991: Activate should always be allowed for inventory items
|
||||||
Bug #5995: NiUVController doesn't calculate the UV offset properly
|
Bug #5995: NiUVController doesn't calculate the UV offset properly
|
||||||
|
Bug #6007: Crash when ending cutscene is playing
|
||||||
Bug #6016: Greeting interrupts Fargoth's sneak-walk
|
Bug #6016: Greeting interrupts Fargoth's sneak-walk
|
||||||
Feature #390: 3rd person look "over the shoulder"
|
Feature #390: 3rd person look "over the shoulder"
|
||||||
Feature #832: OpenMW-CS: Handle deleted references
|
Feature #832: OpenMW-CS: Handle deleted references
|
||||||
|
|
65
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
65
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -409,43 +409,50 @@ public:
|
||||||
|
|
||||||
pFrame = av_frame_alloc();
|
pFrame = av_frame_alloc();
|
||||||
|
|
||||||
while(self->videoq.get(packet, self) >= 0)
|
try
|
||||||
{
|
{
|
||||||
if(packet->data == flush_pkt.data)
|
while(self->videoq.get(packet, self) >= 0)
|
||||||
{
|
{
|
||||||
avcodec_flush_buffers(self->video_ctx);
|
if(packet->data == flush_pkt.data)
|
||||||
|
|
||||||
self->pictq_mutex.lock();
|
|
||||||
self->pictq_size = 0;
|
|
||||||
self->pictq_rindex = 0;
|
|
||||||
self->pictq_windex = 0;
|
|
||||||
self->pictq_mutex.unlock();
|
|
||||||
|
|
||||||
self->frame_last_pts = packet->pts * av_q2d((*self->video_st)->time_base);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Decode video frame
|
|
||||||
int ret = avcodec_send_packet(self->video_ctx, packet);
|
|
||||||
// EAGAIN is not expected
|
|
||||||
if (ret < 0)
|
|
||||||
throw std::runtime_error("Error decoding video frame");
|
|
||||||
|
|
||||||
while (!ret)
|
|
||||||
{
|
|
||||||
ret = avcodec_receive_frame(self->video_ctx, pFrame);
|
|
||||||
if (!ret)
|
|
||||||
{
|
{
|
||||||
double pts = pFrame->best_effort_timestamp;
|
avcodec_flush_buffers(self->video_ctx);
|
||||||
pts *= av_q2d((*self->video_st)->time_base);
|
|
||||||
|
|
||||||
pts = self->synchronize_video(pFrame, pts);
|
self->pictq_mutex.lock();
|
||||||
|
self->pictq_size = 0;
|
||||||
|
self->pictq_rindex = 0;
|
||||||
|
self->pictq_windex = 0;
|
||||||
|
self->pictq_mutex.unlock();
|
||||||
|
|
||||||
if(self->queue_picture(pFrame, pts) < 0)
|
self->frame_last_pts = packet->pts * av_q2d((*self->video_st)->time_base);
|
||||||
break;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode video frame
|
||||||
|
int ret = avcodec_send_packet(self->video_ctx, packet);
|
||||||
|
// EAGAIN is not expected
|
||||||
|
if (ret < 0)
|
||||||
|
throw std::runtime_error("Error decoding video frame");
|
||||||
|
|
||||||
|
while (!ret)
|
||||||
|
{
|
||||||
|
ret = avcodec_receive_frame(self->video_ctx, pFrame);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
double pts = pFrame->best_effort_timestamp;
|
||||||
|
pts *= av_q2d((*self->video_st)->time_base);
|
||||||
|
|
||||||
|
pts = self->synchronize_video(pFrame, pts);
|
||||||
|
|
||||||
|
if(self->queue_picture(pFrame, pts) < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "An error occurred playing the video: " << e.what () << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
av_packet_unref(packet);
|
av_packet_unref(packet);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue