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_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_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/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/optional.h" | |
12 #include "media/base/decode_status.h" | 13 #include "media/base/decode_status.h" |
13 #include "media/mojo/interfaces/video_decoder.mojom.h" | 14 #include "media/mojo/interfaces/video_decoder.mojom.h" |
14 | 15 |
16 namespace gpu { | |
17 struct SyncToken; | |
18 }; | |
19 | |
15 namespace media { | 20 namespace media { |
16 | 21 |
17 class MojoDecoderBufferReader; | 22 class MojoDecoderBufferReader; |
18 class MojoMediaClient; | 23 class MojoMediaClient; |
19 class VideoDecoder; | 24 class VideoDecoder; |
20 class VideoFrame; | 25 class VideoFrame; |
21 | 26 |
22 // Implementation of a mojom::VideoDecoder which runs in the GPU process, | 27 // Implementation of a mojom::VideoDecoder which runs in the GPU process, |
23 // and wraps a media::VideoDecoder. | 28 // and wraps a media::VideoDecoder. |
24 class MojoVideoDecoderService : public mojom::VideoDecoder { | 29 class MojoVideoDecoderService : public mojom::VideoDecoder { |
(...skipping 17 matching lines...) Expand all Loading... | |
42 // running mojom::VideoDecoder callbacks after connection error happens and | 47 // running mojom::VideoDecoder callbacks after connection error happens and |
43 // |this| is deleted. It's not safe to run the callbacks after a connection | 48 // |this| is deleted. It's not safe to run the callbacks after a connection |
44 // error. | 49 // error. |
45 void OnDecoderInitialized(const InitializeCallback& callback, bool success); | 50 void OnDecoderInitialized(const InitializeCallback& callback, bool success); |
46 void OnDecoderRead(const DecodeCallback& callback, | 51 void OnDecoderRead(const DecodeCallback& callback, |
47 scoped_refptr<DecoderBuffer> buffer); | 52 scoped_refptr<DecoderBuffer> buffer); |
48 void OnDecoderDecoded(const DecodeCallback& callback, DecodeStatus status); | 53 void OnDecoderDecoded(const DecodeCallback& callback, DecodeStatus status); |
49 void OnDecoderReset(const ResetCallback& callback); | 54 void OnDecoderReset(const ResetCallback& callback); |
50 | 55 |
51 void OnDecoderOutput(const scoped_refptr<VideoFrame>& frame); | 56 void OnDecoderOutput(const scoped_refptr<VideoFrame>& frame); |
57 void OnVideoFrameDestroyed( | |
xhwang
2017/01/25 18:25:09
nit: In VideoFrame we have DestructionObserver, ho
sandersd (OOO until July 31)
2017/01/26 23:49:05
Renamed to OnReleaseMailbox().
| |
58 const base::Optional<gpu::SyncToken>& release_sync_token); | |
52 | 59 |
53 mojom::VideoDecoderClientAssociatedPtr client_; | 60 mojom::VideoDecoderClientAssociatedPtr client_; |
54 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; | 61 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; |
55 | 62 |
56 MojoMediaClient* mojo_media_client_; | 63 MojoMediaClient* mojo_media_client_; |
57 std::unique_ptr<media::VideoDecoder> decoder_; | 64 std::unique_ptr<media::VideoDecoder> decoder_; |
58 | 65 |
59 base::WeakPtr<MojoVideoDecoderService> weak_this_; | 66 base::WeakPtr<MojoVideoDecoderService> weak_this_; |
60 base::WeakPtrFactory<MojoVideoDecoderService> weak_factory_; | 67 base::WeakPtrFactory<MojoVideoDecoderService> weak_factory_; |
61 | 68 |
62 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoderService); | 69 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoderService); |
63 }; | 70 }; |
64 | 71 |
65 } // namespace media | 72 } // namespace media |
66 | 73 |
67 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ | 74 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ |
OLD | NEW |