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

Side by Side Diff: content/renderer/media/rtc_video_encoder.h

Issue 27420004: Remove threading from RendererGpuVideoAcceleratorFactories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dthread
Patch Set: 51676bf4 Initial. Created 7 years, 2 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
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 CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_
6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "media/base/video_decoder_config.h" 16 #include "media/base/video_decoder_config.h"
17 #include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_i nterface.h" 17 #include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_i nterface.h"
18 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
19 19
20 namespace base { 20 namespace base {
21 21
22 class MessageLoopProxy; 22 class MessageLoopProxy;
23 23
24 } // namespace base 24 } // namespace base
25 25
26 namespace media {
27
28 class GpuVideoAcceleratorFactories;
29
30 } // namespace media
31
26 namespace content { 32 namespace content {
27 33
28 class RendererGpuVideoAcceleratorFactories;
29
30 // RTCVideoEncoder uses a media::VideoEncodeAccelerator to implement a 34 // RTCVideoEncoder uses a media::VideoEncodeAccelerator to implement a
31 // webrtc::VideoEncoder class for WebRTC. Internally, VEA methods are 35 // webrtc::VideoEncoder class for WebRTC. Internally, VEA methods are
32 // trampolined to a private RTCVideoEncoder::Impl instance. The Impl class runs 36 // trampolined to a private RTCVideoEncoder::Impl instance. The Impl class runs
33 // on the worker thread queried from the |gpu_factories_|, which is presently 37 // on the worker thread queried from the |gpu_factories_|, which is presently
34 // the media thread. RTCVideoEncoder itself is run and destroyed on the thread 38 // the media thread. RTCVideoEncoder itself is run and destroyed on the thread
35 // it is constructed on, which is presently the libjingle worker thread. 39 // it is constructed on, which is presently the libjingle worker thread.
36 // Callbacks from the Impl due to its VEA::Client notifications are also posted 40 // Callbacks from the Impl due to its VEA::Client notifications are also posted
37 // back to RTCVideoEncoder on this thread. 41 // back to RTCVideoEncoder on this thread.
38 class CONTENT_EXPORT RTCVideoEncoder 42 class CONTENT_EXPORT RTCVideoEncoder
39 : NON_EXPORTED_BASE(public webrtc::VideoEncoder) { 43 : NON_EXPORTED_BASE(public webrtc::VideoEncoder) {
40 public: 44 public:
41 RTCVideoEncoder( 45 RTCVideoEncoder(
42 webrtc::VideoCodecType type, 46 webrtc::VideoCodecType type,
43 media::VideoCodecProfile profile, 47 media::VideoCodecProfile profile,
44 const scoped_refptr<RendererGpuVideoAcceleratorFactories>& gpu_factories); 48 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories);
45 virtual ~RTCVideoEncoder(); 49 virtual ~RTCVideoEncoder();
46 50
47 // webrtc::VideoEncoder implementation. Tasks are posted to |impl_| using the 51 // webrtc::VideoEncoder implementation. Tasks are posted to |impl_| using the
48 // appropriate VEA methods. 52 // appropriate VEA methods.
49 virtual int32_t InitEncode(const webrtc::VideoCodec* codec_settings, 53 virtual int32_t InitEncode(const webrtc::VideoCodec* codec_settings,
50 int32_t number_of_cores, 54 int32_t number_of_cores,
51 uint32_t max_payload_size) OVERRIDE; 55 uint32_t max_payload_size) OVERRIDE;
52 virtual int32_t Encode( 56 virtual int32_t Encode(
53 const webrtc::I420VideoFrame& input_image, 57 const webrtc::I420VideoFrame& input_image,
54 const webrtc::CodecSpecificInfo* codec_specific_info, 58 const webrtc::CodecSpecificInfo* codec_specific_info,
(...skipping 16 matching lines...) Expand all
71 75
72 base::ThreadChecker thread_checker_; 76 base::ThreadChecker thread_checker_;
73 77
74 // The video codec type, as reported to WebRTC. 78 // The video codec type, as reported to WebRTC.
75 const webrtc::VideoCodecType video_codec_type_; 79 const webrtc::VideoCodecType video_codec_type_;
76 80
77 // The video codec profile, to configure the encoder to encode to. 81 // The video codec profile, to configure the encoder to encode to.
78 const media::VideoCodecProfile video_codec_profile_; 82 const media::VideoCodecProfile video_codec_profile_;
79 83
80 // Factory for creating VEAs, shared memory buffers, etc. 84 // Factory for creating VEAs, shared memory buffers, etc.
81 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories_; 85 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories_;
82 86
83 // Weak pointer factory for posting back VEA::Client notifications to 87 // Weak pointer factory for posting back VEA::Client notifications to
84 // RTCVideoEncoder. 88 // RTCVideoEncoder.
85 base::WeakPtrFactory<RTCVideoEncoder> weak_this_factory_; 89 base::WeakPtrFactory<RTCVideoEncoder> weak_this_factory_;
86 90
87 // webrtc::VideoEncoder encode complete callback. 91 // webrtc::VideoEncoder encode complete callback.
88 webrtc::EncodedImageCallback* encoded_image_callback_; 92 webrtc::EncodedImageCallback* encoded_image_callback_;
89 93
90 // The RTCVideoEncoder::Impl that does all the work. 94 // The RTCVideoEncoder::Impl that does all the work.
91 scoped_refptr<Impl> impl_; 95 scoped_refptr<Impl> impl_;
92 96
93 // We cannot immediately return error conditions to the WebRTC user of this 97 // We cannot immediately return error conditions to the WebRTC user of this
94 // class, as there is no error callback in the webrtc::VideoEncoder interface. 98 // class, as there is no error callback in the webrtc::VideoEncoder interface.
95 // Instead, we cache an error status here and return it the next time an 99 // Instead, we cache an error status here and return it the next time an
96 // interface entry point is called. 100 // interface entry point is called.
97 int32_t impl_status_; 101 int32_t impl_status_;
98 102
99 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); 103 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder);
100 }; 104 };
101 105
102 } // namespace content 106 } // namespace content
103 107
104 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ 108 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698