Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 | |
|
Pawel Osciak
2015/03/19 01:26:33
Namespace formatting rule examples at http://googl
mcasas
2015/03/19 02:54:25
Usually these namespace+forward declarations don't
| |
| 22 class MessageLoopProxy; | 21 class MessageLoopProxy; |
| 23 | |
| 24 } // namespace base | 22 } // namespace base |
| 25 | 23 |
| 26 namespace media { | 24 namespace media { |
| 27 | |
| 28 class GpuVideoAcceleratorFactories; | 25 class GpuVideoAcceleratorFactories; |
| 29 | |
| 30 } // namespace media | 26 } // namespace media |
| 31 | 27 |
| 32 namespace content { | 28 namespace content { |
| 33 | 29 |
| 34 // RTCVideoEncoder uses a media::VideoEncodeAccelerator to implement a | 30 // RTCVideoEncoder uses a media::VideoEncodeAccelerator to implement a |
| 35 // webrtc::VideoEncoder class for WebRTC. Internally, VEA methods are | 31 // webrtc::VideoEncoder class for WebRTC. Internally, VEA methods are |
| 36 // trampolined to a private RTCVideoEncoder::Impl instance. The Impl class runs | 32 // trampolined to a private RTCVideoEncoder::Impl instance. The Impl class runs |
| 37 // on the worker thread queried from the |gpu_factories_|, which is presently | 33 // on the worker thread queried from the |gpu_factories_|, which is presently |
| 38 // the media thread. RTCVideoEncoder is sychronized by webrtc::VideoSender. | 34 // the media thread. RTCVideoEncoder is sychronized by webrtc::VideoSender. |
| 39 // webrtc::VideoEncoder methods do not run concurrently. RTCVideoEncoder is run | 35 // webrtc::VideoEncoder methods do not run concurrently. RTCVideoEncoder is run |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 74 |
| 79 void RecordInitEncodeUMA(int32_t init_retval, | 75 void RecordInitEncodeUMA(int32_t init_retval, |
| 80 media::VideoCodecProfile profile); | 76 media::VideoCodecProfile profile); |
| 81 | 77 |
| 82 base::ThreadChecker thread_checker_; | 78 base::ThreadChecker thread_checker_; |
| 83 | 79 |
| 84 // The video codec type, as reported to WebRTC. | 80 // The video codec type, as reported to WebRTC. |
| 85 const webrtc::VideoCodecType video_codec_type_; | 81 const webrtc::VideoCodecType video_codec_type_; |
| 86 | 82 |
| 87 // Factory for creating VEAs, shared memory buffers, etc. | 83 // Factory for creating VEAs, shared memory buffers, etc. |
| 88 scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories_; | 84 const scoped_refptr<media::GpuVideoAcceleratorFactories> gpu_factories_; |
| 89 | 85 |
| 90 // webrtc::VideoEncoder encode complete callback. | 86 // webrtc::VideoEncoder encode complete callback. |
| 91 webrtc::EncodedImageCallback* encoded_image_callback_; | 87 webrtc::EncodedImageCallback* encoded_image_callback_; |
| 92 | 88 |
| 93 // The RTCVideoEncoder::Impl that does all the work. | 89 // The RTCVideoEncoder::Impl that does all the work. |
| 94 scoped_refptr<Impl> impl_; | 90 scoped_refptr<Impl> impl_; |
| 95 | 91 |
| 96 // We cannot immediately return error conditions to the WebRTC user of this | 92 // We cannot immediately return error conditions to the WebRTC user of this |
| 97 // class, as there is no error callback in the webrtc::VideoEncoder interface. | 93 // class, as there is no error callback in the webrtc::VideoEncoder interface. |
| 98 // Instead, we cache an error status here and return it the next time an | 94 // Instead, we cache an error status here and return it the next time an |
| 99 // interface entry point is called. | 95 // interface entry point is called. |
| 100 int32_t impl_status_; | 96 int32_t impl_status_; |
| 101 | 97 |
| 102 // Weak pointer factory for posting back VEA::Client notifications to | 98 // Weak pointer factory for posting back VEA::Client notifications to |
| 103 // RTCVideoEncoder. | 99 // RTCVideoEncoder. |
| 104 // NOTE: Weak pointers must be invalidated before all other member variables. | 100 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 105 base::WeakPtrFactory<RTCVideoEncoder> weak_factory_; | 101 base::WeakPtrFactory<RTCVideoEncoder> weak_factory_; |
| 106 | 102 |
| 107 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); | 103 DISALLOW_COPY_AND_ASSIGN(RTCVideoEncoder); |
| 108 }; | 104 }; |
| 109 | 105 |
| 110 } // namespace content | 106 } // namespace content |
| 111 | 107 |
| 112 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ | 108 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_ENCODER_H_ |
| OLD | NEW |