Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_RECORDER_VIDEO_TRACK_RECORDER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 namespace cc { | 25 namespace cc { |
| 26 class PaintCanvas; | 26 class PaintCanvas; |
| 27 } // namespace cc | 27 } // namespace cc |
| 28 | 28 |
| 29 namespace media { | 29 namespace media { |
| 30 class SkCanvasVideoRenderer; | 30 class SkCanvasVideoRenderer; |
| 31 class VideoFrame; | 31 class VideoFrame; |
| 32 } // namespace media | 32 } // namespace media |
| 33 | 33 |
| 34 namespace video_track_recorder { | 34 namespace video_track_recorder { |
| 35 #if !defined(OS_ANDROID) | |
|
mcasas
2017/04/17 20:10:39
Don't use negative conditionals:
#if defined(OS_A
braveyao
2017/04/18 16:15:38
Done.
| |
| 35 const int kVEAEncoderMinResolutionWidth = 640; | 36 const int kVEAEncoderMinResolutionWidth = 640; |
| 36 const int kVEAEncoderMinResolutionHeight = 480; | 37 const int kVEAEncoderMinResolutionHeight = 480; |
| 38 #else | |
| 39 // The minimum resolution supported by HW H264 on Android varies on each | |
| 40 // platform and OS version. | |
| 41 // Take Nexus 5 as an example, it's: | |
| 42 // 176x144 on KitKat; 160x120 on Lollipop; 96x64 on Marshmallow and above. | |
| 43 // Set 176x144 for now and revise it as the target API level changes. | |
|
mcasas
2017/04/17 20:10:39
If there's an action for the future, we need a bug
braveyao
2017/04/18 16:15:38
Done.
Keeping minimum resolution to QCIF: 176x144
| |
| 44 const int kVEAEncoderMinResolutionWidth = 172; | |
| 45 const int kVEAEncoderMinResolutionHeight = 144; | |
| 46 #endif | |
| 37 } // namespace video_track_recorder | 47 } // namespace video_track_recorder |
| 38 | 48 |
| 39 namespace content { | 49 namespace content { |
| 40 | 50 |
| 41 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames | 51 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames |
| 42 // received from a Stream Video Track. This class is constructed and used on a | 52 // received from a Stream Video Track. This class is constructed and used on a |
| 43 // single thread, namely the main Render thread. This mirrors the other | 53 // single thread, namely the main Render thread. This mirrors the other |
| 44 // MediaStreamVideo* classes that are constructed/configured on Main Render | 54 // MediaStreamVideo* classes that are constructed/configured on Main Render |
| 45 // thread but that pass frames on Render IO thread. It has an internal Encoder | 55 // thread but that pass frames on Render IO thread. It has an internal Encoder |
| 46 // with its own threading subtleties, see the implementation file. | 56 // with its own threading subtleties, see the implementation file. |
| 47 class CONTENT_EXPORT VideoTrackRecorder | 57 class CONTENT_EXPORT VideoTrackRecorder |
| 48 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { | 58 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { |
| 49 public: | 59 public: |
| 50 // Do not change the order of codecs; add new ones right before LAST. | 60 // Do not change the order of codecs; add new ones right before LAST. |
| 51 enum class CodecId { | 61 enum class CodecId { |
| 52 VP8, | 62 VP8, |
| 53 VP9, | 63 VP9, |
| 54 #if BUILDFLAG(RTC_USE_H264) | 64 #if BUILDFLAG(RTC_USE_H264) || defined(OS_ANDROID) |
| 55 H264, | 65 H264, |
| 56 #endif | 66 #endif |
| 57 LAST | 67 LAST |
| 58 }; | 68 }; |
| 59 | 69 |
| 60 using OnEncodedVideoCB = | 70 using OnEncodedVideoCB = |
| 61 base::Callback<void(const media::WebmMuxer::VideoParameters& params, | 71 base::Callback<void(const media::WebmMuxer::VideoParameters& params, |
| 62 std::unique_ptr<std::string> encoded_data, | 72 std::unique_ptr<std::string> encoded_data, |
| 63 std::unique_ptr<std::string> encoded_alpha, | 73 std::unique_ptr<std::string> encoded_alpha, |
| 64 base::TimeTicks capture_timestamp, | 74 base::TimeTicks capture_timestamp, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 // Used to track the paused state during the initialization process. | 199 // Used to track the paused state during the initialization process. |
| 190 bool paused_before_init_; | 200 bool paused_before_init_; |
| 191 | 201 |
| 192 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; | 202 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; |
| 193 | 203 |
| 194 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); | 204 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); |
| 195 }; | 205 }; |
| 196 | 206 |
| 197 } // namespace content | 207 } // namespace content |
| 198 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ | 208 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ |
| OLD | NEW |