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_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // the IO thread. | 36 // the IO thread. |
37 class CONTENT_EXPORT VideoCaptureGpuJpegDecoder | 37 class CONTENT_EXPORT VideoCaptureGpuJpegDecoder |
38 : public media::VideoCaptureJpegDecoder, | 38 : public media::VideoCaptureJpegDecoder, |
39 public media::JpegDecodeAccelerator::Client, | 39 public media::JpegDecodeAccelerator::Client, |
40 public base::NonThreadSafe, | 40 public base::NonThreadSafe, |
41 public base::SupportsWeakPtr<VideoCaptureGpuJpegDecoder> { | 41 public base::SupportsWeakPtr<VideoCaptureGpuJpegDecoder> { |
42 public: | 42 public: |
43 // |decode_done_cb| is called on the IO thread when decode succeed. This can | 43 // |decode_done_cb| is called on the IO thread when decode succeed. This can |
44 // be on any thread. |decode_done_cb| is never called after | 44 // be on any thread. |decode_done_cb| is never called after |
45 // VideoCaptureGpuJpegDecoder is destroyed. | 45 // VideoCaptureGpuJpegDecoder is destroyed. |
46 explicit VideoCaptureGpuJpegDecoder(const DecodeDoneCB& decode_done_cb); | 46 VideoCaptureGpuJpegDecoder( |
| 47 DecodeDoneCB decode_done_cb, |
| 48 base::Callback<void(const std::string&)> send_log_message_cb); |
47 ~VideoCaptureGpuJpegDecoder() override; | 49 ~VideoCaptureGpuJpegDecoder() override; |
48 | 50 |
49 // Implementation of VideoCaptureJpegDecoder: | 51 // Implementation of VideoCaptureJpegDecoder: |
50 void Initialize() override; | 52 void Initialize() override; |
51 STATUS GetStatus() const override; | 53 STATUS GetStatus() const override; |
52 void DecodeCapturedData( | 54 void DecodeCapturedData( |
53 const uint8_t* data, | 55 const uint8_t* data, |
54 size_t in_buffer_size, | 56 size_t in_buffer_size, |
55 const media::VideoCaptureFormat& frame_format, | 57 const media::VideoCaptureFormat& frame_format, |
56 base::TimeTicks reference_time, | 58 base::TimeTicks reference_time, |
(...skipping 27 matching lines...) Expand all Loading... |
84 void RecordInitDecodeUMA_Locked(); | 86 void RecordInitDecodeUMA_Locked(); |
85 | 87 |
86 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; | 88 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host_; |
87 | 89 |
88 // The underlying JPEG decode accelerator. | 90 // The underlying JPEG decode accelerator. |
89 std::unique_ptr<media::JpegDecodeAccelerator> decoder_; | 91 std::unique_ptr<media::JpegDecodeAccelerator> decoder_; |
90 | 92 |
91 // The callback to run when decode succeeds. | 93 // The callback to run when decode succeeds. |
92 const DecodeDoneCB decode_done_cb_; | 94 const DecodeDoneCB decode_done_cb_; |
93 | 95 |
| 96 const base::Callback<void(const std::string&)> send_log_message_cb_; |
| 97 bool has_received_decoded_frame_; |
| 98 |
94 // Guards |decode_done_closure_| and |decoder_status_|. | 99 // Guards |decode_done_closure_| and |decoder_status_|. |
95 mutable base::Lock lock_; | 100 mutable base::Lock lock_; |
96 | 101 |
97 // The closure of |decode_done_cb_| with bound parameters. | 102 // The closure of |decode_done_cb_| with bound parameters. |
98 base::Closure decode_done_closure_; | 103 base::Closure decode_done_closure_; |
99 | 104 |
100 // Next id for input BitstreamBuffer. | 105 // Next id for input BitstreamBuffer. |
101 int32_t next_bitstream_buffer_id_; | 106 int32_t next_bitstream_buffer_id_; |
102 | 107 |
103 // The id for current input BitstreamBuffer being decoded. | 108 // The id for current input BitstreamBuffer being decoded. |
104 int32_t in_buffer_id_; | 109 int32_t in_buffer_id_; |
105 | 110 |
106 // Shared memory to store JPEG stream buffer. The input BitstreamBuffer is | 111 // Shared memory to store JPEG stream buffer. The input BitstreamBuffer is |
107 // backed by this. | 112 // backed by this. |
108 std::unique_ptr<base::SharedMemory> in_shared_memory_; | 113 std::unique_ptr<base::SharedMemory> in_shared_memory_; |
109 | 114 |
110 STATUS decoder_status_; | 115 STATUS decoder_status_; |
111 | 116 |
112 DISALLOW_COPY_AND_ASSIGN(VideoCaptureGpuJpegDecoder); | 117 DISALLOW_COPY_AND_ASSIGN(VideoCaptureGpuJpegDecoder); |
113 }; | 118 }; |
114 | 119 |
115 } // namespace content | 120 } // namespace content |
116 | 121 |
117 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ | 122 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_GPU_JPEG_DECODER_H_ |
OLD | NEW |