Chromium Code Reviews| Index: media/video/jpeg_decode_accelerator.h |
| diff --git a/media/video/jpeg_decode_accelerator.h b/media/video/jpeg_decode_accelerator.h |
| index 83c59403134c3b32da3eab711d30415abd70449f..b56756f4e0b0973323ebbae2c66104bad72c47cd 100644 |
| --- a/media/video/jpeg_decode_accelerator.h |
| +++ b/media/video/jpeg_decode_accelerator.h |
| @@ -17,7 +17,7 @@ namespace media { |
| // The output color format is I420. The decoder will convert the color format |
| // to I420 if the color space or subsampling does not match that and if it is |
| // capable of doing so. The client is responsible for allocating buffers and |
| -// keeps the ownership of them. All methods must be called on the same thread. |
| +// keeps the ownership of them. |
|
Pawel Osciak
2015/05/28 09:13:18
Don't all methods must still be called on the same
kcwu
2015/05/28 12:10:28
Not always. For GpuJpegDecodeAccelerator, it call
|
| // The intended use case of this interface is decoding MJPEG images coming |
| // from camera capture. It can also be used for normal still JPEG image |
| // decoding, but normal JPEG images may use more JPEG features that may not be |
| @@ -28,6 +28,8 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
| // Enumeration of decode errors generated by NotifyError callback. |
| enum Error { |
| + // No error. Decode succeeded. |
| + NO_ERROR, |
|
Pawel Osciak
2015/05/28 09:13:18
Can we NotifyError with NO_ERROR? NotifyError is a
kcwu
2015/05/28 12:10:28
Do you have any suggestions? Is saying NotifyError
|
| // Invalid argument was passed to an API method, e.g. the output buffer is |
| // too small, JPEG width/height are too big for JDA. |
| INVALID_ARGUMENT, |
| @@ -71,6 +73,12 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
| virtual ~Client() {} |
| }; |
| + // Destroys the decoder: all pending inputs are dropped immediately. This |
| + // call may asynchronously free system resources, but its client-visible |
| + // effects are synchronous. After destructor returns, no more callbacks |
| + // will be made on the client. |
| + virtual ~JpegDecodeAccelerator() = 0; |
| + |
| // JPEG decoder functions. |
| // Initializes the JPEG decoder. Should be called once per decoder |
| @@ -78,7 +86,7 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
| // is successful. |
| // Parameters: |
| // |client| is the Client interface for decode callback. The provided |
| - // pointer must be valid until Destroy() is called. |
| + // pointer must be valid until destructor is called. |
| virtual bool Initialize(Client* client) = 0; |
| // Decodes the given bitstream buffer that contains one JPEG picture. It |
| @@ -100,35 +108,8 @@ class MEDIA_EXPORT JpegDecodeAccelerator { |
| // |bitstream_buffer|, or Destroy() returns. |
| virtual void Decode(const BitstreamBuffer& bitstream_buffer, |
| const scoped_refptr<media::VideoFrame>& video_frame) = 0; |
| - |
| - // Destroys the decoder: all pending inputs are dropped immediately. This |
| - // call may asynchronously free system resources, but its client-visible |
| - // effects are synchronous. After this method returns, no more callbacks |
| - // will be made on the client. Deletes |this| unconditionally, so make sure |
| - // to drop all pointers to it! |
| - virtual void Destroy() = 0; |
| - |
| - protected: |
| - // Do not delete directly; use Destroy() or own it with a scoped_ptr, which |
| - // will Destroy() it properly by default. |
| - virtual ~JpegDecodeAccelerator(); |
| }; |
| } // namespace media |
| -namespace base { |
| - |
| -template <class T> |
| -struct DefaultDeleter; |
| - |
| -// Specialize DefaultDeleter so that scoped_ptr<JpegDecodeAccelerator> always |
| -// uses "Destroy()" instead of trying to use the destructor. |
| -template <> |
| -struct MEDIA_EXPORT DefaultDeleter<media::JpegDecodeAccelerator> { |
| - public: |
| - void operator()(void* jpeg_decode_accelerator) const; |
| -}; |
| - |
| -} // namespace base |
| - |
| #endif // MEDIA_VIDEO_JPEG_DECODE_ACCELERATOR_H_ |