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

Side by Side Diff: media/cast/sender/h264_vt_encoder.h

Issue 883013003: [Cast] Separate frame size from VideoSenderConfig in H264VideoToolboxEncoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/cast/sender/h264_vt_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ 5 #ifndef MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
6 #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ 6 #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
7 7
8 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #include "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 #include "media/base/mac/videotoolbox_glue.h" 10 #include "media/base/mac/videotoolbox_glue.h"
11 #include "media/cast/sender/video_encoder.h" 11 #include "media/cast/sender/video_encoder.h"
12 12
13 namespace media { 13 namespace media {
14 namespace cast { 14 namespace cast {
15 15
16 // VideoToolbox implementation of the media::cast::VideoEncoder interface. 16 // VideoToolbox implementation of the media::cast::VideoEncoder interface.
17 // VideoToolbox makes no guarantees that it is thread safe, so this object is 17 // VideoToolbox makes no guarantees that it is thread safe, so this object is
18 // pinned to the thread on which it is constructed. 18 // pinned to the thread on which it is constructed.
19 class H264VideoToolboxEncoder : public VideoEncoder { 19 class H264VideoToolboxEncoder : public VideoEncoder {
20 typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef; 20 typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef;
21 typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef; 21 typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef;
22 typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags; 22 typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags;
23 23
24 public: 24 public:
25 H264VideoToolboxEncoder(scoped_refptr<CastEnvironment> cast_environment, 25 H264VideoToolboxEncoder(
26 const VideoSenderConfig& video_config, 26 const scoped_refptr<CastEnvironment>& cast_environment,
27 const CastInitializationCallback& initialization_cb); 27 const VideoSenderConfig& video_config,
28 const gfx::Size& frame_size,
29 const CastInitializationCallback& initialization_cb);
28 ~H264VideoToolboxEncoder() override; 30 ~H264VideoToolboxEncoder() override;
29 31
30 // media::cast::VideoEncoder implementation 32 // media::cast::VideoEncoder implementation
31 bool EncodeVideoFrame( 33 bool EncodeVideoFrame(
32 const scoped_refptr<media::VideoFrame>& video_frame, 34 const scoped_refptr<media::VideoFrame>& video_frame,
33 const base::TimeTicks& reference_time, 35 const base::TimeTicks& reference_time,
34 const FrameEncodedCallback& frame_encoded_callback) override; 36 const FrameEncodedCallback& frame_encoded_callback) override;
35 void SetBitRate(int new_bit_rate) override; 37 void SetBitRate(int new_bit_rate) override;
36 void GenerateKeyFrame() override; 38 void GenerateKeyFrame() override;
37 void LatestFrameIdToReference(uint32 frame_id) override; 39 void LatestFrameIdToReference(uint32 frame_id) override;
38 scoped_ptr<VideoFrameFactory> CreateVideoFrameFactory() override; 40 scoped_ptr<VideoFrameFactory> CreateVideoFrameFactory() override;
39 41
40 private: 42 private:
41 // Initialize the compression session. 43 // Initialize the compression session.
42 bool Initialize(const VideoSenderConfig& video_config); 44 bool Initialize(const VideoSenderConfig& video_config,
45 const gfx::Size& frame_size);
43 46
44 // Configure the compression session. 47 // Configure the compression session.
45 void ConfigureSession(const VideoSenderConfig& video_config); 48 void ConfigureSession(const VideoSenderConfig& video_config);
46 49
47 // Teardown the encoder. 50 // Teardown the encoder.
48 void Teardown(); 51 void Teardown();
49 52
50 // Set a compression session property. 53 // Set a compression session property.
51 bool SetSessionProperty(CFStringRef key, int32_t value); 54 bool SetSessionProperty(CFStringRef key, int32_t value);
52 bool SetSessionProperty(CFStringRef key, bool value); 55 bool SetSessionProperty(CFStringRef key, bool value);
(...skipping 24 matching lines...) Expand all
77 // Force next frame to be a keyframe. 80 // Force next frame to be a keyframe.
78 bool encode_next_frame_as_keyframe_; 81 bool encode_next_frame_as_keyframe_;
79 82
80 DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder); 83 DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder);
81 }; 84 };
82 85
83 } // namespace cast 86 } // namespace cast
84 } // namespace media 87 } // namespace media
85 88
86 #endif // MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ 89 #endif // MEDIA_CAST_SENDER_H264_VT_ENCODER_H_
OLDNEW
« 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