OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
6 #define MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/video_decoder.h" | 10 #include "media/base/video_decoder.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const DecodeCB& decode_cb) final; | 43 const DecodeCB& decode_cb) final; |
44 void Reset(const base::Closure& closure) final; | 44 void Reset(const base::Closure& closure) final; |
45 bool NeedsBitstreamConversion() const final; | 45 bool NeedsBitstreamConversion() const final; |
46 bool CanReadWithoutStalling() const final; | 46 bool CanReadWithoutStalling() const final; |
47 int GetMaxDecodeRequests() const final; | 47 int GetMaxDecodeRequests() const final; |
48 | 48 |
49 // mojom::VideoDecoderClient implementation. | 49 // mojom::VideoDecoderClient implementation. |
50 void OnVideoFrameDecoded(mojom::VideoFramePtr frame) final; | 50 void OnVideoFrameDecoded(mojom::VideoFramePtr frame) final; |
51 | 51 |
52 private: | 52 private: |
53 void OnInitializeDone(bool status); | 53 void OnInitializeDone(bool status, |
54 void OnDecodeDone(DecodeStatus status); | 54 bool needs_bitstream_conversion, |
| 55 int32_t max_decode_requests); |
| 56 void OnDecodeDone(uint64_t decode_id, DecodeStatus status); |
55 void OnResetDone(); | 57 void OnResetDone(); |
56 | 58 |
57 void BindRemoteDecoder(); | 59 void BindRemoteDecoder(); |
58 void OnConnectionError(); | 60 |
| 61 // Cleans up callbacks and blocks future calls. |
| 62 void Stop(); |
59 | 63 |
60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
61 GpuVideoAcceleratorFactories* gpu_factories_; | 65 GpuVideoAcceleratorFactories* gpu_factories_; |
62 | 66 |
63 // Used to pass the remote decoder from the constructor (on the main thread) | 67 // Used to pass the remote decoder from the constructor (on the main thread) |
64 // to Initialize() (on the media thread). | 68 // to Initialize() (on the media thread). |
65 mojom::VideoDecoderPtrInfo remote_decoder_info_; | 69 mojom::VideoDecoderPtrInfo remote_decoder_info_; |
66 | 70 |
67 InitCB init_cb_; | 71 InitCB init_cb_; |
68 OutputCB output_cb_; | 72 OutputCB output_cb_; |
69 DecodeCB decode_cb_; | 73 uint64_t decode_counter_ = 0; |
| 74 std::map<uint64_t, DecodeCB> pending_decodes_; |
70 base::Closure reset_cb_; | 75 base::Closure reset_cb_; |
71 | 76 |
72 mojom::VideoDecoderPtr remote_decoder_; | 77 mojom::VideoDecoderPtr remote_decoder_; |
73 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; | 78 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; |
74 bool remote_decoder_bound_ = false; | 79 bool remote_decoder_bound_ = false; |
75 bool has_connection_error_ = false; | 80 bool has_connection_error_ = false; |
76 mojo::AssociatedBinding<VideoDecoderClient> client_binding_; | 81 mojo::AssociatedBinding<VideoDecoderClient> client_binding_; |
77 | 82 |
| 83 bool initialized_ = false; |
| 84 bool needs_bitstream_conversion_ = false; |
| 85 int32_t max_decode_requests_ = 1; |
| 86 |
78 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); | 87 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); |
79 }; | 88 }; |
80 | 89 |
81 } // namespace media | 90 } // namespace media |
82 | 91 |
83 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ | 92 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ |
OLD | NEW |