Removed Version function from all modules.
TBR=henrik_a Review URL: http://webrtc-codereview.appspot.com/329023 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1330 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
		| @@ -80,25 +80,6 @@ class AudioCodingModule: public Module { | ||||
|   //   Utility functions | ||||
|   // | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_Word32 GetVersion() | ||||
|   // Returns version of the module and its components. | ||||
|   // | ||||
|   // Outputs: | ||||
|   //   -version            : a buffer that the version string is stored. | ||||
|   //   -remainBuffBytes    : remaining size of the buffer "version" in | ||||
|   //                         bytes, excluding terminating-null. | ||||
|   //   -position           : the first character of the ACM version will | ||||
|   //                         written to version[position] and so on. | ||||
|   // | ||||
|   // Return value: | ||||
|   //   -1 if failed to write the whole version string, | ||||
|   //    0 if succeeded. | ||||
|   // | ||||
|   static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainBuffBytes, | ||||
|                                   WebRtc_UWord32& position); | ||||
|  | ||||
|   /////////////////////////////////////////////////////////////////////////// | ||||
|   // WebRtc_UWord8 NumberOfCodecs() | ||||
|   // Returns number of supported codecs. | ||||
|   | ||||
| @@ -33,42 +33,6 @@ AudioCodingModule::Destroy( | ||||
|     delete static_cast<AudioCodingModuleImpl*> (module); | ||||
| } | ||||
|  | ||||
| // Returns version of the module and its components. | ||||
| WebRtc_Word32 | ||||
| AudioCodingModule::GetVersion( | ||||
|     WebRtc_Word8*   version, | ||||
|     WebRtc_UWord32& remainingBufferInBytes, | ||||
|     WebRtc_UWord32& position) | ||||
| { | ||||
|     WebRtc_Word32 len = position; | ||||
|     strncpy(&version[position], "AudioCodingModule 1.3.0\n", remainingBufferInBytes); | ||||
|  | ||||
|     position = static_cast<WebRtc_UWord32>(strlen(version)); | ||||
|     remainingBufferInBytes -= (position - len); | ||||
|  | ||||
|     // Get NetEQ version. | ||||
|     if(ACMNetEQ::GetVersion(version, | ||||
|         remainingBufferInBytes, position) < 0) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|  | ||||
|     // Set position and size before calling ACMCodecDB::CodecsVersion | ||||
|     // to get versions of all codecs. | ||||
|     size_t current_position = position; | ||||
|     size_t current_remaining_bytes = remainingBufferInBytes; | ||||
|     if(ACMCodecDB::CodecsVersion(version, | ||||
|           ¤t_remaining_bytes, ¤t_position) < 0) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|  | ||||
|     // Update position and size of version vector. | ||||
|     remainingBufferInBytes = current_remaining_bytes; | ||||
|     position = current_position; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| // Get number of supported codecs | ||||
| WebRtc_UWord8 AudioCodingModule::NumberOfCodecs() | ||||
| { | ||||
|   | ||||
| @@ -289,23 +289,6 @@ AudioCodingModuleImpl::ChangeUniqueId( | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| AudioCodingModuleImpl::Version( | ||||
|     WebRtc_Word8*   version, | ||||
|     WebRtc_UWord32& remainingBufferInBytes, | ||||
|     WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceAudioCoding, _id, | ||||
|         "Version()"); | ||||
|     if(version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id, | ||||
|             "Input buffer is NULL"); | ||||
|         return -1; | ||||
|     } | ||||
|     return GetVersion(version, remainingBufferInBytes, position); | ||||
| } | ||||
|  | ||||
| // returns the number of milliseconds until the module want a | ||||
| // worker thread to call Process | ||||
| WebRtc_Word32 | ||||
|   | ||||
| @@ -109,14 +109,6 @@ TEST(AudioCodingModuleTest, RunAllTests) | ||||
|     std::vector<ACMTest*> tests; | ||||
|     PopulateTests(&tests); | ||||
|     std::vector<ACMTest*>::iterator it; | ||||
|     WebRtc_Word8 version[5000]; | ||||
|     version[0] = '\0'; | ||||
|  | ||||
|     WebRtc_UWord32 remainingBufferInByte = 4999; | ||||
|     WebRtc_UWord32 position = 0; | ||||
|     AudioCodingModule::GetVersion(version, remainingBufferInByte, position); | ||||
|      | ||||
|     printf("%s\n", version); | ||||
|     for (it=tests.begin() ; it < tests.end(); it++) | ||||
|     { | ||||
|         (*it)->Perform(); | ||||
|   | ||||
| @@ -38,11 +38,6 @@ public: | ||||
|     static AudioConferenceMixer* Create(int id); | ||||
|     virtual ~AudioConferenceMixer() {} | ||||
|  | ||||
|     // Returns version of the module and its components | ||||
|     static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                     WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                     WebRtc_UWord32& position); | ||||
|  | ||||
|     // Module functions | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0; | ||||
|     virtual WebRtc_Word32 TimeUntilNextProcess() = 0 ; | ||||
|   | ||||
| @@ -169,21 +169,6 @@ AudioConferenceMixerImpl::~AudioConferenceMixerImpl() | ||||
|     assert(_audioFramePool == NULL); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 AudioConferenceMixerImpl::Version( | ||||
|     WebRtc_Word8* version, | ||||
|     WebRtc_UWord32& remainingBufferInBytes, | ||||
|     WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE( | ||||
|         kTraceModuleCall, | ||||
|         kTraceAudioMixerServer, | ||||
|         _id, | ||||
|         "Version(version%s,remainingBufferLengthInBytes:%d,position:%d)", | ||||
|         (version==NULL) ? ":NULL" : "", | ||||
|         remainingBufferInBytes,position); | ||||
|     return GetVersion(version,remainingBufferInBytes,position); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 AudioConferenceMixerImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id, | ||||
| @@ -192,38 +177,6 @@ WebRtc_Word32 AudioConferenceMixerImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 AudioConferenceMixer::GetVersion( | ||||
|     WebRtc_Word8* version, | ||||
|     WebRtc_UWord32& remainingBufferInBytes, | ||||
|     WebRtc_UWord32& position) | ||||
| { | ||||
|     WEBRTC_TRACE( | ||||
|         kTraceModuleCall, | ||||
|         kTraceAudioMixerServer, | ||||
|         -1, | ||||
|         "Version(version%s,remainingBufferLengthInBytes:%d,position:%d)", | ||||
|         (version==NULL) ? "NULL" : "", | ||||
|         remainingBufferInBytes, | ||||
|         position); | ||||
|     if(version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, -1, | ||||
|                      "Invalid in argument to GetVersion()"); | ||||
|         return -1; | ||||
|     } | ||||
|     const char moduleVersion[] = VERSION_STRING; | ||||
|     if(remainingBufferInBytes < sizeof(moduleVersion)) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, -1, | ||||
|                      "Too small buffer in GetVersion()"); | ||||
|         return -1; | ||||
|     } | ||||
|     strncpy(version, moduleVersion, sizeof(moduleVersion));  // null termination | ||||
|     remainingBufferInBytes -= sizeof(moduleVersion); | ||||
|     position += sizeof(moduleVersion); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| // Process should be called every kProcessPeriodicityInMs ms | ||||
| WebRtc_Word32 AudioConferenceMixerImpl::TimeUntilNextProcess() | ||||
| { | ||||
|   | ||||
| @@ -21,8 +21,6 @@ | ||||
| #include "scoped_ptr.h" | ||||
| #include "time_scheduler.h" | ||||
|  | ||||
| #define VERSION_STRING "Audio Conference Mixer Module 1.1.0" | ||||
|  | ||||
| namespace webrtc { | ||||
| class AudioProcessing; | ||||
| class CriticalSectionWrapper; | ||||
| @@ -62,9 +60,6 @@ public: | ||||
|     bool Init(); | ||||
|  | ||||
|     // Module functions | ||||
|     virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) const; | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|     virtual WebRtc_Word32 TimeUntilNextProcess(); | ||||
|     virtual WebRtc_Word32 Process(); | ||||
|   | ||||
| @@ -459,32 +459,6 @@ WebRtc_Word32 AudioDeviceModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| // ---------------------------------------------------------------------------- | ||||
| //  Module::Version | ||||
| // ---------------------------------------------------------------------------- | ||||
|  | ||||
| WebRtc_Word32 AudioDeviceModuleImpl::Version(WebRtc_Word8* version, WebRtc_UWord32& remainingBufferInBytes, WebRtc_UWord32& position) const | ||||
| { | ||||
|     if (version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, -1, "invalid buffer pointer in argument"); | ||||
|         return -1; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[] = "AudioDevice 1.1.0"; | ||||
|     WebRtc_UWord32 ourLength = (WebRtc_UWord32)strlen(ourVersion); | ||||
|     if (remainingBufferInBytes < (ourLength + 1)) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1, "version string requires %d bytes", (ourLength + 1)); | ||||
|         return -1; | ||||
|     } | ||||
|     memcpy(&version[position], ourVersion, ourLength); | ||||
|     version[position + ourLength] = '\0'; // null terminaion | ||||
|     remainingBufferInBytes -= (ourLength + 1); | ||||
|     position += (ourLength + 1); | ||||
|     WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, -1, "version: %s", version); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| // ---------------------------------------------------------------------------- | ||||
| //  Module::TimeUntilNextProcess | ||||
| // | ||||
|   | ||||
| @@ -43,9 +43,6 @@ public: | ||||
|  | ||||
| public: // RefCountedModule | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|     virtual WebRtc_Word32 Version( | ||||
|         WebRtc_Word8 *version, WebRtc_UWord32& remainingBufferInBytes, | ||||
|         WebRtc_UWord32& position) const; | ||||
|     virtual WebRtc_Word32 TimeUntilNextProcess(); | ||||
|     virtual WebRtc_Word32 Process(); | ||||
|  | ||||
|   | ||||
| @@ -320,24 +320,6 @@ int api_test() | ||||
|  | ||||
|     processThread->RegisterModule(audioDevice); | ||||
|  | ||||
|     // =============== | ||||
|     // Module::Version | ||||
|     // =============== | ||||
|  | ||||
|     WebRtc_Word8 version[256]; | ||||
|     WebRtc_UWord32 remainingBufferInBytes = 256; | ||||
|     WebRtc_UWord32 tooFewBytes = 10; | ||||
|     WebRtc_UWord32 position = 0; | ||||
|  | ||||
|     TEST(audioDevice->Version(version, tooFewBytes, position) == -1); | ||||
|     TEST(audioDevice->Version(NULL, remainingBufferInBytes, position) == -1); | ||||
|  | ||||
|     TEST(audioDevice->Version(version, remainingBufferInBytes, position) == 0); | ||||
|     TEST(position == 18); // assumes "AudioDevice x.y.z" + NULL | ||||
|     TEST(remainingBufferInBytes == (256-position)); | ||||
|  | ||||
|     TEST_LOG("Version: %s\n\n", version); | ||||
|  | ||||
|     AudioDeviceModule::AudioLayer audioLayer = | ||||
|         AudioDeviceModule::kPlatformDefaultAudio; | ||||
|     TEST(audioDevice->ActiveAudioLayer(&audioLayer) == 0); | ||||
|   | ||||
| @@ -616,14 +616,6 @@ WebRtc_Word32 FuncTestManager::Init() | ||||
|     _audioTransport = new AudioTransportImpl(_audioDevice); | ||||
|     TEST(_audioDevice->RegisterAudioCallback(_audioTransport) == 0); | ||||
|  | ||||
|     WebRtc_Word8 version[256]; | ||||
|     WebRtc_UWord32 remainingBufferInBytes = 256; | ||||
|     WebRtc_UWord32 position = 0; | ||||
|  | ||||
|     // log version | ||||
|     TEST(_audioDevice->Version(version, remainingBufferInBytes, position) == 0); | ||||
|     TEST_LOG("Version: %s\n \n", version); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -552,61 +552,6 @@ VoiceDetection* AudioProcessingImpl::voice_detection() const { | ||||
|   return voice_detection_; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 AudioProcessingImpl::Version(WebRtc_Word8* version, | ||||
|     WebRtc_UWord32& bytes_remaining, WebRtc_UWord32& position) const { | ||||
|   if (version == NULL) { | ||||
|     /*WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                webrtc::kTraceAudioProcessing, | ||||
|                -1, | ||||
|                "Null version pointer");*/ | ||||
|     return kNullPointerError; | ||||
|   } | ||||
|   memset(&version[position], 0, bytes_remaining); | ||||
|  | ||||
|   char my_version[] = "AudioProcessing 1.0.0"; | ||||
|   // Includes null termination. | ||||
|   WebRtc_UWord32 length = static_cast<WebRtc_UWord32>(strlen(my_version)); | ||||
|   if (bytes_remaining < length) { | ||||
|     /*WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                webrtc::kTraceAudioProcessing, | ||||
|                -1, | ||||
|                "Buffer of insufficient length");*/ | ||||
|     return kBadParameterError; | ||||
|   } | ||||
|   memcpy(&version[position], my_version, length); | ||||
|   bytes_remaining -= length; | ||||
|   position += length; | ||||
|  | ||||
|   std::list<ProcessingComponent*>::const_iterator it; | ||||
|   for (it = component_list_.begin(); it != component_list_.end(); it++) { | ||||
|     char component_version[256]; | ||||
|     strcpy(component_version, "\n"); | ||||
|     int err = (*it)->get_version(&component_version[1], | ||||
|                                  sizeof(component_version) - 1); | ||||
|     if (err != kNoError) { | ||||
|       return err; | ||||
|     } | ||||
|     if (strncmp(&component_version[1], "\0", 1) == 0) { | ||||
|       // Assume empty if first byte is NULL. | ||||
|       continue; | ||||
|     } | ||||
|  | ||||
|     length = static_cast<WebRtc_UWord32>(strlen(component_version)); | ||||
|     if (bytes_remaining < length) { | ||||
|       /*WEBRTC_TRACE(webrtc::kTraceError, | ||||
|                  webrtc::kTraceAudioProcessing, | ||||
|                  -1, | ||||
|                  "Buffer of insufficient length");*/ | ||||
|       return kBadParameterError; | ||||
|     } | ||||
|     memcpy(&version[position], component_version, length); | ||||
|     bytes_remaining -= length; | ||||
|     position += length; | ||||
|   } | ||||
|  | ||||
|   return kNoError; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 AudioProcessingImpl::ChangeUniqueId(const WebRtc_Word32 id) { | ||||
|   CriticalSectionScoped crit_scoped(*crit_); | ||||
|   /*WEBRTC_TRACE(webrtc::kTraceModuleCall, | ||||
|   | ||||
| @@ -80,9 +80,6 @@ class AudioProcessingImpl : public AudioProcessing { | ||||
|   virtual VoiceDetection* voice_detection() const; | ||||
|  | ||||
|   // Module methods. | ||||
|   virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                               WebRtc_UWord32& remainingBufferInBytes, | ||||
|                               WebRtc_UWord32& position) const; | ||||
|   virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|  | ||||
|  private: | ||||
|   | ||||
| @@ -127,7 +127,6 @@ void usage() { | ||||
|   printf("  --quiet            Suppress text output.\n"); | ||||
|   printf("  --no_progress      Suppress progress.\n"); | ||||
|   printf("  --debug_file FILE  Dump a debug recording.\n"); | ||||
|   printf("  --version          Print version information and exit.\n"); | ||||
| } | ||||
|  | ||||
| // void function for gtest. | ||||
| @@ -145,10 +144,6 @@ void void_main(int argc, char* argv[]) { | ||||
|   AudioProcessing* apm = AudioProcessing::Create(0); | ||||
|   ASSERT_TRUE(apm != NULL); | ||||
|  | ||||
|   WebRtc_Word8 version[1024]; | ||||
|   WebRtc_UWord32 version_bytes_remaining = sizeof(version); | ||||
|   WebRtc_UWord32 version_position = 0; | ||||
|  | ||||
|   const char* pb_filename = NULL; | ||||
|   const char* far_filename = NULL; | ||||
|   const char* near_filename = NULL; | ||||
| @@ -368,13 +363,6 @@ void void_main(int argc, char* argv[]) { | ||||
|     } else if (strcmp(argv[i], "--no_progress") == 0) { | ||||
|       progress = false; | ||||
|  | ||||
|     } else if (strcmp(argv[i], "--version") == 0) { | ||||
|       ASSERT_EQ(apm->kNoError, apm->Version(version, | ||||
|                                             version_bytes_remaining, | ||||
|                                             version_position)); | ||||
|       printf("%s\n", version); | ||||
|       return; | ||||
|  | ||||
|     } else if (strcmp(argv[i], "--debug_file") == 0) { | ||||
|       i++; | ||||
|       ASSERT_LT(i, argc) << "Specify filename after --debug_file"; | ||||
|   | ||||
| @@ -19,11 +19,6 @@ namespace webrtc { | ||||
|  | ||||
| class Module { | ||||
|  public: | ||||
|   // Returns version of the module and its components. | ||||
|   virtual int32_t Version(char* version, | ||||
|                           uint32_t& remaining_buffer_in_bytes, | ||||
|                           uint32_t& position) const = 0; | ||||
|  | ||||
|   // Change the unique identifier of this object. | ||||
|   virtual int32_t ChangeUniqueId(const int32_t id) = 0; | ||||
|  | ||||
|   | ||||
| @@ -26,15 +26,6 @@ public: | ||||
|     static MediaFile* CreateMediaFile(const WebRtc_Word32 id); | ||||
|     static void DestroyMediaFile(MediaFile* module); | ||||
|  | ||||
|     // Writes the version of the MediaFile to version. remainingBufferInBytes | ||||
|     // is both an input parameter and an output parameter. It indicates the size | ||||
|     // of version less messages in it. position is both an input parameter and | ||||
|     // an output parameter. It indicates the position of the NULL termination | ||||
|     // in the version string. | ||||
|     static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                     WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                     WebRtc_UWord32& position); | ||||
|  | ||||
|     // Set the MediaFile instance identifier. | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0; | ||||
|  | ||||
|   | ||||
| @@ -94,42 +94,6 @@ MediaFileImpl::~MediaFileImpl() | ||||
|     delete _callbackCrit; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 MediaFileImpl::Version(WebRtc_Word8* version, | ||||
|                                      WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                      WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceFile, _id, | ||||
|                  "Version(?,bufferLength:%d,position:%d)", | ||||
|                  remainingBufferInBytes, position); | ||||
|     return GetVersion(version, remainingBufferInBytes, position); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 MediaFile::GetVersion(WebRtc_Word8* version, | ||||
|                                     WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                     WebRtc_UWord32& position) | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceFile, -1, | ||||
|                  "GetVersion(?,bufferLength:%d,position:%d)", | ||||
|                  remainingBufferInBytes, position); | ||||
|     if(version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, kTraceFile, -1, | ||||
|                      "Invalid buffer pointer in argument to Version()"); | ||||
|         return -1; | ||||
|     } | ||||
|     const WebRtc_Word8 ourVersion[] = "MediaFile 1.0.0"; | ||||
|     const WebRtc_UWord32 ourLength =(WebRtc_UWord32)strlen(ourVersion); | ||||
|     if(remainingBufferInBytes <(ourLength + 1)) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     memcpy(&version[position], ourVersion, ourLength); | ||||
|     version[position + ourLength] = '\0'; | ||||
|     remainingBufferInBytes -=(ourLength + 1); | ||||
|     position +=(ourLength + 1); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 MediaFileImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceFile, _id, "ChangeUniqueId(new id:%d)", | ||||
|   | ||||
| @@ -25,11 +25,6 @@ public: | ||||
|     MediaFileImpl(const WebRtc_Word32 id); | ||||
|     ~MediaFileImpl(); | ||||
|  | ||||
|     // Module functions | ||||
|     WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                           WebRtc_UWord32& remainingBufferInBytes, | ||||
|                           WebRtc_UWord32& position) const; | ||||
|  | ||||
|     WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|     WebRtc_Word32 Process(); | ||||
|     WebRtc_Word32 TimeUntilNextProcess(); | ||||
|   | ||||
| @@ -49,17 +49,6 @@ public: | ||||
|     */ | ||||
|     static void DestroyRtpRtcp(RtpRtcp* module); | ||||
|  | ||||
|     /* | ||||
|     *   Returns version of the module and its components | ||||
|     * | ||||
|     *   version                 - buffer to which the version will be written | ||||
|     *   remainingBufferInBytes  - remaining number of WebRtc_Word8 in the version buffer | ||||
|     *   position                - position of the next empty WebRtc_Word8 in the version buffer | ||||
|     */ | ||||
|     static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position); | ||||
|  | ||||
|     /* | ||||
|     *   Change the unique identifier of this object | ||||
|     * | ||||
|   | ||||
| @@ -170,44 +170,6 @@ ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() | ||||
|     delete _criticalSectionModulePtrsFeedback; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ModuleRtpRtcpImpl::Version(WebRtc_Word8*   version, | ||||
|                            WebRtc_UWord32& remainingBufferInBytes, | ||||
|                            WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, | ||||
|                  kTraceRtpRtcp, | ||||
|                  _id, | ||||
|                  "Version(bufferLength:%d)", | ||||
|                  remainingBufferInBytes); | ||||
|     return GetVersion(version, remainingBufferInBytes, position); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 RtpRtcp::GetVersion(WebRtc_Word8*   version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) | ||||
| { | ||||
|     if(version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, | ||||
|                      kTraceRtpRtcp, | ||||
|                      -1, | ||||
|                      "Invalid in argument to Version()"); | ||||
|         return -1; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[] = "Module RTP RTCP 1.3.0"; | ||||
|     WebRtc_UWord32 ourLength = (WebRtc_UWord32)strlen(ourVersion); | ||||
|     if(remainingBufferInBytes < ourLength +1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     memcpy(version, ourVersion, ourLength); | ||||
|     version[ourLength] = '\0'; // null terminaion | ||||
|     remainingBufferInBytes -= (ourLength + 1); | ||||
|     position += (ourLength + 1); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| ModuleRtpRtcpImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
| { | ||||
|   | ||||
| @@ -38,11 +38,6 @@ public: | ||||
|     // get Module ID | ||||
|     WebRtc_Word32 Id()   {return _id;} | ||||
|  | ||||
|     // Get Module version | ||||
|     WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                         WebRtc_UWord32& remainingBufferInBytes, | ||||
|                         WebRtc_UWord32& position) const; | ||||
|  | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|  | ||||
|     // De-muxing functionality for | ||||
|   | ||||
| @@ -195,31 +195,6 @@ WebRtc_Word32 UdpTransportImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 UdpTransportImpl::Version(WebRtc_Word8* version, | ||||
|                                         WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                         WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceTransport, _id, "%s", __FUNCTION__); | ||||
|     if(version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceError, kTraceTransport, _id, | ||||
|                      "Version pointer is NULL"); | ||||
|         return -1; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[256] = "UdpTransport 1.1.0"; | ||||
|     WebRtc_Word32 ourLength = (WebRtc_Word32)strlen(ourVersion); | ||||
|     if((WebRtc_Word32)remainingBufferInBytes < ourLength +1) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, kTraceTransport, _id, | ||||
|                      "Version buffer not long enough"); | ||||
|         return -1; | ||||
|     } | ||||
|     memcpy(version, ourVersion, ourLength); | ||||
|     version[ourLength] = 0; | ||||
|     position += ourLength; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 UdpTransportImpl::TimeUntilNextProcess() | ||||
| { | ||||
|     return 100; | ||||
|   | ||||
| @@ -28,9 +28,6 @@ public: | ||||
|  | ||||
|     // Module functions | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|     virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) const; | ||||
|     virtual WebRtc_Word32 TimeUntilNextProcess(); | ||||
|     virtual WebRtc_Word32 Process(); | ||||
|  | ||||
|   | ||||
| @@ -36,38 +36,6 @@ VideoCaptureModule* VideoCaptureImpl::Create( | ||||
|     return implementation; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 VideoCaptureImpl::Version(WebRtc_Word8* version, | ||||
|                                               WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                               WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, _id, "Version(bufferLength:%u)", | ||||
|                (unsigned int) remainingBufferInBytes); | ||||
|     return GetVersion(version, remainingBufferInBytes, position); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 VideoCaptureImpl::GetVersion(WebRtc_Word8* version, | ||||
|                                                  WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                                  WebRtc_UWord32& position) | ||||
| { | ||||
|     if (version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, -1, | ||||
|                    "Invalid in argument to Version()"); | ||||
|         return -1; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[] = "VideoCaptureModule 1.1.0"; | ||||
|     WebRtc_UWord32 ourLength = (WebRtc_UWord32) strlen(ourVersion); | ||||
|     if (remainingBufferInBytes < ourLength + 1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     memcpy(version, ourVersion, ourLength); | ||||
|     version[ourLength] = '\0'; // null terminaion | ||||
|     remainingBufferInBytes -= (ourLength + 1); | ||||
|     position += (ourLength + 1); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| const WebRtc_UWord8* VideoCaptureImpl::CurrentDeviceName() const | ||||
| { | ||||
|     return _deviceUniqueId; | ||||
|   | ||||
| @@ -50,19 +50,9 @@ public: | ||||
|  | ||||
|     static DeviceInfo* CreateDeviceInfo(const WebRtc_Word32 id); | ||||
|  | ||||
|     static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                     WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                     WebRtc_UWord32& position); | ||||
|  | ||||
|  | ||||
|  | ||||
|     // Implements Module declared functions. | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|  | ||||
|     virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) const; | ||||
|  | ||||
|     //Call backs | ||||
|     virtual WebRtc_Word32 RegisterCaptureDataCallback(VideoCaptureDataCallback& dataCallback); | ||||
|     virtual WebRtc_Word32 DeRegisterCaptureDataCallback(); | ||||
|   | ||||
| @@ -229,51 +229,6 @@ VideoCodingModuleImpl::Process() | ||||
|     return returnValue; | ||||
| } | ||||
|  | ||||
| // Returns version of the module and its components | ||||
| WebRtc_Word32 | ||||
| VideoCodingModuleImpl::Version(WebRtc_Word8* version, | ||||
|                                 WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                 WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(webrtc::kTraceModuleCall, | ||||
|                  webrtc::kTraceVideoCoding, | ||||
|                  VCMId(_id), | ||||
|                  "Version()"); | ||||
|     if (version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceWarning, | ||||
|                      webrtc::kTraceVideoCoding, | ||||
|                      VCMId(_id), | ||||
|                      "Invalid buffer pointer in argument to Version()"); | ||||
|         return VCM_PARAMETER_ERROR; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[] = "VideoCodingModule 1.1.0\n"; | ||||
|     WebRtc_UWord32 ourLength = (WebRtc_UWord32)strlen(ourVersion); | ||||
|     if (remainingBufferInBytes < ourLength) | ||||
|     { | ||||
|         return VCM_MEMORY; | ||||
|     } | ||||
|     memcpy(&version[position], ourVersion, ourLength); | ||||
|     remainingBufferInBytes -= ourLength; | ||||
|     position += ourLength; | ||||
|  | ||||
|     // Safe to truncate here. | ||||
|     WebRtc_Word32 ret = _codecDataBase.Version(version, | ||||
|                                                remainingBufferInBytes, | ||||
|                                                position); | ||||
|     if (ret < 0) | ||||
|     { | ||||
|         return ret; | ||||
|     } | ||||
|     // Ensure the strlen call is safe by terminating at the end of version. | ||||
|     version[position + remainingBufferInBytes - 1] = '\0'; | ||||
|     ourLength = (WebRtc_UWord32)strlen(&version[position]); | ||||
|     remainingBufferInBytes -= (ourLength + 1); // include null termination. | ||||
|     position += (ourLength + 1); | ||||
|  | ||||
|     return VCM_OK; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| VideoCodingModuleImpl::Id() const | ||||
| { | ||||
|   | ||||
| @@ -63,11 +63,6 @@ public: | ||||
|  | ||||
|     virtual ~VideoCodingModuleImpl(); | ||||
|  | ||||
|     // Returns version of the module and its components | ||||
|     WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                           WebRtc_UWord32& remainingBufferInBytes, | ||||
|                           WebRtc_UWord32& position) const; | ||||
|  | ||||
|     WebRtc_Word32 Id() const; | ||||
|  | ||||
|     //  Change the unique identifier of this object | ||||
|   | ||||
| @@ -104,11 +104,6 @@ CodecDataBaseTest::Perform(CmdArgs& args) | ||||
|     /************************/ | ||||
|     VideoCodec sendCodec, receiveCodec; | ||||
|     TEST(VideoCodingModule::NumberOfCodecs() > 0); | ||||
|     WebRtc_Word8 version[512]; | ||||
|     WebRtc_UWord32 length = 512; | ||||
|     WebRtc_UWord32 position = 0; | ||||
|     TEST(_vcm->Version(version, length, position) == VCM_OK); | ||||
|     printf("%s", version); | ||||
|     _vcm->InitializeReceiver(); | ||||
|     _vcm->InitializeSender(); | ||||
|     VCMDecodeCompleteCallback *_decodeCallback = new VCMDecodeCompleteCallback(_decodedFile); | ||||
|   | ||||
| @@ -89,27 +89,6 @@ public: | ||||
|     */ | ||||
|     static void Destroy(VideoProcessingModule* module); | ||||
|  | ||||
|     /** | ||||
|        Retrieves the version of the module and its components. | ||||
|        | ||||
|        \param[in,out] version | ||||
|            Buffer to which the null-terminated version string will be copied. | ||||
|        | ||||
|        \param[in,out] remainingBufferInBytes  | ||||
|            Bytes remaining between the supplied position and the end of the buffer. | ||||
|            This will reflect the new remaining size at return. | ||||
|         | ||||
|        \param[in,out] position | ||||
|            Position in bytes within the buffer to place the version string. This  | ||||
|            will reflect the first byte position following the version string at  | ||||
|            return.  | ||||
|        | ||||
|        \return 0 on success, -1 on failure. | ||||
|     */ | ||||
|     static WebRtc_Word32 GetVersion(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position); | ||||
|  | ||||
|     /** | ||||
|        Not supported. | ||||
|     */ | ||||
|   | ||||
| @@ -80,17 +80,6 @@ VideoProcessingModuleImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
|     return VPM_OK; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| VideoProcessingModuleImpl::Version(WebRtc_Word8* version, | ||||
|                                        WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                        WebRtc_UWord32& position) const | ||||
| { | ||||
|     CriticalSectionScoped mutex(_mutex); | ||||
|     WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoPreocessing, _id, "Version(bufferLength:%d)", | ||||
|         remainingBufferInBytes); | ||||
|     return GetVersion(version, remainingBufferInBytes, position); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| VideoProcessingModuleImpl::Id() const | ||||
| { | ||||
| @@ -98,32 +87,6 @@ VideoProcessingModuleImpl::Id() const | ||||
|     return _id; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 | ||||
| VideoProcessingModule::GetVersion(WebRtc_Word8* version, | ||||
|                                       WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                       WebRtc_UWord32& position) | ||||
| { | ||||
|     if (version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoPreocessing, -1, | ||||
|             "Null version pointer"); | ||||
|         return -1; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[] = "VideoProcessingModule 1.1.0"; | ||||
|     WebRtc_UWord32 ourLength = (WebRtc_UWord32)sizeof(ourVersion); // Includes null termination. | ||||
|     if (remainingBufferInBytes < ourLength) | ||||
|     { | ||||
|         WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoPreocessing, -1, | ||||
|             "Buffer of insufficient length"); | ||||
|         return VPM_PARAMETER_ERROR; | ||||
|     } | ||||
|     memcpy(&version[position], ourVersion, ourLength); | ||||
|     remainingBufferInBytes -= ourLength; | ||||
|     position += ourLength; | ||||
|  | ||||
|     return VPM_OK; | ||||
| } | ||||
|  | ||||
| VideoProcessingModuleImpl::VideoProcessingModuleImpl(const WebRtc_Word32 id) : | ||||
|     _id(id), | ||||
|     _mutex(*CriticalSectionWrapper::CreateCriticalSection()) | ||||
|   | ||||
| @@ -30,10 +30,6 @@ public: | ||||
|  | ||||
|     virtual ~VideoProcessingModuleImpl(); | ||||
|  | ||||
|     virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) const; | ||||
|  | ||||
|     WebRtc_Word32 Id() const; | ||||
|  | ||||
|     virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id); | ||||
|   | ||||
| @@ -60,31 +60,6 @@ void VideoProcessingModuleTest::TearDown() | ||||
|   _vpm = NULL; | ||||
| } | ||||
|  | ||||
| TEST_F(VideoProcessingModuleTest, GetVersionTest) | ||||
| { | ||||
|   WebRtc_Word8 version[255]; | ||||
|   WebRtc_UWord32 remainingBuffer = sizeof(version); | ||||
|   WebRtc_UWord32 position = 0; | ||||
|  | ||||
|   EXPECT_EQ(-1, VideoProcessingModule::GetVersion(NULL, remainingBuffer, | ||||
|                                                   position)); | ||||
|   EXPECT_EQ(-1, _vpm->GetVersion(NULL, remainingBuffer, position)); | ||||
|  | ||||
|   WebRtc_UWord32 badRemainingBuffer = 5; | ||||
|   EXPECT_EQ(-3, VideoProcessingModule::GetVersion(version, badRemainingBuffer, | ||||
|                                                   position)); | ||||
|   EXPECT_EQ(-3, _vpm->GetVersion(version, badRemainingBuffer, position)); | ||||
|  | ||||
|   EXPECT_EQ(0, VideoProcessingModule::GetVersion(version, remainingBuffer, | ||||
|                                                  position)); | ||||
|   EXPECT_EQ(remainingBuffer, sizeof(version) - position); | ||||
|   printf("\n%s\n\n", version); | ||||
|  | ||||
|   EXPECT_EQ(0, _vpm->GetVersion(&version[position], remainingBuffer, | ||||
|                                 position)); | ||||
|   EXPECT_EQ(remainingBuffer, sizeof(version) - position); | ||||
| } | ||||
|  | ||||
| TEST_F(VideoProcessingModuleTest, HandleNullBuffer) | ||||
| { | ||||
|   VideoProcessingModule::FrameStats stats; | ||||
|   | ||||
| @@ -51,17 +51,6 @@ public: | ||||
|      */ | ||||
|     static void DestroyVideoRender(VideoRender* module); | ||||
|  | ||||
|     /* | ||||
|      *   Returns version of the module and its components | ||||
|      * | ||||
|      *   version                 - buffer to which the version will be written | ||||
|      *   remainingBufferInBytes  - remaining number of WebRtc_Word8 in the version buffer | ||||
|      *   position                - position of the next empty WebRtc_Word8 in the version buffer | ||||
|      */ | ||||
|     virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) const = 0; | ||||
|  | ||||
|     /* | ||||
|      *   Change the unique identifier of this object | ||||
|      * | ||||
|   | ||||
| @@ -328,33 +328,6 @@ ModuleVideoRenderImpl::~ModuleVideoRenderImpl() | ||||
|     } | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 ModuleVideoRenderImpl::Version( | ||||
|                                              WebRtc_Word8* version, | ||||
|                                              WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                              WebRtc_UWord32& position) const | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceVideoRenderer, _id, | ||||
|                  "%s", __FUNCTION__); | ||||
|     if (version == NULL) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id, | ||||
|                      "Version pointer is NULL"); | ||||
|         return -1; | ||||
|     } | ||||
|     WebRtc_Word8 ourVersion[256] = "VideoRender 1.1.0"; | ||||
|     WebRtc_Word32 ourLength = (WebRtc_Word32) strlen(ourVersion); | ||||
|     if ((WebRtc_Word32) remainingBufferInBytes < ourLength + 1) | ||||
|     { | ||||
|         WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, _id, | ||||
|                      "Version buffer not long enough"); | ||||
|         return -1; | ||||
|     } | ||||
|     memcpy(version, ourVersion, ourLength); | ||||
|     version[ourLength] = 0; // null terminaion | ||||
|     position += ourLength; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 ModuleVideoRenderImpl::ChangeUniqueId(const WebRtc_Word32 id) | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceModuleCall, kTraceVideoRenderer, _id, | ||||
|   | ||||
| @@ -36,13 +36,6 @@ public: | ||||
|  | ||||
|     virtual ~ModuleVideoRenderImpl(); | ||||
|  | ||||
|     /* | ||||
|      *   Returns version of the module and its components | ||||
|      */ | ||||
|     virtual WebRtc_Word32 Version(WebRtc_Word8* version, | ||||
|                                   WebRtc_UWord32& remainingBufferInBytes, | ||||
|                                   WebRtc_UWord32& position) const; | ||||
|  | ||||
|     /* | ||||
|      *   Change the unique identifier of this object | ||||
|      */ | ||||
|   | ||||
| @@ -436,7 +436,6 @@ int ViEBaseImpl::GetVersion(char version[1024]) { | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
|  | ||||
| #ifdef WEBRTC_EXTERNAL_TRANSPORT | ||||
|   len = AddExternalTransportBuild(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
| @@ -445,63 +444,6 @@ int ViEBaseImpl::GetVersion(char version[1024]) { | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
| #endif | ||||
|  | ||||
|   len = AddVCMVersion(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
|     return -1; | ||||
|   } | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
|  | ||||
| #ifndef WEBRTC_EXTERNAL_TRANSPORT | ||||
|   len = AddSocketModuleVersion(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
|     return -1; | ||||
|   } | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
| #endif | ||||
|  | ||||
|   len = AddRtpRtcpModuleVersion(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
|     return -1; | ||||
|   } | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
|  | ||||
|   len = AddVideoCaptureVersion(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
|     return -1; | ||||
|   } | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
|  | ||||
|   len = AddRenderVersion(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
|     return -1; | ||||
|   } | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
|  | ||||
|   len = AddVideoProcessingVersion(version_ptr); | ||||
|   if (len == -1) { | ||||
|     SetLastError(kViEBaseUnknownError); | ||||
|     return -1; | ||||
|   } | ||||
|   version_ptr += len; | ||||
|   acc_len += len; | ||||
|   assert(acc_len < kViEVersionMaxMessageSize); | ||||
|  | ||||
|   memcpy(version, version_buf, acc_len); | ||||
|   version[acc_len] = '\0'; | ||||
| @@ -523,63 +465,12 @@ WebRtc_Word32 ViEBaseImpl::AddViEVersion(char* str) const { | ||||
|   return sprintf(str, "VideoEngine 3.1.0\n"); | ||||
| } | ||||
|  | ||||
| #ifdef WEBRTC_EXTERNAL_TRANSPORT | ||||
| WebRtc_Word32 ViEBaseImpl::AddExternalTransportBuild(char* str) const { | ||||
| #ifdef WEBRTC_EXTERNAL_TRANSPORT | ||||
|   return sprintf(str, "External transport build\n"); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| WebRtc_Word32 ViEBaseImpl::AddModuleVersion(webrtc::Module* module, | ||||
|                                             char* str) const { | ||||
|   WebRtc_Word8 version[kViEMaxModuleVersionSize]; | ||||
|   WebRtc_UWord32 remaining_buffer_in_bytes(kViEMaxModuleVersionSize); | ||||
|   WebRtc_UWord32 position(0); | ||||
|   if (module && module->Version(version, remaining_buffer_in_bytes, position) | ||||
|       == 0) { | ||||
|     return sprintf(str, "%s\n", version); | ||||
|   } | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 ViEBaseImpl::AddVCMVersion(char* str) const { | ||||
|   webrtc::VideoCodingModule* vcm_ptr = | ||||
|     webrtc::VideoCodingModule::Create(instance_id_); | ||||
|   int len = AddModuleVersion(vcm_ptr, str); | ||||
|   webrtc::VideoCodingModule::Destroy(vcm_ptr); | ||||
|   return len; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 ViEBaseImpl::AddVideoCaptureVersion(char* str) const { | ||||
| #else | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 ViEBaseImpl::AddVideoProcessingVersion(char* str) const { | ||||
|   webrtc::VideoProcessingModule* video_ptr = | ||||
|     webrtc::VideoProcessingModule::Create(instance_id_); | ||||
|   int len = AddModuleVersion(video_ptr, str); | ||||
|   webrtc::VideoProcessingModule::Destroy(video_ptr); | ||||
|   return len; | ||||
| } | ||||
| WebRtc_Word32 ViEBaseImpl::AddRenderVersion(char* str) const { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| #ifndef WEBRTC_EXTERNAL_TRANSPORT | ||||
| WebRtc_Word32 ViEBaseImpl::AddSocketModuleVersion(char* str) const { | ||||
|   WebRtc_UWord8 num_sock_threads(1); | ||||
|   UdpTransport* transport = UdpTransport::Create(instance_id_, | ||||
|                                                  num_sock_threads); | ||||
|   int len = AddModuleVersion(transport, str); | ||||
|   UdpTransport::Destroy(transport); | ||||
|   return len; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| WebRtc_Word32 ViEBaseImpl::AddRtpRtcpModuleVersion(char* str) const { | ||||
|   RtpRtcp* rtp_rtcp = RtpRtcp::CreateRtpRtcp(-1, true); | ||||
|   int len = AddModuleVersion(rtp_rtcp, str); | ||||
|   RtpRtcp::DestroyRtpRtcp(rtp_rtcp); | ||||
|   return len; | ||||
| } | ||||
|  | ||||
| }  // namespace webrtc | ||||
|   | ||||
| @@ -84,17 +84,7 @@ class ViEBaseImpl | ||||
|   // Version functions. | ||||
|   WebRtc_Word32 AddViEVersion(char* str) const; | ||||
|   WebRtc_Word32 AddBuildInfo(char* str) const; | ||||
| #ifdef WEBRTC_EXTERNAL_TRANSPORT | ||||
|   WebRtc_Word32 AddExternalTransportBuild(char* str) const; | ||||
| #else | ||||
|   WebRtc_Word32 AddSocketModuleVersion(char* str) const; | ||||
| #endif | ||||
|   WebRtc_Word32 AddModuleVersion(webrtc::Module* module, char* str) const; | ||||
|   WebRtc_Word32 AddVCMVersion(char* str) const; | ||||
|   WebRtc_Word32 AddVideoCaptureVersion(char* str) const; | ||||
|   WebRtc_Word32 AddVideoProcessingVersion(char* str) const; | ||||
|   WebRtc_Word32 AddRenderVersion(char* str) const; | ||||
|   WebRtc_Word32 AddRtpRtcpModuleVersion(char* str) const; | ||||
| }; | ||||
|  | ||||
| }  // namespace webrtc | ||||
|   | ||||
| @@ -1383,20 +1383,6 @@ Channel::Init() | ||||
|             "Channel::Init() modules not registered"); | ||||
|         return -1; | ||||
|     } | ||||
|  | ||||
|     // --- Log module versions | ||||
|  | ||||
|     Utility::TraceModuleVersion(VoEId(_instanceId,_channelId), | ||||
|                                 _audioCodingModule); | ||||
| #ifndef WEBRTC_EXTERNAL_TRANSPORT | ||||
|     Utility::TraceModuleVersion(VoEId(_instanceId,_channelId), | ||||
|                                 _socketTransportModule); | ||||
| #endif | ||||
| #ifdef WEBRTC_SRTP | ||||
|     Utility::TraceModuleVersion(VoEId(_instanceId,_channelId), _srtpModule); | ||||
| #endif | ||||
|     Utility::TraceModuleVersion(VoEId(_instanceId,_channelId), _rtpRtcpModule); | ||||
|  | ||||
|     // --- ACM initialization | ||||
|  | ||||
|     if ((_audioCodingModule.InitializeReceiver() == -1) || | ||||
|   | ||||
| @@ -94,27 +94,6 @@ void Utility::ScaleWithSat(WebRtc_Word16 vector[], float scale, | ||||
|     } | ||||
| } | ||||
|  | ||||
| void Utility::TraceModuleVersion(const WebRtc_Word32 id, | ||||
|                                  const Module& module) | ||||
| { | ||||
|     WebRtc_Word8 version[Utility::kMaxVersionSize] = { 0 }; | ||||
|     WebRtc_UWord32 remainingBufferInBytes = Utility::kMaxVersionSize; | ||||
|     WebRtc_UWord32 position = 0; | ||||
|     if (module.Version(version, remainingBufferInBytes, position) == 0) | ||||
|     { | ||||
|         WebRtc_Word8* ptr(NULL); | ||||
|         while ((ptr = strchr(version, '\t')) != NULL) | ||||
|         { | ||||
|             *ptr = ' '; | ||||
|         } | ||||
|         while ((ptr = strchr(version, '\n')) != NULL) | ||||
|         { | ||||
|             *ptr = ' '; | ||||
|         } | ||||
|         WEBRTC_TRACE(kTraceInfo, kTraceVoice, id, "%s", version); | ||||
|     } | ||||
| } | ||||
|  | ||||
| } // namespace voe | ||||
|  | ||||
| } // namespace webrtc | ||||
|   | ||||
| @@ -47,12 +47,6 @@ public: | ||||
|     static void ScaleWithSat(WebRtc_Word16 vector[], | ||||
|                              float scale, | ||||
|                              WebRtc_UWord16 len); | ||||
|  | ||||
|     static void TraceModuleVersion(const WebRtc_Word32 id, | ||||
|                                    const Module& module); | ||||
|  | ||||
| private: | ||||
|     enum {kMaxVersionSize = 640}; | ||||
| }; | ||||
|  | ||||
| } // namespace voe | ||||
|   | ||||
| @@ -508,9 +508,6 @@ int VoEBaseImpl::Init(AudioDeviceModule* external_adm) | ||||
|                 "Init() failed to create the AP module"); | ||||
|             return -1; | ||||
|         } | ||||
|         voe::Utility::TraceModuleVersion(VoEId(_instanceId, -1), | ||||
|                                          *_audioProcessingModulePtr); | ||||
|  | ||||
|         // Ensure that mixers in both directions has access to the created APM | ||||
|         _transmitMixerPtr->SetAudioProcessingModule(_audioProcessingModulePtr); | ||||
|         _outputMixerPtr->SetAudioProcessingModule(_audioProcessingModulePtr); | ||||
| @@ -1256,7 +1253,6 @@ int VoEBaseImpl::GetVersion(char version[1024]) | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
| #endif | ||||
|  | ||||
| #ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT | ||||
|     len = AddExternalRecAndPlayoutBuild(versionPtr); | ||||
|     if (len == -1) | ||||
| @@ -1268,82 +1264,6 @@ int VoEBaseImpl::GetVersion(char version[1024]) | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  #endif | ||||
|  | ||||
|     len = AddADMVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  | ||||
| #ifndef WEBRTC_EXTERNAL_TRANSPORT | ||||
|     len = AddSocketModuleVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
| #endif | ||||
|  | ||||
| #ifdef WEBRTC_SRTP | ||||
|     len = AddSRTPModuleVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
| #endif | ||||
|  | ||||
|     len = AddRtpRtcpModuleVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  | ||||
|     len = AddConferenceMixerVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  | ||||
|     len = AddAudioProcessingModuleVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  | ||||
|     len = AddACMVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  | ||||
|     len = AddSPLIBVersion(versionPtr); | ||||
|     if (len == -1) | ||||
|     { | ||||
|         return -1; | ||||
|     } | ||||
|     versionPtr += len; | ||||
|     accLen += len; | ||||
|     assert(accLen < kVoiceEngineVersionMaxMessageSize); | ||||
|  | ||||
|     memcpy(version, versionBuf, accLen); | ||||
|     version[accLen] = '\0'; | ||||
|  | ||||
| @@ -1385,14 +1305,6 @@ WebRtc_Word32 VoEBaseImpl::AddVoEVersion(char* str) const | ||||
|     return sprintf(str, "VoiceEngine 4.1.0\n"); | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 VoEBaseImpl::AddSPLIBVersion(char* str) const | ||||
| { | ||||
|     char version[16]; | ||||
|     unsigned int len(16); | ||||
|     WebRtcSpl_get_version(version, len); | ||||
|     return sprintf(str, "SPLIB\t%s\n", version); | ||||
| } | ||||
|  | ||||
| #ifdef WEBRTC_EXTERNAL_TRANSPORT | ||||
| WebRtc_Word32 VoEBaseImpl::AddExternalTransportBuild(char* str) const | ||||
| { | ||||
| @@ -1407,91 +1319,6 @@ WebRtc_Word32 VoEBaseImpl::AddExternalRecAndPlayoutBuild(char* str) const | ||||
| } | ||||
| #endif | ||||
|  | ||||
| WebRtc_Word32 VoEBaseImpl::AddModuleVersion(Module* module, char* str) const | ||||
| { | ||||
|     WebRtc_Word8 version[kVoiceEngineMaxModuleVersionSize]; | ||||
|     WebRtc_UWord32 remainingBufferInBytes(kVoiceEngineMaxModuleVersionSize); | ||||
|     WebRtc_UWord32 position(0); | ||||
|     if (module->Version(version, remainingBufferInBytes, position) == 0) | ||||
|     { | ||||
|         return sprintf(str, "%s\n", version); | ||||
|     } | ||||
|     return -1; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 VoEBaseImpl::AddADMVersion(char* str) const | ||||
| { | ||||
|     AudioDeviceModule* admPtr(_audioDevicePtr); | ||||
|     if (_audioDevicePtr == NULL) | ||||
|     { | ||||
|         admPtr = AudioDeviceModuleImpl::Create(-1); | ||||
|     } | ||||
|     admPtr->AddRef(); | ||||
|     int len = AddModuleVersion(admPtr, str); | ||||
|     admPtr->Release(); | ||||
|     return len; | ||||
| } | ||||
|  | ||||
| int VoEBaseImpl::AddAudioProcessingModuleVersion(char* str) const | ||||
| { | ||||
|     AudioProcessing* vpmPtr(_audioProcessingModulePtr); | ||||
|     if (_audioProcessingModulePtr == NULL) | ||||
|     { | ||||
|         vpmPtr = AudioProcessing::Create(-1); | ||||
|     } | ||||
|     int len = AddModuleVersion(vpmPtr, str); | ||||
|     if (_audioProcessingModulePtr == NULL) | ||||
|     { | ||||
|         AudioProcessing::Destroy(vpmPtr); | ||||
|     } | ||||
|     return len; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 VoEBaseImpl::AddACMVersion(char* str) const | ||||
| { | ||||
|     AudioCodingModule* acmPtr = AudioCodingModule::Create(-1); | ||||
|     int len = AddModuleVersion(acmPtr, str); | ||||
|     AudioCodingModule::Destroy(acmPtr); | ||||
|     return len; | ||||
| } | ||||
|  | ||||
| WebRtc_Word32 VoEBaseImpl::AddConferenceMixerVersion(char* str) const | ||||
| { | ||||
|     AudioConferenceMixer* mixerPtr = AudioConferenceMixer::Create(-1); | ||||
|     int len = AddModuleVersion(mixerPtr, str); | ||||
|     delete mixerPtr; | ||||
|     return len; | ||||
| } | ||||
|  | ||||
| #ifndef WEBRTC_EXTERNAL_TRANSPORT | ||||
| WebRtc_Word32 VoEBaseImpl::AddSocketModuleVersion(char* str) const | ||||
| { | ||||
|     WebRtc_UWord8 numSockThreads(1); | ||||
|     UdpTransport* socketPtr = UdpTransport::Create(-1, numSockThreads); | ||||
|     int len = AddModuleVersion(socketPtr, str); | ||||
|     UdpTransport::Destroy(socketPtr); | ||||
|     return len; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #ifdef WEBRTC_SRTP | ||||
| WebRtc_Word32 VoEBaseImpl::AddSRTPModuleVersion(char* str) const | ||||
| { | ||||
|     SrtpModule* srtpPtr = SrtpModule::CreateSrtpModule(-1); | ||||
|     int len = AddModuleVersion(srtpPtr, str); | ||||
|     SrtpModule::DestroySrtpModule(srtpPtr); | ||||
|     return len; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| WebRtc_Word32 VoEBaseImpl::AddRtpRtcpModuleVersion(char* str) const | ||||
| { | ||||
|     RtpRtcp* rtpRtcpPtr = RtpRtcp::CreateRtpRtcp(-1, true); | ||||
|     int len = AddModuleVersion(rtpRtcpPtr, str); | ||||
|     RtpRtcp::DestroyRtpRtcp(rtpRtcpPtr); | ||||
|     return len; | ||||
| } | ||||
|  | ||||
| int VoEBaseImpl::LastError() | ||||
| { | ||||
|     WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_instanceId, -1), | ||||
|   | ||||
| @@ -132,23 +132,10 @@ private: | ||||
|     WebRtc_Word32 AddVoEVersion(char* str) const; | ||||
| #ifdef WEBRTC_EXTERNAL_TRANSPORT | ||||
|     WebRtc_Word32 AddExternalTransportBuild(char* str) const; | ||||
| #else | ||||
|     WebRtc_Word32 AddSocketModuleVersion(char* str) const; | ||||
| #endif | ||||
| #ifdef WEBRTC_VOE_EXTERNAL_REC_AND_PLAYOUT | ||||
|     WebRtc_Word32 AddExternalRecAndPlayoutBuild(char* str) const; | ||||
| #endif | ||||
|     WebRtc_Word32 AddModuleVersion(Module* module, char* str) const; | ||||
|     WebRtc_Word32 AddADMVersion(char* str) const; | ||||
|     int AddAudioProcessingModuleVersion(char* str) const; | ||||
|     WebRtc_Word32 AddACMVersion(char* str) const; | ||||
|     WebRtc_Word32 AddConferenceMixerVersion(char* str) const; | ||||
| #ifdef WEBRTC_SRTP | ||||
|     WebRtc_Word32 AddSRTPModuleVersion(char* str) const; | ||||
| #endif | ||||
|     WebRtc_Word32 AddRtpRtcpModuleVersion(char* str) const; | ||||
|     WebRtc_Word32 AddSPLIBVersion(char* str) const; | ||||
|  | ||||
|     VoiceEngineObserver* _voiceEngineObserverPtr; | ||||
|     CriticalSectionWrapper& _callbackCritSect; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pwestin@webrtc.org
					pwestin@webrtc.org