Re: Sws-scale_crash.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sws-scale_crash.

Vasya V. Veremeenko
Hi 2 All.
I find bug.

I not all needed code send from previsios post.
Decoding received data:
[code]
        AVPacket pkt;

        while (av_read_frame(ctx_.FC(), &pkt)>=0) {
            if (pkt.stream_index==0) {
                int frameFinished;
                avcodec_decode_video(codecCtx_
                    , frm_->FF()
                    , &frameFinished
                    , pkt.data
                    , pkt.size);
                if (frameFinished) {
[/code]
In this place I return data for postrocessing and freeid used for decoding packet.
but used raw decoder not copy data to frame. Becose It only copy needed pointers to
data field data freed twice - seg fault.
[code]
                    av_free_packet(&pkt);
                    return frm_;
                }
            }
            av_free_packet(&pkt);
        }
[/code]

> libav compiled with mingw32-gcc-4.2.1-sjlj compiler.
> Application compile with Visual Studio 2005.
> > I creating my DirectShow filter for input video stream compresing. After receive data to input pin I probaly convert UYVY422 data to YUV420P, but sws_scale crashed with Access violation bag.
> >
> > Getting data from input pin:
> > [code]
> > IMediaSample *sample
> > = *((DirectShowParamter *)(ctx->priv_data))->sample_;
> > ASSERT(sample);
> >
> > int64_t curtime = av_gettime();
> >
> > if (av_new_packet(pkt, sample->GetActualDataLength())<0)
> > return AVERROR_IO;
> >
> > pkt->pts = curtime;
> > BYTE *dataPtr;
> > sample->GetPointer(&dataPtr);
> > // TODO попробовать не использовать копирование.
> > memcpy(pkt->data, dataPtr, sample->GetActualDataLength());
> > //pkt->data = dataPtr;
> > return sample->GetActualDataLength();
> > [/code]
> >
> > Getting context
> >
> > [code]
> > swsCtx_ = sws_getContext(384, 272, PIX_FMT_UYVY422
> > , 384, 272, PIX_FMT_RGB24, SWS_BICUBIC, 0, 0, 0); [/code]
> >
> > Scaling
> >
> > [code]
> >
> > sws_scale(swsCtx_, ((Codecs::FFMPEGFrame *)pkt)->FF()->data
> > , ((Codecs::FFMPEGFrame *)pkt)->FF()->linesize
> > , 0, 272, opkt.FF()->data, opkt.FF()->linesize);
> > [/code]
> >

-- реклама -----------------------------------------------------------
Поторопись зарегистрировать самый короткий почтовый адрес @i.ua
http://mail.i.ua/reg - и получи 1Gb для хранения писем
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Loading...