Use test::Packet test::PacketSource classes in neteq_rtpplay
This change replaces the old NETEQTEST_RTPpacket and
NETEQTEST_DummyRTPpacket with the new test::Packet class. Note that the
Packet class automatically handles "dummy" packets (i.e., packets for
which only the header and a length field was stored to file)
automatically. There is no need to explicitly signal this to the
application any longer. The RTP input file is now handled as a
test::PacketSource object.
Also adding a new ConvertHeader method to the Packet class. This is
needed to extract the header information as an alternative data type.
Finally, some dead code was deleted from rtp_analyze.cc (unrelated to
the reset of this change).
BUG=2692
R=minyue@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/21139004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6862 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq/tools/packet.cc b/webrtc/modules/audio_coding/neteq/tools/packet.cc
index d8fb713..794c308 100644
--- a/webrtc/modules/audio_coding/neteq/tools/packet.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/packet.cc
@@ -9,6 +9,10 @@
*/
#include "webrtc/modules/audio_coding/neteq/tools/packet.h"
+
+#include <string.h>
+
+#include "webrtc/modules/interface/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
namespace webrtc {
@@ -117,6 +121,14 @@
}
}
+void Packet::ConvertHeader(WebRtcRTPHeader* copy_to) const {
+ memcpy(©_to->header, &header_, sizeof(header_));
+ copy_to->frameType = kAudioFrameSpeech;
+ copy_to->type.Audio.numEnergy = 0;
+ copy_to->type.Audio.channel = 1;
+ copy_to->type.Audio.isCNG = false;
+}
+
bool Packet::ParseHeader(const RtpHeaderParser& parser) {
bool valid_header = parser.Parse(
payload_memory_.get(), static_cast<int>(packet_length_bytes_), &header_);