Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: content/renderer/media_recorder/video_track_recorder.h

Issue 2804843002: Handle HW encoder errors in VideoTrackRecorder (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 LAST 47 LAST
48 }; 48 };
49 class Encoder; 49 class Encoder;
50 50
51 using OnEncodedVideoCB = 51 using OnEncodedVideoCB =
52 base::Callback<void(const media::WebmMuxer::VideoParameters& params, 52 base::Callback<void(const media::WebmMuxer::VideoParameters& params,
53 std::unique_ptr<std::string> encoded_data, 53 std::unique_ptr<std::string> encoded_data,
54 std::unique_ptr<std::string> encoded_alpha, 54 std::unique_ptr<std::string> encoded_alpha,
55 base::TimeTicks capture_timestamp, 55 base::TimeTicks capture_timestamp,
56 bool is_key_frame)>; 56 bool is_key_frame)>;
57 using OnErrorCB = base::Callback<void(bool allow_vea_encoder)>;
mcasas 2017/04/05 21:44:33 Actually we don't need the parameter |allow_vea_en
emircan 2017/04/05 21:52:55 Done. Initially, I worked on a generic OnError() m
57 58
58 static CodecId GetPreferredCodecId(); 59 static CodecId GetPreferredCodecId();
59 60
60 VideoTrackRecorder(CodecId codec, 61 VideoTrackRecorder(CodecId codec,
61 const blink::WebMediaStreamTrack& track, 62 const blink::WebMediaStreamTrack& track,
62 const OnEncodedVideoCB& on_encoded_video_cb, 63 const OnEncodedVideoCB& on_encoded_video_cb,
63 int32_t bits_per_second); 64 int32_t bits_per_second);
64 ~VideoTrackRecorder() override; 65 ~VideoTrackRecorder() override;
65 66
66 void Pause(); 67 void Pause();
67 void Resume(); 68 void Resume();
68 69
69 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 70 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
70 base::TimeTicks capture_time); 71 base::TimeTicks capture_time);
71 private: 72 private:
72 friend class VideoTrackRecorderTest; 73 friend class VideoTrackRecorderTest;
73 74
74 void InitializeEncoder(CodecId codec, 75 void InitializeEncoder(CodecId codec,
75 const OnEncodedVideoCB& on_encoded_video_callback, 76 const OnEncodedVideoCB& on_encoded_video_callback,
76 int32_t bits_per_second, 77 int32_t bits_per_second,
78 bool allow_vea_encoder,
77 const scoped_refptr<media::VideoFrame>& frame, 79 const scoped_refptr<media::VideoFrame>& frame,
78 base::TimeTicks capture_time); 80 base::TimeTicks capture_time);
81 void OnError(bool allow_vea_encoder);
79 82
80 // TODO(emircan): Remove after refactor, see http://crbug.com/700433. 83 // TODO(emircan): Remove after refactor, see http://crbug.com/700433.
81 bool CanEncodeAlphaChannelForTesting(); 84 bool CanEncodeAlphaChannelForTesting();
82 85
83 // Used to check that we are destroyed on the same thread we were created. 86 // Used to check that we are destroyed on the same thread we were created.
84 base::ThreadChecker main_render_thread_checker_; 87 base::ThreadChecker main_render_thread_checker_;
85 88
86 // We need to hold on to the Blink track to remove ourselves on dtor. 89 // We need to hold on to the Blink track to remove ourselves on dtor.
87 blink::WebMediaStreamTrack track_; 90 blink::WebMediaStreamTrack track_;
88 91
89 // Inner class to encode using whichever codec is configured. 92 // Inner class to encode using whichever codec is configured.
90 scoped_refptr<Encoder> encoder_; 93 scoped_refptr<Encoder> encoder_;
91 94
92 base::Callback<void(const scoped_refptr<media::VideoFrame>& frame, 95 base::Callback<void(bool allow_vea_encoder,
96 const scoped_refptr<media::VideoFrame>& frame,
93 base::TimeTicks capture_time)> 97 base::TimeTicks capture_time)>
94 initialize_encoder_callback_; 98 initialize_encoder_callback_;
95 99
96 // Used to track the paused state during the initialization process. 100 // Used to track the paused state during the initialization process.
97 bool paused_before_init_; 101 bool paused_before_init_;
98 102
99 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; 103 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
100 104
101 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 105 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
102 }; 106 };
103 107
104 } // namespace content 108 } // namespace content
105 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 109 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698