| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 namespace cricket { | 57 namespace cricket { |
| 58 | 58 |
| 59 class VideoCapturer; | 59 class VideoCapturer; |
| 60 | 60 |
| 61 // MediaEngineInterface is an abstraction of a media engine which can be | 61 // MediaEngineInterface is an abstraction of a media engine which can be |
| 62 // subclassed to support different media componentry backends. | 62 // subclassed to support different media componentry backends. |
| 63 // It supports voice and video operations in the same class to facilitate | 63 // It supports voice and video operations in the same class to facilitate |
| 64 // proper synchronization between both media types. | 64 // proper synchronization between both media types. |
| 65 class MediaEngineInterface { | 65 class MediaEngineInterface { |
| 66 public: | 66 public: |
| 67 // Default value to be used for SetAudioDelayOffset(). | |
| 68 static const int kDefaultAudioDelayOffset; | |
| 69 | |
| 70 virtual ~MediaEngineInterface() {} | 67 virtual ~MediaEngineInterface() {} |
| 71 | 68 |
| 72 // Initialization | 69 // Initialization |
| 73 // Starts the engine. | 70 // Starts the engine. |
| 74 virtual bool Init(rtc::Thread* worker_thread) = 0; | 71 virtual bool Init(rtc::Thread* worker_thread) = 0; |
| 75 // Shuts down the engine. | 72 // Shuts down the engine. |
| 76 virtual void Terminate() = 0; | 73 virtual void Terminate() = 0; |
| 77 // TODO(solenberg): Remove once VoE API refactoring is done. | 74 // TODO(solenberg): Remove once VoE API refactoring is done. |
| 78 virtual webrtc::VoiceEngine* GetVoE() = 0; | 75 virtual webrtc::VoiceEngine* GetVoE() = 0; |
| 79 | 76 |
| 80 // MediaChannel creation | 77 // MediaChannel creation |
| 81 // Creates a voice media channel. Returns NULL on failure. | 78 // Creates a voice media channel. Returns NULL on failure. |
| 82 virtual VoiceMediaChannel* CreateChannel( | 79 virtual VoiceMediaChannel* CreateChannel( |
| 83 webrtc::Call* call, | 80 webrtc::Call* call, |
| 84 const AudioOptions& options) = 0; | 81 const AudioOptions& options) = 0; |
| 85 // Creates a video media channel, paired with the specified voice channel. | 82 // Creates a video media channel, paired with the specified voice channel. |
| 86 // Returns NULL on failure. | 83 // Returns NULL on failure. |
| 87 virtual VideoMediaChannel* CreateVideoChannel( | 84 virtual VideoMediaChannel* CreateVideoChannel( |
| 88 webrtc::Call* call, | 85 webrtc::Call* call, |
| 89 const VideoOptions& options) = 0; | 86 const VideoOptions& options) = 0; |
| 90 | 87 |
| 91 // Configuration | 88 // Configuration |
| 92 // Gets global audio options. | 89 // Gets global audio options. |
| 93 virtual AudioOptions GetAudioOptions() const = 0; | 90 virtual AudioOptions GetAudioOptions() const = 0; |
| 94 // Sets global audio options. "options" are from AudioOptions, above. | 91 // Sets global audio options. "options" are from AudioOptions, above. |
| 95 virtual bool SetAudioOptions(const AudioOptions& options) = 0; | 92 virtual bool SetAudioOptions(const AudioOptions& options) = 0; |
| 96 // Sets the value used by the echo canceller to offset delay values obtained | |
| 97 // from the OS. | |
| 98 virtual bool SetAudioDelayOffset(int offset) = 0; | |
| 99 // Sets the default (maximum) codec/resolution and encoder option to capture | 93 // Sets the default (maximum) codec/resolution and encoder option to capture |
| 100 // and encode video. | 94 // and encode video. |
| 101 virtual bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config) | 95 virtual bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config) |
| 102 = 0; | 96 = 0; |
| 103 | 97 |
| 104 // Device selection | 98 // Device selection |
| 105 virtual bool SetSoundDevices(const Device* in_device, | 99 virtual bool SetSoundDevices(const Device* in_device, |
| 106 const Device* out_device) = 0; | 100 const Device* out_device) = 0; |
| 107 | 101 |
| 108 // Device configuration | 102 // Device configuration |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 const VideoOptions& options) { | 169 const VideoOptions& options) { |
| 176 return video_.CreateChannel(call, options); | 170 return video_.CreateChannel(call, options); |
| 177 } | 171 } |
| 178 | 172 |
| 179 virtual AudioOptions GetAudioOptions() const { | 173 virtual AudioOptions GetAudioOptions() const { |
| 180 return voice_.GetOptions(); | 174 return voice_.GetOptions(); |
| 181 } | 175 } |
| 182 virtual bool SetAudioOptions(const AudioOptions& options) { | 176 virtual bool SetAudioOptions(const AudioOptions& options) { |
| 183 return voice_.SetOptions(options); | 177 return voice_.SetOptions(options); |
| 184 } | 178 } |
| 185 virtual bool SetAudioDelayOffset(int offset) { | |
| 186 return voice_.SetDelayOffset(offset); | |
| 187 } | |
| 188 virtual bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config) { | 179 virtual bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config) { |
| 189 return video_.SetDefaultEncoderConfig(config); | 180 return video_.SetDefaultEncoderConfig(config); |
| 190 } | 181 } |
| 191 | 182 |
| 192 virtual bool SetSoundDevices(const Device* in_device, | 183 virtual bool SetSoundDevices(const Device* in_device, |
| 193 const Device* out_device) { | 184 const Device* out_device) { |
| 194 return voice_.SetDevices(in_device, out_device); | 185 return voice_.SetDevices(in_device, out_device); |
| 195 } | 186 } |
| 196 | 187 |
| 197 virtual bool GetOutputVolume(int* level) { | 188 virtual bool GetOutputVolume(int* level) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // NullVoiceEngine can be used with CompositeMediaEngine in the case where only | 227 // NullVoiceEngine can be used with CompositeMediaEngine in the case where only |
| 237 // a video engine is desired. | 228 // a video engine is desired. |
| 238 class NullVoiceEngine { | 229 class NullVoiceEngine { |
| 239 public: | 230 public: |
| 240 bool Init(rtc::Thread* worker_thread) { return true; } | 231 bool Init(rtc::Thread* worker_thread) { return true; } |
| 241 void Terminate() {} | 232 void Terminate() {} |
| 242 // If you need this to return an actual channel, use FakeMediaEngine instead. | 233 // If you need this to return an actual channel, use FakeMediaEngine instead. |
| 243 VoiceMediaChannel* CreateChannel(const AudioOptions& options) { | 234 VoiceMediaChannel* CreateChannel(const AudioOptions& options) { |
| 244 return nullptr; | 235 return nullptr; |
| 245 } | 236 } |
| 246 bool SetDelayOffset(int offset) { return true; } | |
| 247 AudioOptions GetOptions() const { return AudioOptions(); } | 237 AudioOptions GetOptions() const { return AudioOptions(); } |
| 248 bool SetOptions(const AudioOptions& options) { return true; } | 238 bool SetOptions(const AudioOptions& options) { return true; } |
| 249 bool SetDevices(const Device* in_device, const Device* out_device) { | 239 bool SetDevices(const Device* in_device, const Device* out_device) { |
| 250 return true; | 240 return true; |
| 251 } | 241 } |
| 252 bool GetOutputVolume(int* level) { | 242 bool GetOutputVolume(int* level) { |
| 253 *level = 0; | 243 *level = 0; |
| 254 return true; | 244 return true; |
| 255 } | 245 } |
| 256 bool SetOutputVolume(int level) { return true; } | 246 bool SetOutputVolume(int level) { return true; } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 class DataEngineInterface { | 295 class DataEngineInterface { |
| 306 public: | 296 public: |
| 307 virtual ~DataEngineInterface() {} | 297 virtual ~DataEngineInterface() {} |
| 308 virtual DataMediaChannel* CreateChannel(DataChannelType type) = 0; | 298 virtual DataMediaChannel* CreateChannel(DataChannelType type) = 0; |
| 309 virtual const std::vector<DataCodec>& data_codecs() = 0; | 299 virtual const std::vector<DataCodec>& data_codecs() = 0; |
| 310 }; | 300 }; |
| 311 | 301 |
| 312 } // namespace cricket | 302 } // namespace cricket |
| 313 | 303 |
| 314 #endif // TALK_MEDIA_BASE_MEDIAENGINE_H_ | 304 #endif // TALK_MEDIA_BASE_MEDIAENGINE_H_ |
| OLD | NEW |