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

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: Move PowerObserver implementation directly in the encoder. 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') | media/cast/sender/h264_vt_encoder.cc » ('J')
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 756571c0c10bb804ae46e26556bfeb2c248ea4f0..f197c3765c70d420b09f55cc178769ab7415afb3 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"
@@ -17,8 +18,10 @@ namespace cast {
// VideoToolbox implementation of the media::cast::VideoEncoder interface.
// VideoToolbox makes no guarantees that it is thread safe, so this object is
// pinned to the thread on which it is constructed. Supports changing frame
-// sizes directly.
-class H264VideoToolboxEncoder : public VideoEncoder {
+// sizes directly. Implements the base::PowerObserver interface to reset the
+// compression session when the host process is suspended.
+class H264VideoToolboxEncoder : public VideoEncoder,
+ public base::PowerObserver {
typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef;
typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef;
typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags;
@@ -45,6 +48,10 @@ class H264VideoToolboxEncoder : public VideoEncoder {
scoped_ptr<VideoFrameFactory> CreateVideoFrameFactory() override;
void EmitFrames() override;
+ // base::PowerObserver
+ void OnSuspend() override;
+ void OnResume() override;
+
private:
// VideoFrameFactory tied to the VideoToolbox encoder.
class VideoFrameFactoryImpl;
« no previous file with comments | « no previous file | media/cast/sender/h264_vt_encoder.cc » ('j') | media/cast/sender/h264_vt_encoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698