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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "content/public/common/features.h" | 15 #include "content/public/common/features.h" |
| 16 #include "content/public/renderer/media_stream_video_sink.h" | 16 #include "content/public/renderer/media_stream_video_sink.h" |
| 17 #include "media/muxers/webm_muxer.h" | 17 #include "media/muxers/webm_muxer.h" |
| 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 class VideoFrame; | 21 class VideoFrame; |
| 22 } // namespace media | 22 } // namespace media |
| 23 | 23 |
| 24 namespace video_track_recorder { | 24 namespace video_track_recorder { |
| 25 const int kVEAEncoderMinResolutionWidth = 640; | 25 const int kVEAEncoderMinResolutionWidth = 640; |
| 26 const int kVEAEncoderMinResolutionHeight = 480; | 26 const int kVEAEncoderMinResolutionHeight = 480; |
| 27 const int kVEAEncoderMinResolutionWidthAndroid = 96; | |
|
emircan
2017/04/07 17:33:04
Can you put these macros in "#if defined(OS_ANDROI
braveyao
2017/04/08 00:56:26
Done.
| |
| 28 const int kVEAEncoderMinResolutionHeightAndroid = 64; | |
| 27 } // namespace video_track_recorder | 29 } // namespace video_track_recorder |
| 28 | 30 |
| 29 namespace content { | 31 namespace content { |
| 30 | 32 |
| 31 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames | 33 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames |
| 32 // received from a Stream Video Track. This class is constructed and used on a | 34 // received from a Stream Video Track. This class is constructed and used on a |
| 33 // single thread, namely the main Render thread. This mirrors the other | 35 // single thread, namely the main Render thread. This mirrors the other |
| 34 // MediaStreamVideo* classes that are constructed/configured on Main Render | 36 // MediaStreamVideo* classes that are constructed/configured on Main Render |
| 35 // thread but that pass frames on Render IO thread. It has an internal Encoder | 37 // thread but that pass frames on Render IO thread. It has an internal Encoder |
| 36 // with its own threading subtleties, see the implementation file. | 38 // with its own threading subtleties, see the implementation file. |
| 37 class CONTENT_EXPORT VideoTrackRecorder | 39 class CONTENT_EXPORT VideoTrackRecorder |
| 38 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { | 40 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { |
| 39 public: | 41 public: |
| 40 // Do not change the order of codecs; add new ones right before LAST. | 42 // Do not change the order of codecs; add new ones right before LAST. |
| 41 enum class CodecId { | 43 enum class CodecId { |
| 42 VP8, | 44 VP8, |
| 43 VP9, | 45 VP9, |
| 44 #if BUILDFLAG(RTC_USE_H264) | 46 #if BUILDFLAG(RTC_USE_H264) || defined(OS_ANDROID) |
| 45 H264, | 47 H264, |
| 46 #endif | 48 #endif |
| 47 LAST | 49 LAST |
| 48 }; | 50 }; |
| 49 class Encoder; | 51 class Encoder; |
| 50 | 52 |
| 51 using OnEncodedVideoCB = | 53 using OnEncodedVideoCB = |
| 52 base::Callback<void(const media::WebmMuxer::VideoParameters& params, | 54 base::Callback<void(const media::WebmMuxer::VideoParameters& params, |
| 53 std::unique_ptr<std::string> encoded_data, | 55 std::unique_ptr<std::string> encoded_data, |
| 54 std::unique_ptr<std::string> encoded_alpha, | 56 std::unique_ptr<std::string> encoded_alpha, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 // Used to track the paused state during the initialization process. | 98 // Used to track the paused state during the initialization process. |
| 97 bool paused_before_init_; | 99 bool paused_before_init_; |
| 98 | 100 |
| 99 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; | 101 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; |
| 100 | 102 |
| 101 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); | 103 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 } // namespace content | 106 } // namespace content |
| 105 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ | 107 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ |
| OLD | NEW |