buffering

How to detect when video is buffering?

淺唱寂寞╮ 提交于 2019-11-30 19:55:45
问题 my question today deals with Flash AS3 video buffering. (Streaming or Progressive) I want to be able to detect when the video is being buffered, so I can display some sort of animation letting the user know to wait just a little longer. Currently my video will start up, hold on frame 1 for 3-4 secs then play. Kinda giving the impression that the video is paused or broken :( Update Thanks to iandisme I believe I'm faced in the right direction now. NetStatusEvent from livedocs. It seems to me

How to avoid Python fileinput buffering [duplicate]

a 夏天 提交于 2019-11-30 09:11:29
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Setting smaller buffer size for sys.stdin? I have a Python (2.4/2.7) script using fileinput to read from standard input or from files. It's easy to use, and works well except for one case: tail -f log | filter.py The problem is that my script buffers its input, whereas (at least in this case) I want to see its output right away. This seems to stem from the fact that fileinput uses readlines() to grab up to its

c++ std::ofstream flush() but not close()

ぐ巨炮叔叔 提交于 2019-11-30 08:40:06
I'm on MacOSX. In the logger part of my application, I'm dumping data to a file. suppose I have a globally declared std::ofstream outFile("log"); and in my logging code I have: outFile << "......." ; outFile.flush(); Now, suppose my code crashes after the flush() happens; Is the stuff written to outFile before the flush() guaranteed to be written to disk (note that I don't call a close() ). Thanks! From the C++ runtime's point of view, it should have been written to disk. From an OS perspective it might still linger in a buffer, but that's only going to be an issue if your whole machine

Reduce video buffering

夙愿已清 提交于 2019-11-30 07:30:04
I'm playing video on Android using media player via RTSP. The player takes about 12s to buffer before it starts playing. Anyone know how I can convince the player to buffer less? I have full control over the RTSP server and the SDP it returns. As per usual, as soon as I decide I should ask a question I work out the answer. I have a line "b=AS:91" in my SDP. If I reduce the number the amount of buffering decreases - so b=AS:2 gives about 4 or 5s buffering. 来源: https://stackoverflow.com/questions/3937241/reduce-video-buffering

How to disable output buffering in Process.StandardOutput

点点圈 提交于 2019-11-30 03:44:12
问题 This question has been asked more than once before, but I have not found a satisfactory answer in any of those discussions. I am launching a command-line process that produces a real-time measurement to STDOUT, producing a new result approximately every second. Using System.Diagnostics.Process.StandardOutput results in completely unacceptable lag (over 20 seconds) as the STDOUT data works through the 4k buffer in the Process.StandardOutput StreamReader, and there doesn't seem to be any way to

reading buffered binary file (with seek)

时光怂恿深爱的人放手 提交于 2019-11-29 23:49:01
问题 Say I need to read huge binary file of integers, a handy way is: FileInputStream fi = new FileInputStream(file); BufferedInputStream bi = new BufferedInputStream( fi); DataInputStream di =new DataInputStream(bi); But now say I have to read a huge block starting from the n-th integer. So far I have implemented a sort of buffer by myself as: RandomAccessFile fp=new RandomAccessFile(file); fp.seek(position); byte[] buff= new byte[len]; fp.read(buff, 0, len); ByteArrayInputStream bIn = new

Buffering characteristics of Unix Sockets

我只是一个虾纸丫 提交于 2019-11-29 23:10:49
问题 Does anyone know the buffering characteristics of Unix sockets when sending small chunks of data(a few bytes)?, when using TCP sockets I can disable the Nagle algorithm to prevent latency in data transit but there's no equivalent functionality (that I know of) for Unix Domain sockets. Thanks. 回答1: There is no nagle algorithm available on unix domain sockets. Unix sockets are normally implemented as a memory buffer in the operating system kernel. Once you've written/sent data on the socket, it

Buffered reading from stdin using fread in C

跟風遠走 提交于 2019-11-29 22:40:54
I am trying to efficiently read from the stdin by using setvbuf in `_IOFBF~ mode. I am new to buffering. I am looking for working examples. The input begins with two integers ( n , k ). The next n lines of input contain 1 integer. The aim is to print how many integers are divisible by k . #define BUFSIZE 32 int main(){ int n, k, tmp, ans=0, i, j; char buf[BUFSIZE+1] = {'0'}; setvbuf(stdin, (char*)NULL, _IONBF, 0); scanf("%d%d\n", &n, &k); while(n>0 && fread(buf, (size_t)1, (size_t)BUFSIZE, stdin)){ i=0; j=0; while(n>0 && sscanf(buf+j, "%d%n", &tmp, &i)){ //printf("tmp %d - scan %d\n",tmp,i); /

Android - How to tell when MediaPlayer is buffering

送分小仙女□ 提交于 2019-11-29 22:14:05
I've got to be missing something obvious here, but I can't seem to find anything to allow me to determine when MediaPlayer is buffering audio. I'm streaming internet audio and I want to display a buffering indicator, but nothing I've tried allows me to know when MediaPlayer interrupts the audio to buffer, so I can't properly display a buffering indicator. Any clues? Matt Briançon @Daniel, per your comment on @JRL's answer, you could probably get this working by spinning up a thread and waiting for a timeout. Something like DetectBufferTimeout.java (untested) would do nicely. I do, however,

Why use endl when I can use a newline character? [duplicate]

扶醉桌前 提交于 2019-11-29 19:40:11
This question already has an answer here: C++: “std::endl” vs “\n” 13 answers Is there a reason to use endl with cout when I can just use \n ? My C++ book says to use endl, but I don't see why. Is \n not supported as widely as endl , or am I missing something? endl appends '\n' to the stream and calls flush() on the stream. So cout << x << endl; is equivalent to cout << x << '\n'; cout.flush(); A stream may use an internal buffer which gets actually streamed when the stream is flushed. In case of cout you may not notice the difference since it's somehow synchronized ( tied ) with cin , but for