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_VIDEO_TRACK_RECORDER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 6 #define CONTENT_RENDERER_MEDIA_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" | |
| 13 #include "base/single_thread_task_runner.h" | |
| 12 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 13 #include "content/public/common/features.h" | 15 #include "content/public/common/features.h" |
| 14 #include "content/public/renderer/media_stream_video_sink.h" | 16 #include "content/public/renderer/media_stream_video_sink.h" |
| 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 16 | 18 |
| 17 namespace media { | 19 namespace media { |
| 18 class VideoFrame; | 20 class VideoFrame; |
| 19 } // namespace media | 21 } // namespace media |
| 20 | 22 |
| 21 namespace content { | 23 namespace content { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 49 ~VideoTrackRecorder() override; | 51 ~VideoTrackRecorder() override; |
| 50 | 52 |
| 51 void Pause(); | 53 void Pause(); |
| 52 void Resume(); | 54 void Resume(); |
| 53 | 55 |
| 54 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, | 56 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, |
| 55 base::TimeTicks capture_time); | 57 base::TimeTicks capture_time); |
| 56 private: | 58 private: |
| 57 friend class VideoTrackRecorderTest; | 59 friend class VideoTrackRecorderTest; |
| 58 | 60 |
| 61 void InitializeEncoder(const scoped_refptr<media::VideoFrame>& frame, | |
| 62 base::TimeTicks capture_time); | |
| 63 | |
| 59 // Used to check that we are destroyed on the same thread we were created. | 64 // Used to check that we are destroyed on the same thread we were created. |
| 60 base::ThreadChecker main_render_thread_checker_; | 65 base::ThreadChecker main_render_thread_checker_; |
| 61 | 66 |
| 62 // We need to hold on to the Blink track to remove ourselves on dtor. | 67 // We need to hold on to the Blink track to remove ourselves on dtor. |
| 63 blink::WebMediaStreamTrack track_; | 68 blink::WebMediaStreamTrack track_; |
| 64 | 69 |
| 65 // Inner class to encode using whichever codec is configured. | 70 // Inner class to encode using whichever codec is configured. |
| 66 scoped_refptr<Encoder> encoder_; | 71 scoped_refptr<Encoder> encoder_; |
| 67 | 72 |
| 73 // Parameters that would be passed to the underlying |encoder_|. | |
| 74 const CodecId codec_; | |
| 75 const OnEncodedVideoCB on_encoded_video_callback_; | |
| 76 const int32_t bits_per_second_; | |
|
mcasas
2016/07/08 22:59:27
Don't extend this class' inner state (i.e. # membe
emircan
2016/07/12 01:00:35
Done. However, I still need to hold onto this info
| |
| 77 | |
| 78 // Used to track the paused state during the initialization process. | |
| 79 bool paused_before_init_; | |
| 80 | |
| 81 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; | |
|
mcasas
2016/07/08 22:59:27
This is not used in favour of base::Unretained(thi
emircan
2016/07/12 01:00:35
Done.
| |
| 82 | |
| 68 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); | 83 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); |
| 69 }; | 84 }; |
| 70 | 85 |
| 71 } // namespace content | 86 } // namespace content |
| 72 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ | 87 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ |
| OLD | NEW |