Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 2780] New: Reversed RTP stream is saved as silent .au file

Date: Thu, 7 Aug 2008 13:40:27 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2780

           Summary: Reversed RTP stream is saved as silent .au file, forward
                    stream saves correctly
           Product: Wireshark
           Version: 0.99.8
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Medium
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: sbluman@xxxxxxxxxx


Build Information:
Version 0.99.8 (SVN Rev 24492)

Copyright 1998-2008 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.12.8, with GLib 2.14.6, with WinPcap (version unknown),
with libz 1.2.3, with libpcre 7.0, with SMI 0.4.5, with ADNS, with Lua 5.1,
with
GnuTLS 1.6.1, with Gcrypt 1.2.3, with MIT Kerberos, with PortAudio V19-devel,
with AirPcap.

Running on Windows XP Service Pack 2, build 2600, with WinPcap version 4.0.2
(packet.dll version 4.0.0.1040), based on libpcap version 0.9.5, without
AirPcap.

Built using Microsoft Visual C++ 6.0 build 8804

Wireshark is Open Source Software released under the GNU General Public
License.

Check the man page and http://www.wireshark.org for more information.
--
When exporting the audio of a bi-directional RTP stream as separate .AU files,
the forward RTP stream exports fine but the reversed RTP stream exported
contains only silence.  When exporting both streams together as a mixed file,
they export correctly.

The problem appears to be a cut and paste typo in rtp_analysis.c->copy_file(). 
In the SAVE_REVERSE_DIRECTION_MASK case that converts the reversed stream to an
.AU file, the pointer to f_pd is passed to ulaw2linear() or alaw2linear(). 
This is correct for the SAVE_FORWARD_DIRECTION_MASK case, but for the
SAVE_REVERSE_DIRECTION_MASK case, the pointer to the rev_fd should be passed in
instead.

Here is the snippet from the 1.0.2 source code containing the apparently
incorrect logic in rtp_analysis.c->copy_file(...)

if      (format == SAVE_AU_FORMAT) /* au format */
...
   switch (channels) {
...
      /* only reversed direction */
      case SAVE_REVERSE_DIRECTION_MASK: {
...
if (user_data->forward.statinfo.pt == PT_PCMU){  <--Should be reversed stream
   sample = ulaw2linear(*f_pd);                  <--Should be r_pd
   phtons(pd, sample);
}
else if(user_data->forward.statinfo.pt == PT_PCMA){<--Should be reversed stream
   sample = alaw2linear(*f_pd);                    <--Should be r_pd
   phtons(pd, sample);
}

</end snippet>

Steps to reproduce:
1. Load a packet capture containing a forward and reverse RTP stream pair.
2. Go to Statistics->RTP->Stream Analysis...
3. Select Save payload...
4. Select Format->.au
5. Select Channels->reverse

Expected Results:
The reverse stream should contain the audio data for the reverse stream.

Actual Results:
The reverse stream contains silence. It is probably either an uninitialized
content buffer or the first packet copied over and over again which happened to
be silence in my case.

Additional Information:
1. If you swap the streams and export the same stream as the forward stream it
exports fine.
2. If you export a combined stream, it exports fine.
3. If you export as RAW then it exports fine.


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