| 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
|
|
|