| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   92   virtual void OnReceivedSLI(uint8_t picture_id); |   92   virtual void OnReceivedSLI(uint8_t picture_id); | 
|   93   virtual void OnReceivedRPSI(uint64_t picture_id); |   93   virtual void OnReceivedRPSI(uint64_t picture_id); | 
|   94  |   94  | 
|   95   void OnBitrateUpdated(uint32_t bitrate_bps, |   95   void OnBitrateUpdated(uint32_t bitrate_bps, | 
|   96                         uint8_t fraction_lost, |   96                         uint8_t fraction_lost, | 
|   97                         int64_t round_trip_time_ms); |   97                         int64_t round_trip_time_ms); | 
|   98  |   98  | 
|   99  private: |   99  private: | 
|  100   class EncodeTask; |  100   class EncodeTask; | 
|  101   class VideoSourceProxy; |  101   class VideoSourceProxy; | 
 |  102   class ConfigureEncoderTask; | 
|  102  |  103  | 
|  103   void ConfigureEncoderInternal(const VideoCodec& video_codec, |  104   void ConfigureEncoderOnTaskQueue(VideoEncoderConfig config, | 
|  104                                 size_t max_data_payload_length, |  105                                    size_t max_data_payload_length); | 
|  105                                 std::vector<VideoStream> stream, |  | 
|  106                                 int min_transmit_bitrate); |  | 
|  107  |  106  | 
|  108   // Implements VideoSinkInterface. |  107   // Implements VideoSinkInterface. | 
|  109   void OnFrame(const VideoFrame& video_frame) override; |  108   void OnFrame(const VideoFrame& video_frame) override; | 
|  110  |  109  | 
|  111   // Implements VideoSendStatisticsCallback. |  110   // Implements VideoSendStatisticsCallback. | 
|  112   void SendStatistics(uint32_t bit_rate, |  111   void SendStatistics(uint32_t bit_rate, | 
|  113                       uint32_t frame_rate) override; |  112                       uint32_t frame_rate) override; | 
|  114  |  113  | 
|  115   void EncodeVideoFrame(const VideoFrame& frame, |  114   void EncodeVideoFrame(const VideoFrame& frame, | 
|  116                         int64_t time_when_posted_in_ms); |  115                         int64_t time_when_posted_in_ms); | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
|  129   void TraceFrameDropStart(); |  128   void TraceFrameDropStart(); | 
|  130   void TraceFrameDropEnd(); |  129   void TraceFrameDropEnd(); | 
|  131  |  130  | 
|  132   rtc::Event shutdown_event_; |  131   rtc::Event shutdown_event_; | 
|  133  |  132  | 
|  134   const uint32_t number_of_cores_; |  133   const uint32_t number_of_cores_; | 
|  135  |  134  | 
|  136   const std::unique_ptr<VideoSourceProxy> source_proxy_; |  135   const std::unique_ptr<VideoSourceProxy> source_proxy_; | 
|  137   EncoderSink* sink_; |  136   EncoderSink* sink_; | 
|  138   const VideoSendStream::Config::EncoderSettings settings_; |  137   const VideoSendStream::Config::EncoderSettings settings_; | 
 |  138   const VideoCodecType codec_type_; | 
|  139  |  139  | 
|  140   const std::unique_ptr<VideoProcessing> vp_; |  140   const std::unique_ptr<VideoProcessing> vp_; | 
|  141   vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); |  141   vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); | 
|  142  |  142  | 
|  143   OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_); |  143   OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_); | 
|  144   LoadObserver* const load_observer_ ACCESS_ON(&encoder_queue_); |  144   LoadObserver* const load_observer_ ACCESS_ON(&encoder_queue_); | 
|  145  |  145  | 
|  146   SendStatisticsProxy* const stats_proxy_; |  146   SendStatisticsProxy* const stats_proxy_; | 
|  147   rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; |  147   rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; | 
|  148   ProcessThread* module_process_thread_; |  148   ProcessThread* module_process_thread_; | 
|  149   rtc::ThreadChecker module_process_thread_checker_; |  149   rtc::ThreadChecker module_process_thread_checker_; | 
|  150   // |thread_checker_| checks that public methods that are related to lifetime |  150   // |thread_checker_| checks that public methods that are related to lifetime | 
|  151   // of ViEEncoder are called on the same thread. |  151   // of ViEEncoder are called on the same thread. | 
|  152   rtc::ThreadChecker thread_checker_; |  152   rtc::ThreadChecker thread_checker_; | 
|  153  |  153  | 
|  154   VideoCodec encoder_config_ ACCESS_ON(&encoder_queue_); |  154   VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); | 
|  155  |  155  | 
|  156   int encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); |  156   uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); | 
 |  157   size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); | 
|  157   uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); |  158   uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); | 
|  158   bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); |  159   bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); | 
|  159   bool has_received_sli_ ACCESS_ON(&encoder_queue_); |  160   bool has_received_sli_ ACCESS_ON(&encoder_queue_); | 
|  160   uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); |  161   uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); | 
|  161   bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); |  162   bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); | 
|  162   uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); |  163   uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); | 
|  163   Clock* const clock_; |  164   Clock* const clock_; | 
|  164  |  165  | 
|  165   rtc::RaceChecker incoming_frame_race_checker_; |  166   rtc::RaceChecker incoming_frame_race_checker_; | 
|  166   Atomic32 posted_frames_waiting_for_encode_; |  167   Atomic32 posted_frames_waiting_for_encode_; | 
|  167   // Used to make sure incoming time stamp is increasing for every frame. |  168   // Used to make sure incoming time stamp is increasing for every frame. | 
|  168   int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); |  169   int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); | 
|  169   // Delta used for translating between NTP and internal timestamps. |  170   // Delta used for translating between NTP and internal timestamps. | 
|  170   const int64_t delta_ntp_internal_ms_; |  171   const int64_t delta_ntp_internal_ms_; | 
|  171  |  172  | 
|  172   int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); |  173   int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); | 
|  173   int captured_frame_count_ ACCESS_ON(&encoder_queue_); |  174   int captured_frame_count_ ACCESS_ON(&encoder_queue_); | 
|  174   int dropped_frame_count_ ACCESS_ON(&encoder_queue_); |  175   int dropped_frame_count_ ACCESS_ON(&encoder_queue_); | 
|  175  |  176  | 
|  176   // All public methods are proxied to |encoder_queue_|. It must must be |  177   // All public methods are proxied to |encoder_queue_|. It must must be | 
|  177   // destroyed first to make sure no tasks are run that use other members. |  178   // destroyed first to make sure no tasks are run that use other members. | 
|  178   rtc::TaskQueue encoder_queue_; |  179   rtc::TaskQueue encoder_queue_; | 
|  179  |  180  | 
|  180   RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |  181   RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); | 
|  181 }; |  182 }; | 
|  182  |  183  | 
|  183 }  // namespace webrtc |  184 }  // namespace webrtc | 
|  184  |  185  | 
|  185 #endif  // WEBRTC_VIDEO_VIE_ENCODER_H_ |  186 #endif  // WEBRTC_VIDEO_VIE_ENCODER_H_ | 
| OLD | NEW |