Skip to content

Commit bc98656

Browse files
committed
Attempt to fix
1 parent bad02bd commit bc98656

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/videostate.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void PacketQueue::put(AVPacket *pkt)
9595
pkt1->pkt = *pkt;
9696
pkt1->next = NULL;
9797

98-
if(pkt->data != flush_pkt.data && pkt1->pkt.destruct == NULL)
98+
if(pkt->data != flush_pkt.data)
9999
{
100100
if(av_dup_packet(&pkt1->pkt) < 0)
101101
{
@@ -314,7 +314,7 @@ int VideoState::queue_picture(AVFrame *pFrame, double pts)
314314
int w = (*this->video_st)->codec->width;
315315
int h = (*this->video_st)->codec->height;
316316
this->sws_context = sws_getContext(w, h, (*this->video_st)->codec->pix_fmt,
317-
w, h, PIX_FMT_RGBA, SWS_BICUBIC,
317+
w, h, AV_PIX_FMT_RGBA, SWS_BICUBIC,
318318
NULL, NULL, NULL);
319319
if(this->sws_context == NULL)
320320
throw std::runtime_error("Cannot initialize the conversion context!\n");
@@ -361,19 +361,7 @@ double VideoState::synchronize_video(AVFrame *src_frame, double pts)
361361
* a frame at the time it is allocated.
362362
*/
363363
static int64_t global_video_pkt_pts = AV_NOPTS_VALUE;
364-
static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic)
365-
{
366-
int ret = avcodec_default_get_buffer(c, pic);
367-
int64_t *pts = (int64_t*)av_malloc(sizeof(int64_t));
368-
*pts = global_video_pkt_pts;
369-
pic->opaque = pts;
370-
return ret;
371-
}
372-
static void our_release_buffer(struct AVCodecContext *c, AVFrame *pic)
373-
{
374-
if(pic) av_freep(&pic->opaque);
375-
avcodec_default_release_buffer(c, pic);
376-
}
364+
377365

378366

379367
void VideoState::video_thread_loop(VideoState *self)
@@ -385,7 +373,7 @@ void VideoState::video_thread_loop(VideoState *self)
385373
pFrame = av_frame_alloc();
386374

387375
self->rgbaFrame = av_frame_alloc();
388-
avpicture_alloc((AVPicture*)self->rgbaFrame, PIX_FMT_RGBA, (*self->video_st)->codec->width, (*self->video_st)->codec->height);
376+
avpicture_alloc((AVPicture*)self->rgbaFrame, AV_PIX_FMT_RGBA, (*self->video_st)->codec->width, (*self->video_st)->codec->height);
389377

390378
while(self->videoq.get(packet, self) >= 0)
391379
{
@@ -593,8 +581,6 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
593581
case AVMEDIA_TYPE_VIDEO:
594582
this->video_st = pFormatCtx->streams + stream_index;
595583

596-
codecCtx->get_buffer = our_get_buffer;
597-
codecCtx->release_buffer = our_release_buffer;
598584
this->video_thread = boost::thread(video_thread_loop, this);
599585
break;
600586

0 commit comments

Comments
 (0)