Initial revision of a ViE fuzz test. The idea is to inject randomized RTP packets and see what the video engine does.

There are some small refactorings in here, but the real focus of this CL is in vie_autotest_rtp_fuzz.cc. This patch is mostly here to get a discussion going.

On my initial test the video engine doesn't recover, at least within 10 seconds of running with untampered packets. Not sure if this is according to specification though.

Ideas:
  - Generate random packets with correct RTP headers to get further into the code.
  - Don't generate fresh random data, but rather corrupt bits here and there in small amounts.

BUG=
TEST=

Review URL: https://webrtc-codereview.appspot.com/383001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1714 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/common_types.h b/src/common_types.h
index 33fcf1a..9b3a0ce 100644
--- a/src/common_types.h
+++ b/src/common_types.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
  *
  *  Use of this source code is governed by a BSD-style license
  *  that can be found in the LICENSE file in the root of the source
@@ -149,32 +149,61 @@
     kEncryptionAndAuthentication     = 3
 };
 
+// Interface for encrypting and decrypting regular data and rtp/rtcp packets.
+// Implement this interface if you wish to provide an encryption scheme to
+// the voice or video engines.
 class Encryption
 {
 public:
+    // Encrypt the given data.
+    //
+    // Args:
+    //   channel: The channel to encrypt data for.
+    //   in_data: The data to encrypt. This data is bytes_in bytes long.
+    //   out_data: The buffer to write the encrypted data to. You may write more
+    //       bytes of encrypted data than what you got as input, up to a maximum
+    //       of webrtc::kViEMaxMtu if you are encrypting in the video engine, or
+    //       webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine.
+    //   bytes_in: The number of bytes in the input buffer.
+    //   bytes_out: The number of bytes written in out_data.
     virtual void encrypt(
-        int channel_no,
+        int channel,
         unsigned char* in_data,
         unsigned char* out_data,
         int bytes_in,
         int* bytes_out) = 0;
 
+    // Decrypts the given data. This should reverse the effects of encrypt().
+    //
+    // Args:
+    //   channel_no: The channel to decrypt data for.
+    //   in_data: The data to decrypt. This data is bytes_in bytes long.
+    //   out_data: The buffer to write the decrypted data to. You may write more
+    //       bytes of decrypted data than what you got as input, up to a maximum
+    //       of webrtc::kViEMaxMtu if you are encrypting in the video engine, or
+    //       webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine.
+    //   bytes_in: The number of bytes in the input buffer.
+    //   bytes_out: The number of bytes written in out_data.
     virtual void decrypt(
-        int channel_no,
+        int channel,
         unsigned char* in_data,
         unsigned char* out_data,
         int bytes_in,
         int* bytes_out) = 0;
 
+    // Encrypts a RTCP packet. Otherwise, this method has the same contract as
+    // encrypt().
     virtual void encrypt_rtcp(
-        int channel_no,
+        int channel,
         unsigned char* in_data,
         unsigned char* out_data,
         int bytes_in,
         int* bytes_out) = 0;
 
+    // Decrypts a RTCP packet. Otherwise, this method has the same contract as
+    // decrypt().
     virtual void decrypt_rtcp(
-        int channel_no,
+        int channel,
         unsigned char* in_data,
         unsigned char* out_data,
         int bytes_in,
@@ -507,10 +536,9 @@
     VideoCodecGeneric   Generic;
 };
 
-/*
-*  Simulcast is when the same stream is encoded multiple times with different
-*  settings such as resolution.  
-*/
+
+// Simulcast is when the same stream is encoded multiple times with different
+// settings such as resolution.
 struct SimulcastStream
 {
     unsigned short      width;