OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 const int kMinBandwidthBps = 30000; | 36 const int kMinBandwidthBps = 30000; |
37 const int kStartBandwidthBps = 300000; | 37 const int kStartBandwidthBps = 300000; |
38 const int kMaxBandwidthBps = 2000000; | 38 const int kMaxBandwidthBps = 2000000; |
39 | 39 |
40 class MediaController : public webrtc::MediaControllerInterface { | 40 class MediaController : public webrtc::MediaControllerInterface { |
41 public: | 41 public: |
42 MediaController(rtc::Thread* worker_thread, | 42 MediaController(rtc::Thread* worker_thread, |
43 webrtc::VoiceEngine* voice_engine) | 43 webrtc::VoiceEngine* voice_engine) |
44 : worker_thread_(worker_thread) { | 44 : worker_thread_(worker_thread) { |
45 DCHECK(nullptr != worker_thread); | 45 RTC_DCHECK(nullptr != worker_thread); |
46 worker_thread_->Invoke<void>( | 46 worker_thread_->Invoke<void>( |
47 rtc::Bind(&MediaController::Construct_w, this, voice_engine)); | 47 rtc::Bind(&MediaController::Construct_w, this, voice_engine)); |
48 } | 48 } |
49 ~MediaController() override { | 49 ~MediaController() override { |
50 worker_thread_->Invoke<void>( | 50 worker_thread_->Invoke<void>( |
51 rtc::Bind(&MediaController::Destruct_w, this)); | 51 rtc::Bind(&MediaController::Destruct_w, this)); |
52 } | 52 } |
53 | 53 |
54 webrtc::Call* call_w() override { | 54 webrtc::Call* call_w() override { |
55 DCHECK(worker_thread_->IsCurrent()); | 55 RTC_DCHECK(worker_thread_->IsCurrent()); |
56 return call_.get(); | 56 return call_.get(); |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
60 void Construct_w(webrtc::VoiceEngine* voice_engine) { | 60 void Construct_w(webrtc::VoiceEngine* voice_engine) { |
61 DCHECK(worker_thread_->IsCurrent()); | 61 RTC_DCHECK(worker_thread_->IsCurrent()); |
62 webrtc::Call::Config config; | 62 webrtc::Call::Config config; |
63 config.voice_engine = voice_engine; | 63 config.voice_engine = voice_engine; |
64 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 64 config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
65 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 65 config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
66 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 66 config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
67 call_.reset(webrtc::Call::Create(config)); | 67 call_.reset(webrtc::Call::Create(config)); |
68 } | 68 } |
69 void Destruct_w() { | 69 void Destruct_w() { |
70 DCHECK(worker_thread_->IsCurrent()); | 70 RTC_DCHECK(worker_thread_->IsCurrent()); |
71 call_.reset(nullptr); | 71 call_.reset(nullptr); |
72 } | 72 } |
73 | 73 |
74 rtc::Thread* worker_thread_; | 74 rtc::Thread* worker_thread_; |
75 rtc::scoped_ptr<webrtc::Call> call_; | 75 rtc::scoped_ptr<webrtc::Call> call_; |
76 | 76 |
77 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); | 77 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); |
78 }; | 78 }; |
79 } // namespace { | 79 } // namespace { |
80 | 80 |
81 namespace webrtc { | 81 namespace webrtc { |
82 | 82 |
83 MediaControllerInterface* MediaControllerInterface::Create( | 83 MediaControllerInterface* MediaControllerInterface::Create( |
84 rtc::Thread* worker_thread, webrtc::VoiceEngine* voice_engine) { | 84 rtc::Thread* worker_thread, webrtc::VoiceEngine* voice_engine) { |
85 return new MediaController(worker_thread, voice_engine); | 85 return new MediaController(worker_thread, voice_engine); |
86 } | 86 } |
87 } // namespace webrtc | 87 } // namespace webrtc |
OLD | NEW |