Solve the Problem of exiting an HTTP video from VLC-android playback.

Source: Internet
Author: User
Tags connection reset

Previously, we used VLC-android to play HTTP videos,ProgramThe system automatically exits and uses ndk-GDB for debugging.

 

/Home/Administrator/code/VLC-android/extras/package/Android/VLC-android/obj/local/armeabi/GDB. Setup: 4: Error in sourced command file:
Remote Communication error: Connection reset by peer.

No solution was found on the Internet.CodeAdd the debug print statement to see where the error was reported, and finally trace the cause of calling the poll function,

Finally, find the source code of a poll function in FFMPEG source code and add it to VLC-android after modification.

Int poll (struct pollfd * FDS, nfds_t numfds, int timeout)

{

Fd_set read_set;

Fd_set write_set;

Fd_set exception_set;

Nfds_t I;

Int N;

Int RC;

# If have_winsock2_h

If (numfds> = fd_setsize ){

Errno = einval;

Return-1;

}

# Endif

Fd_zero (& read_set );

Fd_zero (& write_set );

Fd_zero (& exception_set );

N =-1;

For (I = 0; I <numfds; I ++ ){

If (FDS [I]. FD <0)

Continue;

# If! Have_winsock2_h

If (FDS [I]. FD> = fd_setsize ){

Errno = einval;

Return-1;

}

# Endif

If (FDS [I]. Events & Pollin) fd_set (FDS [I]. FD, & read_set );

If (FDS [I]. Events & pollout) fd_set (FDS [I]. FD, & write_set );

If (FDS [I]. Events & pollerr) fd_set (FDS [I]. FD, & exception_set );

If (FDS [I]. FD> N)

N = FDS [I]. FD;

};

If (n =-1)

/* Hey !? Nothing to poll, in fact !!! */

Return 0;

If (timeout <0)

Rc = select (n + 1, & read_set, & write_set, & prediction_set, null );

Else {

Struct timeval TV;

TV. TV _sec = timeout/1000;

TV. TV _usec = 1000 * (timeout % 1000 );

Rc = select (n + 1, & read_set, & write_set, & prediction_set, & TV );

};

If (RC <0)

Return RC;

For (I = 0; I <numfds; I ++ ){

FDS [I]. revents = 0;

If (fd_isset (FDS [I]. FD, & read_set) FDS [I]. revents | = Pollin;

If (fd_isset (FDS [I]. FD, & write_set) FDS [I]. revents | = pollout;

If (fd_isset (FDS [I]. FD, & exception_set) FDS [I]. revents | = pollerr;

};

Return RC;

}

Test playing online HTTP video, video address: http://forum.ea3w.com/coll_ea3w/attach/2008_10/12231788691.wmv

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.