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

Side by Side Diff: media/cast/video_sender/codecs/vp8/vp8_encoder.h

Issue 132283006: Revert of Cast: Fix threading issues in VideoEncoderImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/video_sender/codecs/vp8/vp8_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_ 5 #ifndef MEDIA_CAST_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_
6 #define MEDIA_CAST_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_ 6 #define MEDIA_CAST_VIDEO_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"
11 #include "media/cast/cast_config.h" 10 #include "media/cast/cast_config.h"
12 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" 11 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h"
13 12
14 namespace media { 13 namespace media {
15 class VideoFrame; 14 class VideoFrame;
16 } 15 }
17 16
18 // VPX forward declaration. 17 // VPX forward declaration.
19 typedef struct vpx_codec_ctx vpx_enc_ctx_t; 18 typedef struct vpx_codec_ctx vpx_enc_ctx_t;
20 19
21 namespace media { 20 namespace media {
22 namespace cast { 21 namespace cast {
23 22
24 const int kNumberOfVp8VideoBuffers = 3; 23 const int kNumberOfVp8VideoBuffers = 3;
25 24
26 class Vp8Encoder { 25 class Vp8Encoder {
27 public: 26 public:
28 Vp8Encoder(const VideoSenderConfig& video_config, 27 Vp8Encoder(const VideoSenderConfig& video_config,
29 uint8 max_unacked_frames); 28 uint8 max_unacked_frames);
30 29
31 ~Vp8Encoder(); 30 ~Vp8Encoder();
32 31
33 // Initialize the encoder before Encode() can be called. This method
34 // must be called on the thread that Encode() is called.
35 void Initialize();
36
37 // Encode a raw image (as a part of a video stream). 32 // Encode a raw image (as a part of a video stream).
38 bool Encode(const scoped_refptr<media::VideoFrame>& video_frame, 33 bool Encode(const scoped_refptr<media::VideoFrame>& video_frame,
39 transport::EncodedVideoFrame* encoded_image); 34 transport::EncodedVideoFrame* encoded_image);
40 35
41 // Update the encoder with a new target bit rate. 36 // Update the encoder with a new target bit rate.
42 void UpdateRates(uint32 new_bitrate); 37 void UpdateRates(uint32 new_bitrate);
43 38
44 // Set the next frame to be a key frame. 39 // Set the next frame to be a key frame.
45 void GenerateKeyFrame(); 40 void GenerateKeyFrame();
46 41
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 scoped_ptr<vpx_enc_ctx_t> encoder_; 76 scoped_ptr<vpx_enc_ctx_t> encoder_;
82 vpx_image_t* raw_image_; 77 vpx_image_t* raw_image_;
83 78
84 bool key_frame_requested_; 79 bool key_frame_requested_;
85 int64 timestamp_; 80 int64 timestamp_;
86 uint32 last_encoded_frame_id_; 81 uint32 last_encoded_frame_id_;
87 uint32 used_buffers_frame_id_[kNumberOfVp8VideoBuffers]; 82 uint32 used_buffers_frame_id_[kNumberOfVp8VideoBuffers];
88 bool acked_frame_buffers_[kNumberOfVp8VideoBuffers]; 83 bool acked_frame_buffers_[kNumberOfVp8VideoBuffers];
89 Vp8Buffers last_used_vp8_buffer_; 84 Vp8Buffers last_used_vp8_buffer_;
90 int number_of_repeated_buffers_; 85 int number_of_repeated_buffers_;
91
92 // This is bound to the thread where Initialize() is called.
93 base::ThreadChecker thread_checker_;
94 }; 86 };
95 87
96 } // namespace cast 88 } // namespace cast
97 } // namespace media 89 } // namespace media
98 90
99 #endif // MEDIA_CAST_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_ 91 #endif // MEDIA_CAST_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_
OLDNEW
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/cast/video_sender/codecs/vp8/vp8_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698