ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 3037] RTP/MPEG-TS export is dead slow

Date: Sat, 8 Nov 2008 02:57:35 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3037





--- Comment #1 from Alexander <alexanderfaucher@xxxxxxxxx>  2008-11-08 02:57:34 PDT ---
I did another look at the code and wrote a fix.  It appears to work just fine
now.  A 3 minute export now happens before you can see the progress bar.

rtp_analysis.c:~2470

--- BEFORE ---

/* XXX how do you just copy the file? */
while ((rread = read(fd, pd, 1)) > 0) {
        if(stop_flag)
                break;
        if((count > progbar_nextstep) && (count <= progbar_count)) {
                update_progress_dlg(progbar,
                        (gfloat) count/progbar_count, "Saving");
                progbar_nextstep = progbar_nextstep + progbar_quantum;
        }
        count++;

        rwritten = eth_write(to_fd, pd, 1);

        if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
                eth_close(forw_fd);
                eth_close(rev_fd);
                eth_close(to_fd);
                destroy_progress_dlg(progbar);
                return FALSE;
        }
}

--- AFTER ---

+ unsigned char buffer[1024];
/* XXX how do you just copy the file? */
- while ((rread = read(fd, pd, 1)) > 0) {
+ while ((rread = read(fd, buffer, 1024)) > 0) {
        if(stop_flag)
                break;
        if((count > progbar_nextstep) && (count <= progbar_count)) {
                update_progress_dlg(progbar,
                        (gfloat) count/progbar_count, "Saving");
                progbar_nextstep = progbar_nextstep + progbar_quantum;
        }
        count++;

-       rwritten = eth_write(to_fd, pd, 1);
+       rwritten = eth_write(to_fd, buffer, rread >= 0 ? rread : 0);

        if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) {
                eth_close(forw_fd);
                eth_close(rev_fd);
                eth_close(to_fd);
                destroy_progress_dlg(progbar);
                return FALSE;
        }
}

The code could use another round of testing to ensure there was no side
effects.

Good luck,
Alexander Faucher


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.