Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: talk/app/webrtc/mediacontroller.cc

Issue 1269863005: MediaController/Call instantiation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/mediacontroller.cc
diff --git a/talk/app/webrtc/mediacontroller.cc b/talk/app/webrtc/mediacontroller.cc
index 33db3ac8f2bb39e2cba44276286a53a083d271a0..46ccb802f261cdb27b51e03cf5b22514e45f50d2 100644
--- a/talk/app/webrtc/mediacontroller.cc
+++ b/talk/app/webrtc/mediacontroller.cc
@@ -25,7 +25,60 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// Place holder file to be able to update Chrome's libjingle.gyp before the real
-// implementation goes in.
-
#include "talk/app/webrtc/mediacontroller.h"
+
+#include "webrtc/base/bind.h"
+#include "webrtc/base/checks.h"
+#include "webrtc/call.h"
+
+namespace webrtc {
+
+const int kMinBandwidthBps = 30000;
+const int kStartBandwidthBps = 300000;
+const int kMaxBandwidthBps = 2000000;
+
+class MediaControllerImpl : public MediaController {
pthatcher1 2015/09/09 07:27:43 And this should be class MediaController : MediaCo
the sun 2015/09/09 08:24:51 Done.
+ public:
+ MediaControllerImpl(rtc::Thread* worker_thread,
+ webrtc::VoiceEngine* voice_engine)
+ : worker_thread_(worker_thread) {
+ DCHECK(nullptr != worker_thread);
+ worker_thread_->Invoke<void>(
+ rtc::Bind(&MediaControllerImpl::Construct_w, this, voice_engine));
+ }
+ ~MediaControllerImpl() override {
+ worker_thread_->Invoke<void>(
+ rtc::Bind(&MediaControllerImpl::Destruct_w, this));
+ }
+
+ webrtc::Call* call_w() override {
+ DCHECK(worker_thread_->IsCurrent());
+ return call_.get();
+ }
+
+ private:
+ void Construct_w(webrtc::VoiceEngine* voice_engine) {
+ DCHECK(worker_thread_->IsCurrent());
+ webrtc::Call::Config config;
+ config.voice_engine = voice_engine;
+ config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
+ config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
+ config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
+ call_.reset(webrtc::Call::Create(config));
+ }
+ void Destruct_w() {
+ DCHECK(worker_thread_->IsCurrent());
+ call_.reset(nullptr);
+ }
+
+ rtc::Thread* worker_thread_;
+ rtc::scoped_ptr<webrtc::Call> call_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MediaControllerImpl);
+};
+
+MediaController* MediaController::Create(rtc::Thread* worker_thread,
+ webrtc::VoiceEngine* voice_engine) {
+ return new MediaControllerImpl(worker_thread, voice_engine);
+}
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698