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_CODECS_VP8_VP8_ENCODER_H_ | 5 #ifndef MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ |
6 #define MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ | 6 #define MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "media/cast/cast_config.h" | 11 #include "media/cast/cast_config.h" |
12 #include "media/cast/sender/software_video_encoder.h" | 12 #include "media/cast/sender/software_video_encoder.h" |
13 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" | 13 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 class VideoFrame; | 16 class VideoFrame; |
17 } | 17 } |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 namespace cast { | 20 namespace cast { |
21 | 21 |
22 class Vp8Encoder : public SoftwareVideoEncoder { | 22 class Vp8Encoder : public SoftwareVideoEncoder { |
23 public: | 23 public: |
24 explicit Vp8Encoder(const VideoSenderConfig& video_config); | 24 explicit Vp8Encoder(const VideoSenderConfig& video_config); |
25 | 25 |
26 virtual ~Vp8Encoder(); | 26 ~Vp8Encoder() override; |
27 | 27 |
28 // SoftwareVideoEncoder implementations. | 28 // SoftwareVideoEncoder implementations. |
29 virtual void Initialize() override; | 29 void Initialize() override; |
30 virtual void Encode(const scoped_refptr<media::VideoFrame>& video_frame, | 30 void Encode(const scoped_refptr<media::VideoFrame>& video_frame, |
31 const base::TimeTicks& reference_time, | 31 const base::TimeTicks& reference_time, |
32 EncodedFrame* encoded_frame) override; | 32 EncodedFrame* encoded_frame) override; |
33 virtual void UpdateRates(uint32 new_bitrate) override; | 33 void UpdateRates(uint32 new_bitrate) override; |
34 virtual void GenerateKeyFrame() override; | 34 void GenerateKeyFrame() override; |
35 virtual void LatestFrameIdToReference(uint32 frame_id) override; | 35 void LatestFrameIdToReference(uint32 frame_id) override; |
36 | 36 |
37 private: | 37 private: |
38 enum { kNumberOfVp8VideoBuffers = 3 }; | 38 enum { kNumberOfVp8VideoBuffers = 3 }; |
39 | 39 |
40 enum Vp8Buffers { | 40 enum Vp8Buffers { |
41 kAltRefBuffer = 0, | 41 kAltRefBuffer = 0, |
42 kGoldenBuffer = 1, | 42 kGoldenBuffer = 1, |
43 kLastBuffer = 2, | 43 kLastBuffer = 2, |
44 kNoBuffer = 3 // Note: must be last. | 44 kNoBuffer = 3 // Note: must be last. |
45 }; | 45 }; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // This is bound to the thread where Initialize() is called. | 98 // This is bound to the thread where Initialize() is called. |
99 base::ThreadChecker thread_checker_; | 99 base::ThreadChecker thread_checker_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(Vp8Encoder); | 101 DISALLOW_COPY_AND_ASSIGN(Vp8Encoder); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace cast | 104 } // namespace cast |
105 } // namespace media | 105 } // namespace media |
106 | 106 |
107 #endif // MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ | 107 #endif // MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ |
OLD | NEW |