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

Unified Diff: media/cast/sender/h264_vt_encoder.h

Issue 1094403002: Add power monitoring to the Cast VideoToolbox encoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | media/cast/sender/h264_vt_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/h264_vt_encoder.h
diff --git a/media/cast/sender/h264_vt_encoder.h b/media/cast/sender/h264_vt_encoder.h
index 7ae2f0545b337b24d733837cac06046c8d25209d..7a099b41336b4c781ea6f41e87e9167febdb4982 100644
--- a/media/cast/sender/h264_vt_encoder.h
+++ b/media/cast/sender/h264_vt_encoder.h
@@ -6,6 +6,7 @@
#define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
#include "base/mac/scoped_cftyperef.h"
+#include "base/power_monitor/power_observer.h"
#include "base/threading/thread_checker.h"
#include "media/base/mac/videotoolbox_glue.h"
#include "media/cast/sender/size_adaptable_video_encoder_base.h"
@@ -24,9 +25,6 @@ class H264VideoToolboxEncoder : public VideoEncoder {
typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags;
public:
- // VideoFrameFactory tied to the VideoToolbox encoder.
- class VideoFrameFactoryImpl;
-
// Returns true if the current platform and system configuration supports
// using H264VideoToolboxEncoder with the given |video_config|.
static bool IsSupported(const VideoSenderConfig& video_config);
@@ -78,6 +76,24 @@ class H264VideoToolboxEncoder : public VideoEncoder {
VTEncodeInfoFlags info,
CMSampleBufferRef sbuf);
+ // VideoFrameFactory tied to the encoder.
+ class VideoFrameFactoryImpl;
+
+ // PowerObserver tied to the encoder. Emits all frames and destroys the
+ // compression session on suspend and resets the compression session on
+ // resume.
+ class PowerObserver : public base::PowerObserver {
miu 2015/04/22 04:02:58 Instead of a nested class, how about making H264Vi
jfroy 2015/04/22 04:18:45 I considered that but decided to use an auxiliary
+ public:
+ explicit PowerObserver(H264VideoToolboxEncoder* encoder);
+ virtual ~PowerObserver();
+ void OnSuspend() override;
+ void OnResume() override;
+
+ private:
+ H264VideoToolboxEncoder* encoder_;
+ DISALLOW_COPY_AND_ASSIGN(PowerObserver);
+ };
+
// The cast environment (contains worker threads & more).
const scoped_refptr<CastEnvironment> cast_environment_;
@@ -99,6 +115,9 @@ class H264VideoToolboxEncoder : public VideoEncoder {
// Thread checker to enforce that this object is used on a specific thread.
base::ThreadChecker thread_checker_;
+ // PowerObserver tied to the encoder.
+ const PowerObserver power_observer_;
+
// The compression session.
base::ScopedCFTypeRef<VTCompressionSessionRef> compression_session_;
« no previous file with comments | « no previous file | media/cast/sender/h264_vt_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698