Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_RECORDER_H264_ENCODER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_RECORDER_H264_ENCODER_H_ | |
| 7 | |
| 8 #include "content/public/common/features.h" | |
| 9 | |
| 10 #if BUILDFLAG(RTC_USE_H264) | |
|
mcasas
2017/04/05 01:23:59
Following my comment in BUILD.gn, you can do here
emircan
2017/04/05 21:13:43
Done.
| |
| 11 | |
| 12 #include "base/time/time.h" | |
| 13 #include "content/renderer/media_recorder/video_track_recorder.h" | |
| 14 #include "third_party/openh264/src/codec/api/svc/codec_api.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 // Class encapsulating all openh264 interactions for H264 encoding. | |
| 19 class H264Encoder final : public VideoTrackRecorder::Encoder { | |
| 20 public: | |
| 21 struct ISVCEncoderDeleter { | |
| 22 void operator()(ISVCEncoder* codec); | |
| 23 }; | |
| 24 typedef std::unique_ptr<ISVCEncoder, ISVCEncoderDeleter> ScopedISVCEncoderPtr; | |
| 25 | |
| 26 static void ShutdownEncoder(std::unique_ptr<base::Thread> encoding_thread, | |
| 27 ScopedISVCEncoderPtr encoder); | |
| 28 | |
| 29 H264Encoder( | |
| 30 const VideoTrackRecorder::OnEncodedVideoCB& on_encoded_video_callback, | |
| 31 int32_t bits_per_second); | |
| 32 | |
| 33 private: | |
| 34 // VideoTrackRecorder::Encoder implementation. | |
| 35 ~H264Encoder() override; | |
| 36 void EncodeOnEncodingTaskRunner(scoped_refptr<media::VideoFrame> frame, | |
| 37 base::TimeTicks capture_timestamp) override; | |
| 38 | |
| 39 void ConfigureEncoderOnEncodingTaskRunner(const gfx::Size& size); | |
| 40 | |
| 41 // |openh264_encoder_| is a special scoped pointer to guarantee proper | |
| 42 // destruction, also when reconfiguring due to parameters change. Only used on | |
| 43 // |encoding_thread_|. | |
|
mcasas
2017/04/05 01:23:59
|encoding_thread_| (here and in l.48) is not aroun
emircan
2017/04/05 21:13:44
Done.
| |
| 44 gfx::Size configured_size_; | |
| 45 ScopedISVCEncoderPtr openh264_encoder_; | |
| 46 | |
| 47 // The |VideoFrame::timestamp()| of the first received frame. Only used on | |
| 48 // |encoding_thread_|. | |
| 49 base::TimeTicks first_frame_timestamp_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(H264Encoder); | |
| 52 }; | |
| 53 | |
| 54 } // namespace content | |
| 55 | |
| 56 #endif // #if BUILDFLAG(RTC_USE_H264) | |
| 57 | |
| 58 #endif // CONTENT_RENDERER_MEDIA_RECORDER_H264_ENCODER_H_ | |
| OLD | NEW |