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

Unified Diff: media/cast/video_sender/video_encoder_impl.h

Issue 132283006: Revert of Cast: Fix threading issues in VideoEncoderImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « media/cast/video_sender/codecs/vp8/vp8_encoder.cc ('k') | media/cast/video_sender/video_encoder_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/video_sender/video_encoder_impl.h
diff --git a/media/cast/video_sender/video_encoder_impl.h b/media/cast/video_sender/video_encoder_impl.h
index 1a13a79a6ee5f48e90093cf802782abd2d39458b..5c424904bbb15adaee29acfea87cacfbb678eee8 100644
--- a/media/cast/video_sender/video_encoder_impl.h
+++ b/media/cast/video_sender/video_encoder_impl.h
@@ -6,6 +6,7 @@
#define MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_IMPL_H_
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "media/cast/cast_config.h"
#include "media/cast/cast_environment.h"
#include "media/cast/video_sender/codecs/vp8/vp8_encoder.h"
@@ -20,12 +21,6 @@
// the video encoder thread.
class VideoEncoderImpl : public VideoEncoder {
public:
- struct CodecDynamicConfig {
- bool key_frame_requested;
- uint32 latest_frame_id_to_reference;
- int bit_rate;
- };
-
typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>,
const base::TimeTicks&)> FrameEncodedCallback;
@@ -54,19 +49,27 @@
virtual void LatestFrameIdToReference(uint32 frame_id) OVERRIDE;
virtual int NumberOfSkippedFrames() const OVERRIDE;
+ protected:
+ struct CodecDynamicConfig {
+ bool key_frame_requested;
+ uint32 latest_frame_id_to_reference;
+ int bit_rate;
+ };
+
+ // The actual encode, called from the video encoder thread.
+ void EncodeVideoFrameEncoderThread(
+ const scoped_refptr<media::VideoFrame>& video_frame,
+ const base::TimeTicks& capture_time,
+ const CodecDynamicConfig& dynamic_config,
+ const FrameEncodedCallback& frame_encoded_callback);
+
private:
-
const VideoSenderConfig video_config_;
scoped_refptr<CastEnvironment> cast_environment_;
+ scoped_ptr<Vp8Encoder> vp8_encoder_;
CodecDynamicConfig dynamic_config_;
bool skip_next_frame_;
int skip_count_;
-
- // This member belongs to the video encoder thread. It must not be
- // dereferenced on the main thread. We manage the lifetime of this member
- // manually because it needs to be initialize, used and destroyed on the
- // video encoder thread and video encoder thread can out-live the main thread.
- scoped_ptr<Vp8Encoder> vp8_encoder_;
DISALLOW_COPY_AND_ASSIGN(VideoEncoderImpl);
};
« no previous file with comments | « media/cast/video_sender/codecs/vp8/vp8_encoder.cc ('k') | media/cast/video_sender/video_encoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698