From 679e64d1fc7b75f9904306a79903772149176fee Mon Sep 17 00:00:00 2001 From: "perkj@webrtc.org" Date: Tue, 20 Sep 2011 08:21:22 +0000 Subject: [PATCH] Cleaning up of Peerconnection API. Removing RemoteMediaStream. Adding one universal implementation of MediaStream that is used for both remote and local media streams. Removed AudioDevice and VideoDevice since VideoCaptureModule and AudioDeviceModule now is reference counted. Changes LocalAudioTrackImpl and LocalVideoTrackImpl to AudioTrackImpl and VideoTrackImpl so they can be used to repressent both remote and local tracks. Renamed files to a better name. Review URL: http://webrtc-codereview.appspot.com/151001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@627 4adac7df-926f-26a2-2b94-8c16560cd09d --- third_party_mods/libjingle/libjingle.gyp | 61 ++++--- .../talk/app/webrtc_dev/audio_device_dev.cc | 51 ------ .../talk/app/webrtc_dev/audiotrackimpl.cc | 106 ++++++++++++ ...deo_track_impl_dev.cc => audiotrackimpl.h} | 82 +++++----- .../webrtc_dev/local_audio_track_impl_dev.cc | 77 --------- .../app/webrtc_dev/media_stream_impl_dev.cc | 64 -------- .../{stream_dev.h => mediastream.h} | 97 ++++------- ...local_stream_dev.cc => mediastreamimpl.cc} | 62 ++++--- .../{local_stream_dev.h => mediastreamimpl.h} | 49 +++--- ...nittest.cc => mediastreamimpl_unittest.cc} | 14 +- .../{notifier_impl.h => notifierimpl.h} | 8 +- ...{peerconnection_dev.h => peerconnection.h} | 8 +- .../talk/app/webrtc_dev/peerconnection_dev.cc | 44 ----- ...tion_impl_dev.cc => peerconnectionimpl.cc} | 66 +------- ...ection_impl_dev.h => peerconnectionimpl.h} | 12 +- ...test.cc => peerconnectionimpl_unittest.cc} | 15 +- .../peerconnectionmanager_unittest.cc | 15 +- ...r_impl.cc => peerconnectionmanagerimpl.cc} | 34 ++-- ...ger_impl.h => peerconnectionmanagerimpl.h} | 12 +- .../talk/app/webrtc_dev/remote_stream_dev.cc | 72 --------- .../talk/app/webrtc_dev/remote_stream_dev.h | 63 -------- .../app/webrtc_dev/streamcollectionimpl.h | 101 ++++++++++++ .../talk/app/webrtc_dev/video_device_dev.cc | 51 ------ .../talk/app/webrtc_dev/video_renderer_dev.cc | 45 ------ ...m_dev_unittest.cc => videorendererimpl.cc} | 42 +++-- .../talk/app/webrtc_dev/videotrackimpl.cc | 112 +++++++++++++ ...dia_stream_impl_dev.h => videotrackimpl.h} | 57 ++++--- .../talk/app/webrtc_dev/webrtc_mediaengine.cc | 153 ------------------ .../talk/app/webrtc_dev/webrtc_mediaengine.h | 86 ---------- .../app/webrtc_dev/webrtcsessionchannel.cc | 2 +- .../app/webrtc_dev/webrtcsessionchannel.h | 2 +- 31 files changed, 608 insertions(+), 1055 deletions(-) delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/audio_device_dev.cc create mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{local_video_track_impl_dev.cc => audiotrackimpl.h} (53%) delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/local_audio_track_impl_dev.cc delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.cc rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{stream_dev.h => mediastream.h} (65%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{local_stream_dev.cc => mediastreamimpl.cc} (56%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{local_stream_dev.h => mediastreamimpl.h} (64%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{local_stream_dev_unittest.cc => mediastreamimpl_unittest.cc} (87%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{notifier_impl.h => notifierimpl.h} (93%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{peerconnection_dev.h => peerconnection.h} (96%) delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.cc rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{peerconnection_impl_dev.cc => peerconnectionimpl.cc} (63%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{peerconnection_impl_dev.h => peerconnectionimpl.h} (93%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{peerconnection_impl_dev_unittest.cc => peerconnectionimpl_unittest.cc} (84%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{peerconnectionmanager_impl.cc => peerconnectionmanagerimpl.cc} (88%) rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{peerconnectionmanager_impl.h => peerconnectionmanagerimpl.h} (89%) delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.cc delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.h create mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/video_device_dev.cc delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/video_renderer_dev.cc rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{remote_stream_dev_unittest.cc => videorendererimpl.cc} (68%) create mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc rename third_party_mods/libjingle/source/talk/app/webrtc_dev/{media_stream_impl_dev.h => videotrackimpl.h} (56%) delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.cc delete mode 100644 third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.h diff --git a/third_party_mods/libjingle/libjingle.gyp b/third_party_mods/libjingle/libjingle.gyp index abcc15913d..7e8cfd0daf 100644 --- a/third_party_mods/libjingle/libjingle.gyp +++ b/third_party_mods/libjingle/libjingle.gyp @@ -667,35 +667,33 @@ 'libjingle_p2p', ], } ], # inside_chromium_build - ['peer_connection_dev==1', { + ['peer_connection_dev==1', { + 'include_dirs': [ + '<(libjingle_mods)/source', + ], # sources= empties the list of source file and start new. - # peer_connection_dev is independent of the main branch. + # peer_connection_dev is independent of the main branch. 'sources=': [ - '<(overrides)/talk/app/webrtc_dev/scoped_refptr.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/audio_device_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/local_audio_track_impl_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/local_stream_dev.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/local_stream_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/local_video_track_impl_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/media_stream_impl_dev.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/media_stream_impl_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_dev.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_impl_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_impl_dev.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmanager_impl.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmanager_impl.h', + '<(overrides)/talk/app/webrtc_dev/scoped_refptr.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/audiotrackimpl.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/audiotrackimpl.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/mediastream.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/mediastreamimpl.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/mediastreamimpl.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionimpl.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionimpl.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h', '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectiontransport.cc', '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectiontransport.h', '<(libjingle_mods)/source/talk/app/webrtc_dev/ref_count.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/remote_stream_dev.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/remote_stream_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/stream_dev.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/video_device_dev.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/video_renderer_dev.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/streamcollectionimpl.h', + '<(libjingle_mods)/source/talk/app/webrtc_dev/videorendererimpl.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/videotrackimpl.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/videotrackimpl.h', '<(libjingle_mods)/source/talk/app/webrtc_dev/webrtc_devicemanager.h', '<(libjingle_mods)/source/talk/app/webrtc_dev/webrtc_devicemanager.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/webrtc_mediaengine.h', - '<(libjingle_mods)/source/talk/app/webrtc_dev/webrtc_mediaengine.cc', ], }], # peer_connection_dev ], # conditions @@ -739,20 +737,21 @@ 'conditions': [ ['inside_chromium_build==1', { 'dependencies': [ - '../../third_party/webrtc/modules/audio_device/main/source/audio_device.gyp:audio_device', - ] - }, { + '../../third_party/webrtc/modules/modules.gyp:audio_device', + '../../third_party/webrtc/system_wrappers/source/system_wrappers.gyp:system_wrappers', + ], + }, { 'dependencies': [ - '../../src/modules/audio_device/main/source/audio_device.gyp:audio_device', - ] + '../../src/modules/modules.gyp:audio_device', + '../../src/system_wrappers/source/system_wrappers.gyp:system_wrappers', + ], }], ], #conditions 'sources': [ + '<(libjingle_mods)/source/talk/app/webrtc_dev/mediastreamimpl_unittest.cc', '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_unittests.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/local_stream_dev_unittest.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/remote_stream_dev_unittest.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_impl_dev_unittest.cc', - '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmanager_unittest.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionimpl_unittest.cc', + '<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmanager_unittest.cc', ], }, { # peer_connection_dev != 1 'type': 'none', diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audio_device_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audio_device_dev.cc deleted file mode 100644 index ef80632bd7..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audio_device_dev.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2004--2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "talk/app/webrtc_dev/local_stream_dev.h" - -namespace webrtc { - -scoped_refptr AudioDevice::Create(const std::string& name, - webrtc::AudioDeviceModule* adm) { - RefCountImpl* device = new RefCountImpl(); - device->Initialize(name, adm); - return device; -} - -const std::string& AudioDevice::name(){ - return name_; -} - -AudioDeviceModule* AudioDevice::module() { - return adm_; -} - -void AudioDevice::Initialize(const std::string& name, AudioDeviceModule* adm) { - name_ = name; - adm_ = adm; -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc new file mode 100644 index 0000000000..3098bdf79c --- /dev/null +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.cc @@ -0,0 +1,106 @@ +/* + * libjingle + * Copyright 2004--2011, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "talk/app/webrtc_dev/audiotrackimpl.h" + +#include + +namespace webrtc { + +AudioTrackImpl::AudioTrackImpl(const std::string& label, uint32 ssrc) + : enabled_(true), + kind_(kAudioTrackKind), + label_(label), + ssrc_(ssrc), + audio_device_(NULL) { +} + +AudioTrackImpl::AudioTrackImpl(const std::string& label, + AudioDeviceModule* audio_device) + : enabled_(true), + kind_(kAudioTrackKind), + label_(label), + ssrc_(0), + audio_device_(audio_device) { +} + + // Get the AudioDeviceModule associated with this track. +scoped_refptr AudioTrackImpl::GetAudioDevice() { + return audio_device_; +} + + // Implement MediaStreamTrack +const std::string& AudioTrackImpl::kind() { + return kind_; +} + +const std::string& AudioTrackImpl::label() { + return label_; +} + +bool AudioTrackImpl::enabled() { + return enabled_; +} + +bool AudioTrackImpl::set_enabled(bool enable) { + bool fire_on_change = enable != enabled_; + enabled_ = enable; + if (fire_on_change) + NotifierImpl::FireOnChanged(); +} + +uint32 AudioTrackImpl::ssrc() { + return ssrc_; +} + +bool AudioTrackImpl::set_ssrc(uint32 ssrc) { + ASSERT(ssrc_ == 0); + ASSERT(ssrc != 0); + if (ssrc_ != 0) + return false; + ssrc_ = ssrc; + NotifierImpl::FireOnChanged(); + return true; +} + +scoped_refptr AudioTrackImpl::Create( + const std::string& label, uint32 ssrc) { + RefCountImpl* track = + new RefCountImpl(label, ssrc); + return track; +} + +scoped_refptr CreateLocalAudioTrack( + const std::string& label, + AudioDeviceModule* audio_device) { + RefCountImpl* track = + new RefCountImpl(label, audio_device); + return track; +} + + + +} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_video_track_impl_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h similarity index 53% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/local_video_track_impl_dev.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h index 23a47c7a5f..200a3ce608 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_video_track_impl_dev.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/audiotrackimpl.h @@ -24,65 +24,55 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "talk/app/webrtc_dev/local_stream_dev.h" + +#ifndef TALK_APP_WEBRTC_AUDIOTRACKIMPL_H_ +#define TALK_APP_WEBRTC_AUDIOTRACKIMPL_H_ + +#include + +#include "talk/app/webrtc_dev/notifierimpl.h" +#include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/app/webrtc_dev/mediastream.h" +#ifdef WEBRTC_RELATIVE_PATH +#include "modules/audio_device/main/interface/audio_device.h" +#else +#include "third_party/webrtc/files/include/audio_device.h" +#endif namespace webrtc { -class LocalVideoTrackImpl : public NotifierImpl { +class AudioTrackImpl : public NotifierImpl { public: - LocalVideoTrackImpl() {} - explicit LocalVideoTrackImpl(VideoDevice* video_device) - : enabled_(true), - kind_(kVideoTrackKind), - video_device_(video_device) { - } + // Creates an audio track. This can be used in remote media streams. + // For local audio tracks use CreateLocalAudioTrack. + static scoped_refptr Create(const std::string& label, + uint32 ssrc); - virtual void SetRenderer(VideoRenderer* renderer) { - video_renderer_ = renderer; - NotifierImpl::FireOnChanged(); - } - - virtual scoped_refptr GetRenderer() { - return video_renderer_.get(); - } - - // Get the VideoCapture device associated with this track. - virtual scoped_refptr GetVideoCapture() { - return video_device_.get(); - } + // Get the AudioDeviceModule associated with this track. + virtual scoped_refptr GetAudioDevice(); // Implement MediaStreamTrack - virtual const std::string& kind() { - return kind_; - } + virtual const std::string& kind(); + virtual const std::string& label(); + virtual uint32 ssrc(); + virtual bool enabled(); + virtual bool set_enabled(bool enable); + virtual bool set_ssrc(uint32 ssrc); - virtual const std::string& label() { - return video_device_->name(); - } - - virtual bool enabled() { - return enabled_; - } - - virtual bool set_enabled(bool enable) { - bool fire_on_change = enable != enabled_; - enabled_ = enable; - if (fire_on_change) - NotifierImpl::FireOnChanged(); - } + protected: + AudioTrackImpl(const std::string& label, uint32 ssrc); + AudioTrackImpl(const std::string& label, AudioDeviceModule* audio_device); private: bool enabled_; std::string kind_; - scoped_refptr video_device_; - scoped_refptr video_renderer_; + std::string label_; + uint32 ssrc_; + scoped_refptr audio_device_; }; -scoped_refptr LocalVideoTrack::Create( - VideoDevice* video_device) { - RefCountImpl* track = - new RefCountImpl(video_device); - return track; -} + } // namespace webrtc + +#endif // TALK_APP_WEBRTC_AUDIOTRACKIMPL_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_audio_track_impl_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_audio_track_impl_dev.cc deleted file mode 100644 index 87b94db14e..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_audio_track_impl_dev.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - * libjingle - * Copyright 2004--2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "talk/app/webrtc_dev/local_stream_dev.h" - -namespace webrtc { - -class LocalAudioTrackImpl : public NotifierImpl { - public: - LocalAudioTrackImpl(){}; - LocalAudioTrackImpl(AudioDevice* audio_device) - : enabled_(true), - kind_(kAudioTrackKind), - audio_device_(audio_device) { - } - - // Get the AudioDevice associated with this track. - virtual scoped_refptr GetAudioDevice() { - return audio_device_.get(); - }; - - // Implement MediaStreamTrack - virtual const std::string& kind() { - return kind_; - } - - virtual const std::string& label() { - return audio_device_->name(); - } - - virtual bool enabled() { - return enabled_; - } - - virtual bool set_enabled(bool enable) { - bool fire_on_change = enable != enabled_; - enabled_ = enable; - if (fire_on_change) - NotifierImpl::FireOnChanged(); - } - - private: - bool enabled_; - std::string kind_; - scoped_refptr audio_device_; -}; - -scoped_refptr LocalAudioTrack::Create(AudioDevice* audio_device) { - RefCountImpl* lstream = - new RefCountImpl(audio_device); - return lstream; -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.cc deleted file mode 100644 index d175b70594..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "talk/app/webrtc_dev/media_stream_impl_dev.h" - -namespace webrtc { - -MediaStreamImpl::MediaStreamImpl(const std::string& label) - : label_(label), - ready_state_(MediaStream::kInitializing) { -} - -// Implement MediaStream -const std::string& MediaStreamImpl::label() const { - return label_; -} - -MediaStream::ReadyState MediaStreamImpl::ready_state() const { - return ready_state_; -} - -MediaStreamTrackListImpl::MediaStreamTrackListImpl() { -} - -// Implement MediaStreamTrackList. -size_t MediaStreamTrackListImpl::count() const { - return tracks_.size(); -} - -scoped_refptr -MediaStreamTrackListImpl::at(size_t index) const { - return tracks_[index]; -} - -bool MediaStreamTrackListImpl::AddTrack(MediaStreamTrack* track) { - tracks_.push_back(track); - return true; -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/stream_dev.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h similarity index 65% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/stream_dev.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h index b12c10adbd..647facdb98 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/stream_dev.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastream.h @@ -25,13 +25,14 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TALK_APP_WEBRTC_STREAM_H_ -#define TALK_APP_WEBRTC_STREAM_H_ +#ifndef TALK_APP_WEBRTC_MEDIASTREAM_H_ +#define TALK_APP_WEBRTC_MEDIASTREAM_H_ #include #include "talk/app/webrtc_dev/ref_count.h" #include "talk/app/webrtc_dev/scoped_refptr.h" +#include "talk/base/basictypes.h" namespace cricket { class VideoRenderer; @@ -67,6 +68,7 @@ class MediaStreamTrack : public RefCount, public: virtual const std::string& kind() = 0; virtual const std::string& label() = 0; + virtual uint32 ssrc() = 0; virtual bool enabled() = 0; // Enable or disables a track. // For Remote streams - disable means that the video is not decoded, @@ -74,61 +76,24 @@ class MediaStreamTrack : public RefCount, // For local streams this means that video is not captured // or audio is not captured. virtual bool set_enabled(bool enable) = 0; -}; - -// Reference counted wrapper for an AudioDeviceModule. -class AudioDevice : public RefCount { - public: - static scoped_refptr Create(const std::string& name, - AudioDeviceModule* adm); - - // Name of this device. Same as label of a MediaStreamTrack. - const std::string& name(); - - AudioDeviceModule* module(); - - protected: - AudioDevice() {} - virtual ~AudioDevice() {} - void Initialize(const std::string& name, AudioDeviceModule* adm); - - std::string name_; - AudioDeviceModule* adm_; -}; - -// Reference counted wrapper for a VideoCaptureModule. -class VideoDevice : public RefCount { - public: - static scoped_refptr Create(const std::string& name, - VideoCaptureModule* vcm); - // Name of this device. Same as label of a MediaStreamTrack. - const std::string& name(); - - VideoCaptureModule* module(); - - protected: - VideoDevice() {} - ~VideoDevice() {} - void Initialize(const std::string& name, VideoCaptureModule* vcm); - - std::string name_; - VideoCaptureModule* vcm_; + // Return false (or assert) if the ssrc is already set. + virtual bool set_ssrc(uint32 ssrc) = 0; }; // Reference counted wrapper for a VideoRenderer. class VideoRenderer : public RefCount { public: - static scoped_refptr Create(cricket::VideoRenderer* renderer); - virtual cricket::VideoRenderer* module(); + virtual cricket::VideoRenderer* renderer() = 0; protected: - VideoRenderer() {} - ~VideoRenderer() {} - void Initialize(cricket::VideoRenderer* renderer); - - cricket::VideoRenderer* renderer_; + virtual ~VideoRenderer() {} }; +// Creates a reference counted object of type webrtc::VideoRenderer. +// webrtc::VideoRenderer take ownership of cricket::VideoRenderer. +scoped_refptr CreateVideoRenderer( + cricket::VideoRenderer* renderer); + class VideoTrack : public MediaStreamTrack { public: // Set the video renderer for a local or remote stream. @@ -144,15 +109,17 @@ class VideoTrack : public MediaStreamTrack { class LocalVideoTrack : public VideoTrack { public: - static scoped_refptr Create(VideoDevice* video_device); - // Get the VideoCapture device associated with this track. - virtual scoped_refptr GetVideoCapture() = 0; + virtual scoped_refptr GetVideoCapture() = 0; protected: virtual ~LocalVideoTrack() {} }; +scoped_refptr CreateLocalVideoTrack( + const std::string& label, + VideoCaptureModule* video_device); + class AudioTrack : public MediaStreamTrack { public: protected: @@ -161,14 +128,16 @@ class AudioTrack : public MediaStreamTrack { class LocalAudioTrack : public AudioTrack { public: - static scoped_refptr Create(AudioDevice* audio_device); - - // Get the AudioDevice associated with this track. - virtual scoped_refptr GetAudioDevice() = 0; + // Get the AudioDeviceModule associated with this track. + virtual scoped_refptr GetAudioDevice() = 0; protected: virtual ~LocalAudioTrack() {} }; +scoped_refptr CreateLocalAudioTrack( + const std::string& label, + AudioDeviceModule* audio_device); + // List of of tracks. class MediaStreamTrackList : public RefCount, public Notifier { public: @@ -179,7 +148,8 @@ class MediaStreamTrackList : public RefCount, public Notifier { virtual ~MediaStreamTrackList() {} }; -class MediaStream : public RefCount { +class MediaStream : public RefCount, + public Notifier { public: virtual const std::string& label() = 0; virtual scoped_refptr tracks() = 0; @@ -192,24 +162,21 @@ class MediaStream : public RefCount { virtual ReadyState ready_state() = 0; + // Only to be used by the implementation. + virtual void set_ready_state(ReadyState state) = 0; + protected: virtual ~MediaStream() {} }; class LocalMediaStream : public MediaStream { public: - static scoped_refptr Create(const std::string& label); virtual bool AddTrack(MediaStreamTrack* track) = 0; }; -// Remote streams are created by the PeerConnection object and provided to the -// client using PeerConnectionObserver::OnAddStream. -// The client can provide the renderer to the PeerConnection object calling -// VideoTrack::SetRenderer. -class RemoteMediaStream : public MediaStream { - public: -}; +scoped_refptr CreateLocalMediaStream( + const std::string& label); } // namespace webrtc -#endif // TALK_APP_WEBRTC_STREAM_H_ +#endif // TALK_APP_WEBRTC_MEDIASTREAM_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc similarity index 56% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc index ecf6f8e152..6949b134b2 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.cc @@ -24,50 +24,66 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "talk/app/webrtc_dev/local_stream_dev.h" +#include "talk/app/webrtc_dev/mediastreamimpl.h" namespace webrtc { -scoped_refptr LocalMediaStream::Create( +scoped_refptr CreateLocalMediaStream( const std::string& label) { - RefCountImpl* stream = - new RefCountImpl(label); + return MediaStreamImpl::Create(label); +} + +scoped_refptr MediaStreamImpl::Create( + const std::string& label) { + RefCountImpl* stream = + new RefCountImpl(label); return stream; } -LocalStreamImpl::LocalStreamImpl(const std::string& label) - : media_stream_impl_(label) { +MediaStreamImpl::MediaStreamImpl(const std::string& label) + : label_(label), + ready_state_(MediaStream::kInitializing), + track_list_(new RefCountImpl()) { } -// Implement MediaStream -const std::string& LocalStreamImpl::label() { - return media_stream_impl_.label(); +const std::string& MediaStreamImpl::label() { + return label_; } -scoped_refptr LocalStreamImpl::tracks() { - return this; +scoped_refptr MediaStreamImpl::tracks() { + return track_list_; } -MediaStream::ReadyState LocalStreamImpl::ready_state() { - return media_stream_impl_.ready_state(); +MediaStream::ReadyState MediaStreamImpl::ready_state() { + return ready_state_; } -// Implement MediaStreamTrackList. -size_t LocalStreamImpl::count() { - return tracks_.count(); +void MediaStreamImpl::set_ready_state(MediaStream::ReadyState new_state) { + ready_state_ = new_state; + NotifierImpl::FireOnChanged(); } -scoped_refptr LocalStreamImpl::at(size_t index) { - return tracks_.at(index); -} - -bool LocalStreamImpl::AddTrack(MediaStreamTrack* track) { +bool MediaStreamImpl::AddTrack(MediaStreamTrack* track) { if (ready_state() != kInitializing) return false; - bool result = tracks_.AddTrack(track); + track_list_->AddTrack(track); + return true; +} + +void MediaStreamImpl::MediaStreamTrackListImpl::AddTrack( + MediaStreamTrack* track) { + tracks_.push_back(track); NotifierImpl::FireOnChanged(); - return result; +} + +size_t MediaStreamImpl::MediaStreamTrackListImpl::count() { + return tracks_.size(); +} + +scoped_refptr MediaStreamImpl::MediaStreamTrackListImpl::at( + size_t index) { + return tracks_.at(index); } } // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.h similarity index 64% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.h index 692b6961c9..bce0edf91c 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl.h @@ -25,24 +25,32 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TALK_APP_WEBRTC_LOCAL_STREAM_H_ -#define TALK_APP_WEBRTC_LOCAL_STREAM_H_ +#ifndef TALK_APP_WEBRTC_MEDIASTREAMIMPL_H_ +#define TALK_APP_WEBRTC_MEDIASTREAMIMPL_H_ -#include "talk/app/webrtc_dev/media_stream_impl_dev.h" -#include "talk/app/webrtc_dev/stream_dev.h" -#include "talk/base/scoped_ptr.h" +#include +#include + +#include "talk/app/webrtc_dev/mediastream.h" +#include "talk/app/webrtc_dev/notifierimpl.h" namespace webrtc { -class MediaStreamImpl; -///////////////////////////////////////////// -// Local streams are Created by the PeerConnections client and provided to a -// PeerConnection object using the call PeerConnection::AddStream. - -class LocalStreamImpl - : public LocalMediaStream, - public NotifierImpl { +class MediaStreamImpl + : public NotifierImpl { public: + class MediaStreamTrackListImpl : public NotifierImpl { + public: + void AddTrack(MediaStreamTrack* track); + virtual size_t count(); + virtual scoped_refptr at(size_t index); + + private: + std::vector > tracks_; + }; + + static scoped_refptr Create(const std::string& label); + // Implement LocalStream. virtual bool AddTrack(MediaStreamTrack* track); @@ -50,18 +58,17 @@ class LocalStreamImpl virtual const std::string& label(); virtual scoped_refptr tracks(); virtual ReadyState ready_state(); - - // Implement MediaStreamTrackList. - virtual size_t count(); - virtual scoped_refptr at(size_t index); + virtual void set_ready_state(ReadyState new_state); + void set_state(ReadyState new_state); protected: - explicit LocalStreamImpl(const std::string& label); + explicit MediaStreamImpl(const std::string& label); - MediaStreamImpl media_stream_impl_; - MediaStreamTrackListImpl tracks_; + std::string label_; + MediaStream::ReadyState ready_state_; + scoped_refptr track_list_; }; } // namespace webrtc -#endif // TALK_APP_WEBRTC_LOCAL_STREAM_H_ +#endif // TALK_APP_WEBRTC_MEDIASTREAMIMPL_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev_unittest.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl_unittest.cc similarity index 87% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev_unittest.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl_unittest.cc index ed6e1d9fc2..686147f545 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/local_stream_dev_unittest.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/mediastreamimpl_unittest.cc @@ -28,10 +28,10 @@ #include #include "gtest/gtest.h" -#include "talk/app/webrtc_dev/local_stream_dev.h" +#include "talk/app/webrtc_dev/mediastreamimpl.h" static const char kStreamLabel1[] = "local_stream_1"; -const char* kVideoDeviceName = "dummy_video_cam_1"; +static const char kVideoDeviceName[] = "dummy_video_cam_1"; namespace webrtc { @@ -53,22 +53,18 @@ class TestObserver : public Observer { TEST(LocalStreamTest, Create) { // Create a local stream. std::string label(kStreamLabel1); - scoped_refptr stream(LocalMediaStream::Create(label)); + scoped_refptr stream(CreateLocalMediaStream(label)); EXPECT_EQ(stream->label().compare(label), 0); // Check state. EXPECT_EQ(stream->ready_state(), MediaStream::kInitializing); - // Create a Video Device. - std::string device_name(kVideoDeviceName); - scoped_refptr device = VideoDevice::Create(device_name, NULL); - EXPECT_EQ(device->name(), device_name); - // Create a local Video track. { TestObserver tracklist_observer; - scoped_refptr video_track(LocalVideoTrack::Create(device)); + scoped_refptr video_track(CreateLocalVideoTrack( + kVideoDeviceName, NULL)); // Add an observer to the track list. scoped_refptr track_list(stream->tracks()); diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/notifier_impl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/notifierimpl.h similarity index 93% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/notifier_impl.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/notifierimpl.h index f237420a8e..2a24c811c0 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/notifier_impl.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/notifierimpl.h @@ -25,13 +25,13 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TALK_APP_WEBRTC_NOTIFIER_IMPL_H_ -#define TALK_APP_WEBRTC_NOTIFIER_IMPL_H_ +#ifndef TALK_APP_WEBRTC_NOTIFIERIMPL_H_ +#define TALK_APP_WEBRTC_NOTIFIERIMPL_H_ #include #include "talk/base/common.h" -#include "talk/app/webrtc_dev/stream_dev.h" +#include "talk/app/webrtc_dev/mediastream.h" namespace webrtc { @@ -70,4 +70,4 @@ class NotifierImpl : public T { } // namespace webrtc -#endif // TALK_APP_WEBRTC_NOTIFIER_IMPL_H_ +#endif // TALK_APP_WEBRTC_NOTIFIERIMPL_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection.h similarity index 96% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection.h index 51365edcec..34a4bb8b73 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection.h @@ -30,7 +30,7 @@ #include -#include "talk/app/webrtc_dev/stream_dev.h" +#include "talk/app/webrtc_dev/mediastream.h" namespace talk_base { class Thread; @@ -67,10 +67,10 @@ class PeerConnectionObserver { virtual void OnStateChange(Readiness state) = 0; // Triggered when media is received on a new stream from remote peer. - virtual void OnAddStream(RemoteMediaStream* stream) = 0; + virtual void OnAddStream(MediaStream* stream) = 0; // Triggered when a remote peer close a stream. - virtual void OnRemoveStream(RemoteMediaStream* stream) = 0; + virtual void OnRemoveStream(MediaStream* stream) = 0; protected: // Dtor protected as objects shouldn't be deleted via this interface. @@ -156,7 +156,7 @@ class PeerConnectionManager : public RefCount { talk_base::Thread* worker_thread, PcNetworkManager* network_manager, PcPacketSocketFactory* packet_socket_factory, - AudioDevice* default_adm); + AudioDeviceModule* default_adm); virtual scoped_refptr CreatePeerConnection( const std::string& config) = 0; diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.cc deleted file mode 100644 index ca96eac4a5..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_dev.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "talk/app/webrtc/peerconnection_impl.h" - -namespace webrtc { -PeerConnection* PeerConnection::Create( - const std::string& config, - cricket::PortAllocator* port_allocator, - talk_base::Thread* worker_thread, - cricket::DeviceManager* device_manager) { - return new PeerConnectionImpl(config, port_allocator, - worker_thread, device_manager); -} - -PeerConnection* PeerConnection::Create(const std::string& config) { - return new PeerConnectionImpl(config); -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc similarity index 63% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc index 3cb6ac4fca..288ce3ed65 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.cc @@ -26,78 +26,25 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "talk/app/webrtc_dev/peerconnection_impl_dev.h" +#include "talk/app/webrtc_dev/peerconnectionimpl.h" #include #include "talk/app/webrtc_dev/scoped_refptr_msg.h" +#include "talk/app/webrtc_dev/streamcollectionimpl.h" #include "talk/base/logging.h" #include "talk/p2p/client/basicportallocator.h" #include "talk/session/phone/channelmanager.h" namespace webrtc { -// Implementation of StreamCollection intended for local streams. -class LocalStreamCollection : public StreamCollection { - public: - static scoped_refptr Create() { - RefCountImpl* implementation = - new RefCountImpl(); - return implementation; - } - - static scoped_refptr Create( - LocalStreamCollection* local_streams) { - RefCountImpl* implementation = - new RefCountImpl(local_streams); - return implementation; - } - - virtual size_t count() { - return local_media_streams_.size(); - } - - virtual MediaStream* at(size_t index) { - return local_media_streams_.at(index); - } - - void AddStream(LocalMediaStream* local_stream) { - for (LocalStreamVector::iterator it = local_media_streams_.begin(); - it != local_media_streams_.end(); ++it) { - if ((*it)->label().compare(local_stream->label()) == 0) - return; - } - local_media_streams_.push_back(local_stream); - } - - void RemoveStream(LocalMediaStream* remove_stream) { - for (LocalStreamVector::iterator it = local_media_streams_.begin(); - it != local_media_streams_.end(); ++it) { - if ((*it)->label().compare(remove_stream->label()) == 0) { - local_media_streams_.erase(it); - break; - } - } - } - - protected: - LocalStreamCollection() {} - explicit LocalStreamCollection(LocalStreamCollection* original) - : local_media_streams_(original->local_media_streams_) { - } - // Map of local media streams. - typedef std::vector > - LocalStreamVector; - LocalStreamVector local_media_streams_; -}; - PeerConnectionImpl::PeerConnectionImpl( cricket::ChannelManager* channel_manager, talk_base::Thread* worker_thread, PcNetworkManager* network_manager, PcPacketSocketFactory* socket_factory) : observer_(NULL), - local_media_streams_(LocalStreamCollection::Create()), + local_media_streams_(StreamCollectionImpl::Create()), worker_thread_(worker_thread), channel_manager_(channel_manager), network_manager_(network_manager), @@ -108,6 +55,7 @@ PeerConnectionImpl::PeerConnectionImpl( } PeerConnectionImpl::~PeerConnectionImpl() { + worker_thread_->Clear(this); } bool PeerConnectionImpl::Initialize(const std::string& configuration) { @@ -132,9 +80,9 @@ void PeerConnectionImpl::RemoveStream(LocalMediaStream* remove_stream) { } void PeerConnectionImpl::CommitStreamChanges() { - ScopedRefMessageData* msg = - new ScopedRefMessageData ( - LocalStreamCollection::Create(local_media_streams_)); + ScopedRefMessageData* msg = + new ScopedRefMessageData ( + StreamCollectionImpl::Create(local_media_streams_)); worker_thread_->Post(this, MSG_COMMITSTREAMCHANGES, msg); } diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.h similarity index 93% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.h index 6ccfda9b2f..2b8163f4f4 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl.h @@ -25,13 +25,13 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TALK_APP_WEBRTC_PEERCONNECTION_IMPL_H_ -#define TALK_APP_WEBRTC_PEERCONNECTION_IMPL_H_ +#ifndef TALK_APP_WEBRTC_PEERCONNECTIONIMPL_H_ +#define TALK_APP_WEBRTC_PEERCONNECTIONIMPL_H_ #include #include -#include "talk/app/webrtc_dev/peerconnection_dev.h" +#include "talk/app/webrtc_dev/peerconnection.h" #include "talk/base/scoped_ptr.h" #include "talk/p2p/base/portallocator.h" @@ -40,7 +40,7 @@ class ChannelManager; } namespace webrtc { -class LocalStreamCollection; +class StreamCollectionImpl; class PeerConnectionImpl : public PeerConnection, public talk_base::MessageHandler { @@ -98,7 +98,7 @@ class PeerConnectionImpl : public PeerConnection, }; PeerConnectionObserver* observer_; - scoped_refptr local_media_streams_; + scoped_refptr local_media_streams_; talk_base::Thread* worker_thread_; // Weak ref from PeerConnectionManager. cricket::ChannelManager* channel_manager_; @@ -109,4 +109,4 @@ class PeerConnectionImpl : public PeerConnection, } // namespace webrtc -#endif // TALK_APP_WEBRTC_PEERCONNECTION_IMPL_H_ +#endif // TALK_APP_WEBRTC_PEERCONNECTIONIMPL_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev_unittest.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl_unittest.cc similarity index 84% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev_unittest.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl_unittest.cc index 6eb8369fe8..8eaee0251c 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnection_impl_dev_unittest.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionimpl_unittest.cc @@ -28,9 +28,9 @@ #include #include "gtest/gtest.h" -#include "talk/app/webrtc_dev/local_stream_dev.h" -#include "talk/app/webrtc_dev/peerconnection_dev.h" -#include "talk/app/webrtc_dev/peerconnection_impl_dev.h" +#include "talk/app/webrtc_dev/mediastreamimpl.h" +#include "talk/app/webrtc_dev/peerconnection.h" +#include "talk/app/webrtc_dev/peerconnectionimpl.h" #include "talk/base/scoped_ptr.h" #include "talk/base/thread.h" @@ -40,7 +40,6 @@ namespace webrtc { class PeerConnectionImplTest : public testing::Test { public: - protected: virtual void SetUp() { pc_factory_ = webrtc::PeerConnectionManager::Create(); @@ -56,12 +55,14 @@ class PeerConnectionImplTest : public testing::Test { TEST_F(PeerConnectionImplTest, AddRemoveStream) { // Create a local stream. std::string label(kStreamLabel1); - scoped_refptr stream(LocalMediaStream::Create(label)); + scoped_refptr stream(CreateLocalMediaStream(label)); pc_->AddStream(stream); pc_->CommitStreamChanges(); - EXPECT_EQ(pc_->local_streams()->count(), 1l); - EXPECT_EQ(pc_->local_streams()->at(0)->label().compare(kStreamLabel1), 0); + EXPECT_EQ(1l, pc_->local_streams()->count()); + if (pc_->local_streams()->count() <= 0) + return; + EXPECT_EQ(0, pc_->local_streams()->at(0)->label().compare(kStreamLabel1)); } } // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_unittest.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_unittest.cc index 88b4d5508a..dacd892800 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_unittest.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_unittest.cc @@ -28,14 +28,20 @@ #include #include "gtest/gtest.h" -#include "talk/app/webrtc_dev/local_stream_dev.h" -#include "talk/app/webrtc_dev/peerconnectionmanager_impl.h" +#include "talk/app/webrtc_dev/mediastreamimpl.h" +#include "talk/app/webrtc_dev/peerconnectionmanagerimpl.h" #include "talk/base/basicpacketsocketfactory.h" #include "talk/base/scoped_ptr.h" #include "talk/base/thread.h" #include "talk/session/phone/webrtccommon.h" #include "talk/session/phone/webrtcvoe.h" +#ifdef WEBRTC_RELATIVE_PATH +#include "modules/audio_device/main/source/audio_device_impl.h" +#else +#include "third_party/webrtc/files/include/audio_device_impl.h" +#endif + static const char kAudioDeviceLabel[] = "dummy_audio_device"; namespace webrtc { @@ -52,9 +58,8 @@ TEST(PeerConnectionManager, CreatePCUsingInternalModules) { TEST(PeerConnectionManager, CreatePCUsingExternalModules) { // Create an audio device. Use the default sound card. - AudioDeviceModule* module = AudioDeviceModule::Create(0); - scoped_refptr audio_device(AudioDevice::Create( - kAudioDeviceLabel, module)); + scoped_refptr audio_device( + AudioDeviceModuleImpl::Create(0)); // Creata a libjingle thread used as internal worker thread. talk_base::scoped_ptr w_thread(new talk_base::Thread); diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_impl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc similarity index 88% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_impl.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc index 932d4a742a..a897dc5a23 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_impl.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.cc @@ -25,13 +25,21 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "talk/app/webrtc_dev/peerconnection_impl_dev.h" -#include "talk/app/webrtc_dev/peerconnectionmanager_impl.h" +#include "talk/app/webrtc_dev/peerconnectionmanagerimpl.h" + +#include "talk/app/webrtc_dev/peerconnectionimpl.h" #include "talk/app/webrtc_dev/webrtc_devicemanager.h" -#include "talk/app/webrtc_dev/webrtc_mediaengine.h" #include "talk/base/basicpacketsocketfactory.h" #include "talk/base/thread.h" #include "talk/session/phone/channelmanager.h" +#include "talk/session/phone/webrtcmediaengine.h" + +#ifdef WEBRTC_RELATIVE_PATH +#include "modules/audio_device/main/interface/audio_device.h" +#else +#include "third_party/webrtc/files/include/audio_device.h" +#endif + namespace webrtc { @@ -88,7 +96,7 @@ scoped_refptr PeerConnectionManager::Create( talk_base::Thread* worker_thread, PcNetworkManager* network_manager, PcPacketSocketFactory* socket_factory, - AudioDevice* default_adm) { + AudioDeviceModule* default_adm) { RefCountImpl* pc_manager = new RefCountImpl(worker_thread, network_manager, @@ -114,7 +122,7 @@ PeerConnectionManagerImpl::PeerConnectionManagerImpl( talk_base::Thread* worker_thread, PcNetworkManager* network_manager, PcPacketSocketFactory* socket_factory, - AudioDevice* default_adm) + AudioDeviceModule* default_adm) : worker_thread_ptr_(worker_thread), network_manager_(network_manager), socket_factory_(socket_factory), @@ -132,14 +140,14 @@ bool PeerConnectionManagerImpl::Initialize() { if (worker_thread_.get() && !worker_thread_->Start()) return false; cricket::DeviceManager* device_manager(new WebRtcDeviceManager()); - WebRtcMediaEngine* webrtc_media_engine = NULL; - if (default_adm_.get() != NULL) { - webrtc_media_engine = new WebRtcMediaEngine(default_adm_.get()->module(), - NULL, // No secondary adm. - NULL); // No vcm available. - } else { - webrtc_media_engine = new WebRtcMediaEngine(); - } + cricket::WebRtcMediaEngine* webrtc_media_engine = NULL; + + // TODO(perkj): Need to make sure only one VoE is created inside + // WebRtcMediaEngine. + webrtc_media_engine = new cricket::WebRtcMediaEngine( + default_adm_.get(), + NULL, // No secondary adm. + NULL); // No vcm available. channel_manager_.reset(new cricket::ChannelManager( webrtc_media_engine, device_manager, worker_thread_ptr_)); diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_impl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h similarity index 89% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_impl.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h index d9a0914d09..4d1500ea77 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanager_impl.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/peerconnectionmanagerimpl.h @@ -24,14 +24,14 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TALK_APP_WEBRTC_PEERCONNECTIONMANAGER_IMPL_H_ -#define TALK_APP_WEBRTC_PEERCONNECTIONMANAGER_IMPL_H_ +#ifndef TALK_APP_WEBRTC_PEERCONNECTIONMANAGERIMPL_H_ +#define TALK_APP_WEBRTC_PEERCONNECTIONMANAGERIMPL_H_ #include #include "talk/base/scoped_ptr.h" -#include "talk/app/webrtc_dev/peerconnection_dev.h" -#include "talk/app/webrtc_dev/stream_dev.h" +#include "talk/app/webrtc_dev/peerconnection.h" +#include "talk/app/webrtc_dev/mediastream.h" #include "talk/session/phone/channelmanager.h" namespace webrtc { @@ -46,7 +46,7 @@ class PeerConnectionManagerImpl : public PeerConnectionManager { PeerConnectionManagerImpl(talk_base::Thread* worker_thread, PcNetworkManager* network_manager, PcPacketSocketFactory* socket_factory, - AudioDevice* default_adm); + AudioDeviceModule* default_adm); virtual ~PeerConnectionManagerImpl(); private: @@ -58,7 +58,7 @@ class PeerConnectionManagerImpl : public PeerConnectionManager { talk_base::scoped_ptr channel_manager_; // External Audio device used for audio playback. - scoped_refptr default_adm_; + scoped_refptr default_adm_; }; } // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.cc deleted file mode 100644 index d21d891631..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "talk/app/webrtc_dev/remote_stream_dev.h" - -#include - -namespace webrtc { - -scoped_refptr RemoteMediaStreamImpl::Create( - const std::string& label) { - // To instantiate LocalStream use - RefCountImpl* stream = - new RefCountImpl(label); - return stream; -} - -RemoteMediaStreamImpl::RemoteMediaStreamImpl(const std::string& label) - : media_stream_impl_(label) { -} - -// Implement MediaStream -const std::string& RemoteMediaStreamImpl::label() { - return media_stream_impl_.label(); -} - -scoped_refptr RemoteMediaStreamImpl::tracks() { - return this; -} - -MediaStream::ReadyState RemoteMediaStreamImpl::ready_state() { - return media_stream_impl_.ready_state(); -} - -// Implement MediaStreamTrackList. -size_t RemoteMediaStreamImpl::count() { - return tracks_.count(); -} - -scoped_refptr RemoteMediaStreamImpl::at(size_t index) { - return tracks_.at(index); -} - -bool RemoteMediaStreamImpl::AddTrack(MediaStreamTrack* track) { - tracks_.AddTrack(track); - NotifierImpl::FireOnChanged(); -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.h deleted file mode 100644 index 034476d20b..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_REMOTE_STREAM_H_ -#define TALK_APP_WEBRTC_REMOTE_STREAM_H_ - -#include "talk/app/webrtc_dev/media_stream_impl_dev.h" -#include "talk/app/webrtc_dev/stream_dev.h" -#include "talk/base/scoped_ptr.h" - -namespace webrtc { - -///////////////////////////////////////////// -// Remote stream -class RemoteMediaStreamImpl - : public RemoteMediaStream, - public NotifierImpl { - public: - static scoped_refptr Create(const std::string& label); - bool AddTrack(MediaStreamTrack* track); - - // Implement MediaStream. - virtual const std::string& label(); - virtual scoped_refptr tracks(); - virtual ReadyState ready_state(); - - // Implement MediaStreamTrackList. - virtual size_t count(); - virtual scoped_refptr at(size_t index); - - protected: - explicit RemoteMediaStreamImpl(const std::string& label); - MediaStreamImpl media_stream_impl_; - MediaStreamTrackListImpl tracks_; -}; - -} // namespace webrtc - -#endif // TALK_APP_WEBRTC_REMOTE_STREAM_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h new file mode 100644 index 0000000000..9234051726 --- /dev/null +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/streamcollectionimpl.h @@ -0,0 +1,101 @@ +/* + * libjingle + * Copyright 2011, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TALK_APP_WEBRTC_STREAMCOLLECTIONIMPL_H_ +#define TALK_APP_WEBRTC_STREAMCOLLECTIONIMPL_H_ + +#include + +#include "talk/app/webrtc_dev/peerconnection.h" + +namespace webrtc { + +// Implementation of StreamCollection. +class StreamCollectionImpl : public StreamCollection { + public: + static scoped_refptr Create() { + RefCountImpl* implementation = + new RefCountImpl(); + return implementation; + } + + static scoped_refptr Create( + StreamCollectionImpl* local_streams) { + RefCountImpl* implementation = + new RefCountImpl(local_streams); + return implementation; + } + + virtual size_t count() { + return media_streams_.size(); + } + + virtual MediaStream* at(size_t index) { + return media_streams_.at(index); + } + + void AddStream(MediaStream* stream) { + for (StreamVector::iterator it = media_streams_.begin(); + it != media_streams_.end(); ++it) { + if ((*it)->label().compare(stream->label()) == 0) + return; + } + media_streams_.push_back(stream); + } + + void RemoveStream(MediaStream* remove_stream) { + for (StreamVector::iterator it = media_streams_.begin(); + it != media_streams_.end(); ++it) { + if ((*it)->label().compare(remove_stream->label()) == 0) { + media_streams_.erase(it); + break; + } + } + } + + MediaStream* FindFirstStream(const std::string& label) { + for (StreamVector::iterator it = media_streams_.begin(); + it != media_streams_.end(); ++it) { + if ((*it)->label().compare(label) == 0) { + return (*it); + } + } + return NULL; + } + + protected: + StreamCollectionImpl() {} + explicit StreamCollectionImpl(StreamCollectionImpl* original) + : media_streams_(original->media_streams_) { + } + typedef std::vector > StreamVector; + StreamVector media_streams_; +}; + +} // namespace webrtc + +#endif // TALK_APP_WEBRTC_STREAMCOLLECTIONIMPL_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/video_device_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/video_device_dev.cc deleted file mode 100644 index 71aaaa1528..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/video_device_dev.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libjingle - * Copyright 2004--2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "talk/app/webrtc_dev/local_stream_dev.h" - -namespace webrtc { - -scoped_refptr VideoDevice::Create(const std::string& name, - VideoCaptureModule* vcm) { - RefCountImpl* device = new RefCountImpl(); - device->Initialize(name,vcm); - return device; -} - -const std::string& VideoDevice::name(){ - return name_; -} - -VideoCaptureModule* VideoDevice::module() { - return vcm_; -} - -void VideoDevice::Initialize(const std::string& name, VideoCaptureModule* vcm) { - name_ = name; - vcm_ = vcm; -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/video_renderer_dev.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/video_renderer_dev.cc deleted file mode 100644 index bd309e35c5..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/video_renderer_dev.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * libjingle - * Copyright 2004--2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "talk/app/webrtc_dev/local_stream_dev.h" - -namespace webrtc { - -scoped_refptr VideoRenderer::Create(cricket::VideoRenderer* renderer) { - RefCountImpl* r = new RefCountImpl(); - r->Initialize(renderer); - return r; -} - -cricket::VideoRenderer* VideoRenderer::module() { - return renderer_; -} - -void VideoRenderer::Initialize(cricket::VideoRenderer* renderer) { - renderer_ = renderer; -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev_unittest.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc similarity index 68% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev_unittest.cc rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc index a3ed0009c2..29913ccdb7 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/remote_stream_dev_unittest.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videorendererimpl.cc @@ -1,6 +1,6 @@ /* * libjingle - * Copyright 2011, Google Inc. + * Copyright 2004--2011, Google Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,38 +25,34 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include "talk/app/webrtc_dev/mediastreamimpl.h" -#include "gtest/gtest.h" -#include "talk/app/webrtc_dev/remote_stream_dev.h" - -static const char kStreamLabel1[] = "remote_stream_1"; +#include "talk/session/phone/videorenderer.h" namespace webrtc { -// Helper class to test the Observer. -class TestObserver : public Observer { +// VideoRendererImpl take ownership of cricket::VideoRenderer. +class VideoRendererImpl : public VideoRenderer { public: - TestObserver() : changed_(0) {} - void OnChanged() { - ++changed_; + explicit VideoRendererImpl(cricket::VideoRenderer* renderer) + : renderer_(renderer) { } - int NoChanged() { - return changed_; + virtual cricket::VideoRenderer* renderer() { + return renderer_; } - protected: - int changed_; + ~VideoRendererImpl() { + delete renderer_; + } + private: + cricket::VideoRenderer* renderer_; }; -TEST(RemoteStreamTest, Create) { - // Create a Remote stream. - std::string label(kStreamLabel1); - scoped_refptr stream(RemoteMediaStreamImpl::Create(label)); - - EXPECT_EQ(stream->label().compare(label), 0); - // Check state. - EXPECT_EQ(stream->ready_state(), MediaStream::kInitializing); +scoped_refptr CreateVideoRenderer( + cricket::VideoRenderer* renderer) { + RefCountImpl* r = + new RefCountImpl(renderer); + return r; } } // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc new file mode 100644 index 0000000000..7f714899e2 --- /dev/null +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.cc @@ -0,0 +1,112 @@ +/* + * libjingle + * Copyright 2011, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "talk/app/webrtc_dev/videotrackimpl.h" + +#include + +namespace webrtc { + +VideoTrackImpl::VideoTrackImpl(const std::string& label, uint32 ssrc) + : enabled_(true), + kind_(kVideoTrackKind), + label_(label), + ssrc_(ssrc), + video_device_(NULL) { +} + +VideoTrackImpl::VideoTrackImpl(const std::string& label, + VideoCaptureModule* video_device) + : enabled_(true), + kind_(kVideoTrackKind), + label_(label), + ssrc_(0), + video_device_(video_device) { +} + +void VideoTrackImpl::SetRenderer(VideoRenderer* renderer) { + video_renderer_ = renderer; + NotifierImpl::FireOnChanged(); +} + +scoped_refptr VideoTrackImpl::GetRenderer() { + return video_renderer_; +} + + // Get the VideoCapture device associated with this track. +scoped_refptr VideoTrackImpl::GetVideoCapture() { + return video_device_.get(); +} + +const std::string& VideoTrackImpl::kind() { + return kind_; +} + +const std::string& VideoTrackImpl::label() { + return label_; +} + +bool VideoTrackImpl::enabled() { + return enabled_; +} + +bool VideoTrackImpl::set_enabled(bool enable) { + bool fire_on_change = enable != enabled_; + enabled_ = enable; + if (fire_on_change) + NotifierImpl::FireOnChanged(); +} + +uint32 VideoTrackImpl::ssrc() { + return ssrc_; +} + +bool VideoTrackImpl::set_ssrc(uint32 ssrc) { + ASSERT(ssrc_ == 0); + ASSERT(ssrc != 0); + if (ssrc_ != 0) + return false; + ssrc_ = ssrc; + NotifierImpl::FireOnChanged(); + return true; +} + +scoped_refptr VideoTrackImpl::Create(const std::string& label, + uint32 ssrc) { + RefCountImpl* track = + new RefCountImpl(label, ssrc); + return track; +} + +scoped_refptr CreateLocalVideoTrack( + const std::string& label, + VideoCaptureModule* video_device) { + RefCountImpl* track = + new RefCountImpl(label, video_device); + return track; +} + +} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h similarity index 56% rename from third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.h rename to third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h index 5ebb3a70c7..d1fae174ae 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/media_stream_impl_dev.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/videotrackimpl.h @@ -25,44 +25,51 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TALK_APP_WEBRTC_MEDIA_STREAM_IMPL_H_ -#define TALK_APP_WEBRTC_MEDIA_STREAM_IMPL_H_ +#ifndef TALK_APP_WEBRTC_VIDEOTRACKIMPL_H_ +#define TALK_APP_WEBRTC_VIDEOTRACKIMPL_H_ #include -#include -#include "talk/app/webrtc_dev/notifier_impl.h" -#include "talk/app/webrtc_dev/ref_count.h" +#include "talk/app/webrtc_dev/mediastream.h" +#include "talk/app/webrtc_dev/notifierimpl.h" #include "talk/app/webrtc_dev/scoped_refptr.h" -#include "talk/app/webrtc_dev/stream_dev.h" + +#ifdef WEBRTC_RELATIVE_PATH +#include "modules/video_capture/main/interface/video_capture.h" +#else +#include "third_party/webrtc/files/include/video_capture.h" +#endif namespace webrtc { -// MediaStreamImpl- help class for implementing the MediaStream interface. -class MediaStreamImpl { +class VideoTrackImpl : public NotifierImpl { public: - explicit MediaStreamImpl(const std::string& label); + static scoped_refptr Create(const std::string& label, + uint32 ssrc); + virtual scoped_refptr GetVideoCapture(); + virtual void SetRenderer(VideoRenderer* renderer); + scoped_refptr GetRenderer(); - // Implement MediaStream - const std::string& label() const; - MediaStream::ReadyState ready_state() const; + virtual const std::string& kind(); + virtual const std::string& label(); + virtual uint32 ssrc(); + virtual bool enabled(); + virtual bool set_enabled(bool enable); + virtual bool set_ssrc(uint32 ssrc); protected: + VideoTrackImpl(const std::string& label, uint32 ssrc); + VideoTrackImpl(const std::string& label, VideoCaptureModule* video_device); + + private: + bool enabled_; + std::string kind_; std::string label_; - MediaStream::ReadyState ready_state_; -}; - -class MediaStreamTrackListImpl { - public: - MediaStreamTrackListImpl(); - // Implement MediaStreamTrackList. - bool AddTrack(MediaStreamTrack* track); - size_t count() const; - scoped_refptr at(size_t index) const; - protected: - std::vector > tracks_; + uint32 ssrc_; + scoped_refptr video_device_; + scoped_refptr video_renderer_; }; } // namespace webrtc -#endif // TALK_APP_WEBRTC_MEDIA_STREAM_IMPL_H_ +#endif // TALK_APP_WEBRTC_VIDEOTRACKIMPL_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.cc deleted file mode 100644 index 545b690baf..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "talk/app/webrtc_dev/webrtc_mediaengine.h" - -#include "talk/base/logging.h" -#include "talk/session/phone/webrtcvoiceengine.h" -#include "talk/session/phone/webrtcvideoengine.h" - -namespace webrtc { - -WebRtcMediaEngine::WebRtcMediaEngine() - : voice_(new cricket::WebRtcVoiceEngine()), - video_(new cricket::WebRtcVideoEngine()) { -} - -WebRtcMediaEngine::WebRtcMediaEngine(webrtc::AudioDeviceModule* adm, - webrtc::AudioDeviceModule* adm_sc, webrtc::VideoCaptureModule* vcm) - : voice_(new cricket::WebRtcVoiceEngine(adm, adm_sc)), - video_(new cricket::WebRtcVideoEngine(voice_, vcm)) { -} - -WebRtcMediaEngine::~WebRtcMediaEngine() { - delete video_; - delete voice_; -} - -bool WebRtcMediaEngine::Init() { - if (!voice_->Init()) - return false; - if (!video_->Init()) { - voice_->Terminate(); - return false; - } - SignalVideoCaptureResult.repeat(video_->SignalCaptureResult); - return true; -} - -void WebRtcMediaEngine::Terminate() { - video_->Terminate(); - voice_->Terminate(); -} - -int WebRtcMediaEngine::GetCapabilities() { - return (voice_->GetCapabilities() | video_->GetCapabilities()); -} - -cricket::VoiceMediaChannel* WebRtcMediaEngine::CreateChannel() { - return voice_->CreateChannel(); -} - -cricket::VideoMediaChannel* WebRtcMediaEngine::CreateVideoChannel( - cricket::VoiceMediaChannel* channel) { - return video_->CreateChannel(channel); -} - -cricket::SoundclipMedia* WebRtcMediaEngine::CreateSoundclip() { - return voice_->CreateSoundclip(); -} - -bool WebRtcMediaEngine::SetAudioOptions(int o) { - return voice_->SetOptions(o); -} - -bool WebRtcMediaEngine::SetVideoOptions(int o) { - return video_->SetOptions(o); -} - -bool WebRtcMediaEngine::SetDefaultVideoEncoderConfig( - const cricket::VideoEncoderConfig& config) { - return video_->SetDefaultEncoderConfig(config); -} - -bool WebRtcMediaEngine::SetSoundDevices(const cricket::Device* in_device, - const cricket::Device* out_device) { - return voice_->SetDevices(in_device, out_device); -} - -bool WebRtcMediaEngine::SetVideoCaptureDevice( - const cricket::Device* cam_device) { - return video_->SetCaptureDevice(cam_device); -} - -bool WebRtcMediaEngine::GetOutputVolume(int* level) { - return voice_->GetOutputVolume(level); -} - -bool WebRtcMediaEngine::SetOutputVolume(int level) { - return voice_->SetOutputVolume(level); -} - -int WebRtcMediaEngine::GetInputLevel() { - return voice_->GetInputLevel(); -} - -bool WebRtcMediaEngine::SetLocalMonitor(bool enable) { - return voice_->SetLocalMonitor(enable); -} - -bool WebRtcMediaEngine::SetLocalRenderer(cricket::VideoRenderer* renderer) { - return video_->SetLocalRenderer(renderer); -} - -cricket::CaptureResult WebRtcMediaEngine::SetVideoCapture(bool capture) { - return video_->SetCapture(capture); -} - -const std::vector& WebRtcMediaEngine::audio_codecs() { - return voice_->codecs(); -} - -const std::vector& WebRtcMediaEngine::video_codecs() { - return video_->codecs(); -} - -void WebRtcMediaEngine::SetVoiceLogging(int min_sev, const char* filter) { - return voice_->SetLogging(min_sev, filter); -} - -void WebRtcMediaEngine::SetVideoLogging(int min_sev, const char* filter) { - return video_->SetLogging(min_sev, filter); -} - -bool WebRtcMediaEngine::SetVideoCaptureModule( - webrtc::VideoCaptureModule* vcm) { - return video_->SetCaptureModule(vcm); -} - -} // namespace webrtc diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.h deleted file mode 100644 index efe52fc80b..0000000000 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtc_mediaengine.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * libjingle - * Copyright 2011, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TALK_APP_WEBRTC_MEDIA_ENGINE_H_ -#define TALK_APP_WEBRTC_MEDIA_ENGINE_H_ - -#include - -#include "talk/session/phone/mediaengine.h" - -namespace cricket { -class WebRtcVideoEngine; -class WebRtcVoiceEngine; -} - -namespace webrtc { -class AudioDeviceModule; -class VideoCaptureModule; - -// TODO(perkj) Write comments. Why do we need to override cricket::MediaEngine. -class WebRtcMediaEngine : public cricket::MediaEngine { - public: - WebRtcMediaEngine(); - WebRtcMediaEngine(webrtc::AudioDeviceModule* adm, - webrtc::AudioDeviceModule* adm_sc, webrtc::VideoCaptureModule* vcm); - virtual ~WebRtcMediaEngine(); - virtual bool Init(); - virtual void Terminate(); - virtual int GetCapabilities(); - virtual cricket::VoiceMediaChannel *CreateChannel(); - virtual cricket::VideoMediaChannel *CreateVideoChannel( - cricket::VoiceMediaChannel* channel); - virtual cricket::SoundclipMedia *CreateSoundclip(); - virtual bool SetAudioOptions(int o); - virtual bool SetVideoOptions(int o); - virtual bool SetDefaultVideoEncoderConfig( - const cricket::VideoEncoderConfig& config); - virtual bool SetSoundDevices(const cricket::Device* in_device, - const cricket::Device* out_device); - virtual bool SetVideoCaptureDevice(const cricket::Device* cam_device); - virtual bool GetOutputVolume(int* level); - virtual bool SetOutputVolume(int level); - virtual int GetInputLevel(); - virtual bool SetLocalMonitor(bool enable); - virtual bool SetLocalRenderer(cricket::VideoRenderer* renderer); - virtual cricket::CaptureResult SetVideoCapture(bool capture); - virtual const std::vector& audio_codecs(); - virtual const std::vector& video_codecs(); - virtual void SetVoiceLogging(int min_sev, const char* filter); - virtual void SetVideoLogging(int min_sev, const char* filter); - - // Allow the VCM be set later if not ready during the construction time - bool SetVideoCaptureModule(webrtc::VideoCaptureModule* vcm); - - protected: - cricket::WebRtcVoiceEngine* voice_; - cricket::WebRtcVideoEngine* video_; -}; - -} // namespace WebRtcMediaEngine - -#endif // TALK_APP_WEBRTC_MEDIA_ENGINE_H_ diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.cc b/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.cc index 51e82f97bb..c2838e32b5 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.cc +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.cc @@ -27,7 +27,7 @@ #include "talk/app/webrtc/webrtcsessionchannel.h" -#include "talk/app/webrtc/stream_dev.h" +#include "talk/app/webrtc/mediastream.h" #include "talk/app/webrtc/webrtc_json_dev.h" #include "talk/base/logging.h" #include "talk/base/thread.h" diff --git a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.h b/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.h index fa6bf4dad5..bc012e3bdb 100644 --- a/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.h +++ b/third_party_mods/libjingle/source/talk/app/webrtc_dev/webrtcsessionchannel.h @@ -31,7 +31,7 @@ #include #include -#include "talk/app/webrtc/stream_dev.h" +#include "talk/app/webrtc/mediastream.h" #include "talk/base/messagehandler.h" #include "talk/base/scoped_ptr.h" #include "talk/base/sigslot.h"