OLD | NEW |
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_VIDEO_ENCODER_IMPL_H_ | 5 #ifndef MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_ |
6 #define MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_ | 6 #define MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "media/cast/cast_config.h" | 9 #include "media/cast/cast_config.h" |
10 #include "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 struct CodecDynamicConfig { | 23 struct CodecDynamicConfig { |
24 bool key_frame_requested; | 24 bool key_frame_requested; |
25 uint32 latest_frame_id_to_reference; | 25 uint32 latest_frame_id_to_reference; |
26 int bit_rate; | 26 int bit_rate; |
27 }; | 27 }; |
28 | 28 |
29 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> | 29 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> |
30 FrameEncodedCallback; | 30 FrameEncodedCallback; |
31 | 31 |
32 VideoEncoderImpl(scoped_refptr<CastEnvironment> cast_environment, | 32 VideoEncoderImpl(scoped_refptr<CastEnvironment> cast_environment, |
33 const VideoSenderConfig& video_config, | 33 const VideoSenderConfig& video_config); |
34 int max_unacked_frames); | |
35 | 34 |
36 virtual ~VideoEncoderImpl(); | 35 virtual ~VideoEncoderImpl(); |
37 | 36 |
38 // VideoEncoder implementation. | 37 // VideoEncoder implementation. |
39 virtual bool EncodeVideoFrame( | 38 virtual bool EncodeVideoFrame( |
40 const scoped_refptr<media::VideoFrame>& video_frame, | 39 const scoped_refptr<media::VideoFrame>& video_frame, |
41 const base::TimeTicks& reference_time, | 40 const base::TimeTicks& reference_time, |
42 const FrameEncodedCallback& frame_encoded_callback) override; | 41 const FrameEncodedCallback& frame_encoded_callback) override; |
43 virtual void SetBitRate(int new_bit_rate) override; | 42 virtual void SetBitRate(int new_bit_rate) override; |
44 virtual void GenerateKeyFrame() override; | 43 virtual void GenerateKeyFrame() override; |
45 virtual void LatestFrameIdToReference(uint32 frame_id) override; | 44 virtual void LatestFrameIdToReference(uint32 frame_id) override; |
46 | 45 |
47 private: | 46 private: |
48 scoped_refptr<CastEnvironment> cast_environment_; | 47 scoped_refptr<CastEnvironment> cast_environment_; |
49 CodecDynamicConfig dynamic_config_; | 48 CodecDynamicConfig dynamic_config_; |
50 | 49 |
51 // This member belongs to the video encoder thread. It must not be | 50 // This member belongs to the video encoder thread. It must not be |
52 // dereferenced on the main thread. We manage the lifetime of this member | 51 // dereferenced on the main thread. We manage the lifetime of this member |
53 // manually because it needs to be initialize, used and destroyed on the | 52 // manually because it needs to be initialize, used and destroyed on the |
54 // video encoder thread and video encoder thread can out-live the main thread. | 53 // video encoder thread and video encoder thread can out-live the main thread. |
55 scoped_ptr<SoftwareVideoEncoder> encoder_; | 54 scoped_ptr<SoftwareVideoEncoder> encoder_; |
56 | 55 |
57 DISALLOW_COPY_AND_ASSIGN(VideoEncoderImpl); | 56 DISALLOW_COPY_AND_ASSIGN(VideoEncoderImpl); |
58 }; | 57 }; |
59 | 58 |
60 } // namespace cast | 59 } // namespace cast |
61 } // namespace media | 60 } // namespace media |
62 | 61 |
63 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_ | 62 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_IMPL_H_ |
OLD | NEW |