OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Implements BitrateObserver. | 95 // Implements BitrateObserver. |
96 virtual void OnNetworkChanged(uint32_t bitrate_bps, | 96 virtual void OnNetworkChanged(uint32_t bitrate_bps, |
97 uint8_t fraction_lost, | 97 uint8_t fraction_lost, |
98 int64_t rtt) { | 98 int64_t rtt) { |
99 owner_->OnNetworkChanged(bitrate_bps, fraction_lost, rtt); | 99 owner_->OnNetworkChanged(bitrate_bps, fraction_lost, rtt); |
100 } | 100 } |
101 private: | 101 private: |
102 ViEEncoder* owner_; | 102 ViEEncoder* owner_; |
103 }; | 103 }; |
104 | 104 |
105 ViEEncoder::ViEEncoder(int32_t channel_id, | 105 ViEEncoder::ViEEncoder(uint32_t number_of_cores, |
106 uint32_t number_of_cores, | |
107 ProcessThread* module_process_thread, | 106 ProcessThread* module_process_thread, |
108 SendStatisticsProxy* stats_proxy, | 107 SendStatisticsProxy* stats_proxy, |
109 I420FrameCallback* pre_encode_callback, | 108 I420FrameCallback* pre_encode_callback, |
110 PacedSender* pacer, | 109 PacedSender* pacer, |
111 BitrateAllocator* bitrate_allocator) | 110 BitrateAllocator* bitrate_allocator) |
112 : channel_id_(channel_id), | 111 : number_of_cores_(number_of_cores), |
113 number_of_cores_(number_of_cores), | |
114 vpm_(VideoProcessingModule::Create()), | 112 vpm_(VideoProcessingModule::Create()), |
115 qm_callback_(new QMVideoSettingsCallback(vpm_.get())), | 113 qm_callback_(new QMVideoSettingsCallback(vpm_.get())), |
116 vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(), | 114 vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(), |
117 this, | 115 this, |
118 qm_callback_.get())), | 116 qm_callback_.get())), |
119 send_payload_router_(NULL), | 117 send_payload_router_(NULL), |
120 data_cs_(CriticalSectionWrapper::CreateCriticalSection()), | 118 data_cs_(CriticalSectionWrapper::CreateCriticalSection()), |
121 stats_proxy_(stats_proxy), | 119 stats_proxy_(stats_proxy), |
122 pre_encode_callback_(pre_encode_callback), | 120 pre_encode_callback_(pre_encode_callback), |
123 pacer_(pacer), | 121 pacer_(pacer), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void ViEEncoder::StopThreadsAndRemoveSharedMembers() { | 167 void ViEEncoder::StopThreadsAndRemoveSharedMembers() { |
170 if (bitrate_allocator_) | 168 if (bitrate_allocator_) |
171 bitrate_allocator_->RemoveBitrateObserver(bitrate_observer_.get()); | 169 bitrate_allocator_->RemoveBitrateObserver(bitrate_observer_.get()); |
172 module_process_thread_->DeRegisterModule(vcm_.get()); | 170 module_process_thread_->DeRegisterModule(vcm_.get()); |
173 module_process_thread_->DeRegisterModule(vpm_.get()); | 171 module_process_thread_->DeRegisterModule(vpm_.get()); |
174 } | 172 } |
175 | 173 |
176 ViEEncoder::~ViEEncoder() { | 174 ViEEncoder::~ViEEncoder() { |
177 } | 175 } |
178 | 176 |
179 int ViEEncoder::Owner() const { | |
180 return channel_id_; | |
181 } | |
182 | |
183 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { | 177 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { |
184 { | 178 { |
185 CriticalSectionScoped cs(data_cs_.get()); | 179 CriticalSectionScoped cs(data_cs_.get()); |
186 network_is_transmitting_ = is_transmitting; | 180 network_is_transmitting_ = is_transmitting; |
187 } | 181 } |
188 } | 182 } |
189 | 183 |
190 void ViEEncoder::Pause() { | 184 void ViEEncoder::Pause() { |
191 CriticalSectionScoped cs(data_cs_.get()); | 185 CriticalSectionScoped cs(data_cs_.get()); |
192 encoder_paused_ = true; | 186 encoder_paused_ = true; |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 std::vector<uint32_t> stream_bitrates = AllocateStreamBitrates( | 675 std::vector<uint32_t> stream_bitrates = AllocateStreamBitrates( |
682 bitrate_bps, stream_configs, send_codec.numberOfSimulcastStreams); | 676 bitrate_bps, stream_configs, send_codec.numberOfSimulcastStreams); |
683 send_payload_router_->SetTargetSendBitrates(stream_bitrates); | 677 send_payload_router_->SetTargetSendBitrates(stream_bitrates); |
684 | 678 |
685 { | 679 { |
686 CriticalSectionScoped cs(data_cs_.get()); | 680 CriticalSectionScoped cs(data_cs_.get()); |
687 last_observed_bitrate_bps_ = bitrate_bps; | 681 last_observed_bitrate_bps_ = bitrate_bps; |
688 if (video_suspended_ == video_is_suspended) | 682 if (video_suspended_ == video_is_suspended) |
689 return; | 683 return; |
690 video_suspended_ = video_is_suspended; | 684 video_suspended_ = video_is_suspended; |
691 LOG(LS_INFO) << "Video suspended " << video_is_suspended | 685 |
692 << " for channel " << channel_id_; | 686 LOG(LS_INFO) << "Video suspend state changed " << video_is_suspended |
| 687 << " for ssrc " << ssrc_streams_.begin()->first; |
693 } | 688 } |
694 // Video suspend-state changed, inform codec observer. | 689 // Video suspend-state changed, inform codec observer. |
695 if (stats_proxy_) | 690 if (stats_proxy_) |
696 stats_proxy_->OnSuspendChange(video_is_suspended); | 691 stats_proxy_->OnSuspendChange(video_is_suspended); |
697 } | 692 } |
698 | 693 |
699 void ViEEncoder::SuspendBelowMinBitrate() { | 694 void ViEEncoder::SuspendBelowMinBitrate() { |
700 vcm_->SuspendBelowMinBitrate(); | 695 vcm_->SuspendBelowMinBitrate(); |
701 bitrate_allocator_->EnforceMinBitrate(false); | 696 bitrate_allocator_->EnforceMinBitrate(false); |
702 } | 697 } |
(...skipping 15 matching lines...) Expand all Loading... |
718 const uint32_t width, | 713 const uint32_t width, |
719 const uint32_t height) { | 714 const uint32_t height) { |
720 return vpm_->SetTargetResolution(width, height, frame_rate); | 715 return vpm_->SetTargetResolution(width, height, frame_rate); |
721 } | 716 } |
722 | 717 |
723 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 718 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
724 vpm_->SetTargetFramerate(frame_rate); | 719 vpm_->SetTargetFramerate(frame_rate); |
725 } | 720 } |
726 | 721 |
727 } // namespace webrtc | 722 } // namespace webrtc |
OLD | NEW |