I wrote an MPEG4 encoder and rtp server for camera data that seems to
work fine... VLC can read the stream and display the video data. Now
I'm trying to write an rtp client and decoder as a counterpart to the
server, but all I get is a stream of monochromic gray frames (RGBA:
127 127 127 255).
Here's the code I use to read and decode incoming packets from a stream:
------------------------------------------------------------------------------------------------------------------------------
AVPacket pkt;
int result = av_read_frame(actualContext, &pkt);
if(result < 0){
// error handling
}else if(pkt.stream_index == 0){
int gotPic = 0;
AVFrame *frame = avcodec_alloc_frame();
int checkSize = avcodec_decode_video2(vidCodecContext, frame, &gotPic,
&pkt);
if(gotPic){
// display frame
}
av_free(frame);
}
av_free_packet(&pkt);
------------------------------------------------------------------------------------------------------------------------------
The odd thing here is that each time I call av_read_frame, the
timestamps for the packet change, but the payload seems to stay the
same. When I check the contents of the packet's data member, I always
get the same sequence of values. When I call avcodec_decode_video2,
the size values also always remain the same, and are suspiciously
small. checkSize is always 59, and gotPic is always 204.
VLC seems to parse the stream just fine, so I don't think there's
anything wrong with the server code.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user