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

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: Remove redundant reset(nullptr) 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
« no previous file with comments | « talk/app/webrtc/mediacontroller.h ('k') | talk/app/webrtc/webrtcsession.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/mediacontroller.cc
diff --git a/talk/app/webrtc/mediacontroller.cc b/talk/app/webrtc/mediacontroller.cc
index 33db3ac8f2bb39e2cba44276286a53a083d271a0..d8c9b52095ec69bfd9b7948c810c2edf03e2d79f 100644
--- a/talk/app/webrtc/mediacontroller.cc
+++ b/talk/app/webrtc/mediacontroller.cc
@@ -25,7 +25,63 @@
* 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 {
+
+const int kMinBandwidthBps = 30000;
+const int kStartBandwidthBps = 300000;
+const int kMaxBandwidthBps = 2000000;
+
+class MediaController : public webrtc::MediaControllerInterface {
+ public:
+ MediaController(rtc::Thread* worker_thread,
+ webrtc::VoiceEngine* voice_engine)
+ : worker_thread_(worker_thread) {
+ DCHECK(nullptr != worker_thread);
+ worker_thread_->Invoke<void>(
+ rtc::Bind(&MediaController::Construct_w, this, voice_engine));
+ }
+ ~MediaController() override {
+ worker_thread_->Invoke<void>(
+ rtc::Bind(&MediaController::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(MediaController);
+};
+} // namespace {
+
+namespace webrtc {
+
+MediaControllerInterface* MediaControllerInterface::Create(
+ rtc::Thread* worker_thread, webrtc::VoiceEngine* voice_engine) {
+ return new MediaController(worker_thread, voice_engine);
+}
+} // namespace webrtc
« no previous file with comments | « talk/app/webrtc/mediacontroller.h ('k') | talk/app/webrtc/webrtcsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698