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

Unified Diff: webrtc/video/vie_encoder.h

Issue 2257413002: Replace interface VideoCapturerInput with VideoSinkInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 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 | « webrtc/video/video_send_stream_tests.cc ('k') | webrtc/video/vie_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_encoder.h
diff --git a/webrtc/video/vie_encoder.h b/webrtc/video/vie_encoder.h
index 1b524e5bb9ecd730e8c4c343da7b208c3a1e97f4..eaf2536daba341b07adc8c99badeb6641bba8eab 100644
--- a/webrtc/video/vie_encoder.h
+++ b/webrtc/video/vie_encoder.h
@@ -40,11 +40,11 @@ class SendStatisticsProxy;
// and produces an encoded bit stream.
// Usage:
// Instantiate.
-// Call SetStartRate and SetSink.
+// Call SetSink.
+// Call SetSource.
// Call ConfigureEncoder with the codec settings.
-// Provide frames to encode by calling IncomingCapturedFrame.
// Call Stop() when done.
-class ViEEncoder : public VideoCaptureInput,
+class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
public EncodedImageCallback,
public VCMSendStatisticsCallback,
public CpuOveruseObserver {
@@ -63,6 +63,7 @@ class ViEEncoder : public VideoCaptureInput,
void RegisterProcessThread(ProcessThread* module_process_thread);
void DeRegisterProcessThread();
+ void SetSource(rtc::VideoSourceInterface<VideoFrame>* source);
void SetSink(EncodedImageCallback* sink);
// TODO(perkj): Can we remove VideoCodec.startBitrate ?
@@ -75,11 +76,6 @@ class ViEEncoder : public VideoCaptureInput,
// guaranteed that no encoded frames will be delivered to the sink.
void Stop();
- // Implements VideoCaptureInput.
- // TODO(perkj): Refactor ViEEncoder to inherit rtc::VideoSink instead of
- // VideoCaptureInput.
- void IncomingCapturedFrame(const VideoFrame& video_frame) override;
-
void SendKeyFrame();
// virtual to test EncoderStateFeedback with mocks.
@@ -93,10 +89,14 @@ class ViEEncoder : public VideoCaptureInput,
private:
class EncodeTask;
+ class VideoSourceProxy;
void ConfigureEncoderInternal(const VideoCodec& video_codec,
size_t max_data_payload_length);
+ // Implements VideoSinkInterface.
+ void OnFrame(const VideoFrame& video_frame) override;
+
// Implements VideoSendStatisticsCallback.
void SendStatistics(uint32_t bit_rate,
uint32_t frame_rate) override;
@@ -121,6 +121,8 @@ class ViEEncoder : public VideoCaptureInput,
rtc::Event shutdown_event_;
const uint32_t number_of_cores_;
+
+ const std::unique_ptr<VideoSourceProxy> source_proxy_;
EncodedImageCallback* sink_;
const VideoSendStream::Config::EncoderSettings settings_;
@@ -134,6 +136,9 @@ class ViEEncoder : public VideoCaptureInput,
rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_;
ProcessThread* module_process_thread_;
rtc::ThreadChecker module_process_thread_checker_;
+ // |thread_checker_| checks that public methods that are related to lifetime
+ // of ViEEncoder are called on the same thread.
+ rtc::ThreadChecker thread_checker_;
VideoCodec encoder_config_ ACCESS_ON(&encoder_queue_);
@@ -160,6 +165,8 @@ class ViEEncoder : public VideoCaptureInput,
// All public methods are proxied to |encoder_queue_|. It must must be
// destroyed first to make sure no tasks are run that use other members.
rtc::TaskQueue encoder_queue_;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder);
};
} // namespace webrtc
« no previous file with comments | « webrtc/video/video_send_stream_tests.cc ('k') | webrtc/video/vie_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698