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

Side by Side Diff: media/mojo/clients/mojo_video_decoder.h

Issue 2640153004: Add mailbox-based Mojo VideoFrame variant. (Closed)
Patch Set: Rebase. Created 3 years, 9 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
« no previous file with comments | « media/base/video_frame.cc ('k') | media/mojo/clients/mojo_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/weak_ptr.h"
10 #include "media/base/video_decoder.h" 11 #include "media/base/video_decoder.h"
11 #include "media/mojo/interfaces/video_decoder.mojom.h" 12 #include "media/mojo/interfaces/video_decoder.mojom.h"
12 #include "mojo/public/cpp/bindings/associated_binding.h" 13 #include "mojo/public/cpp/bindings/associated_binding.h"
13 14
14 namespace base { 15 namespace base {
15 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
16 } 17 }
17 18
18 namespace media { 19 namespace media {
19 20
(...skipping 20 matching lines...) Expand all
40 const InitCB& init_cb, 41 const InitCB& init_cb,
41 const OutputCB& output_cb) final; 42 const OutputCB& output_cb) final;
42 void Decode(const scoped_refptr<DecoderBuffer>& buffer, 43 void Decode(const scoped_refptr<DecoderBuffer>& buffer,
43 const DecodeCB& decode_cb) final; 44 const DecodeCB& decode_cb) final;
44 void Reset(const base::Closure& closure) final; 45 void Reset(const base::Closure& closure) final;
45 bool NeedsBitstreamConversion() const final; 46 bool NeedsBitstreamConversion() const final;
46 bool CanReadWithoutStalling() const final; 47 bool CanReadWithoutStalling() const final;
47 int GetMaxDecodeRequests() const final; 48 int GetMaxDecodeRequests() const final;
48 49
49 // mojom::VideoDecoderClient implementation. 50 // mojom::VideoDecoderClient implementation.
50 void OnVideoFrameDecoded(mojom::VideoFramePtr frame) final; 51 void OnVideoFrameDecoded(
52 mojom::VideoFramePtr frame,
53 const base::Optional<base::UnguessableToken>& release_token) final;
51 54
52 private: 55 private:
53 void OnInitializeDone(bool status, 56 void OnInitializeDone(bool status,
54 bool needs_bitstream_conversion, 57 bool needs_bitstream_conversion,
55 int32_t max_decode_requests); 58 int32_t max_decode_requests);
56 void OnDecodeDone(uint64_t decode_id, DecodeStatus status); 59 void OnDecodeDone(uint64_t decode_id, DecodeStatus status);
57 void OnResetDone(); 60 void OnResetDone();
58 61
59 void BindRemoteDecoder(); 62 void BindRemoteDecoder();
60 63
64 void OnReleaseMailbox(const base::UnguessableToken& release_token,
65 const gpu::SyncToken& release_sync_token);
66
61 // Cleans up callbacks and blocks future calls. 67 // Cleans up callbacks and blocks future calls.
62 void Stop(); 68 void Stop();
63 69
64 // Task runner that the decoder runs on (media thread). 70 // Task runner that the decoder runs on (media thread).
65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 71 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
66 72
67 // Used to pass the remote decoder from the constructor (on the main thread) 73 // Used to pass the remote decoder from the constructor (on the main thread)
68 // to Initialize() (on the media thread). 74 // to Initialize() (on the media thread).
69 mojom::VideoDecoderPtrInfo remote_decoder_info_; 75 mojom::VideoDecoderPtrInfo remote_decoder_info_;
70 76
71 GpuVideoAcceleratorFactories* gpu_factories_ = nullptr; 77 GpuVideoAcceleratorFactories* gpu_factories_ = nullptr;
72 78
73 InitCB init_cb_; 79 InitCB init_cb_;
74 OutputCB output_cb_; 80 OutputCB output_cb_;
75 uint64_t decode_counter_ = 0; 81 uint64_t decode_counter_ = 0;
76 std::map<uint64_t, DecodeCB> pending_decodes_; 82 std::map<uint64_t, DecodeCB> pending_decodes_;
77 base::Closure reset_cb_; 83 base::Closure reset_cb_;
78 84
79 mojom::VideoDecoderPtr remote_decoder_; 85 mojom::VideoDecoderPtr remote_decoder_;
80 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_; 86 std::unique_ptr<MojoDecoderBufferWriter> mojo_decoder_buffer_writer_;
81 bool remote_decoder_bound_ = false; 87 bool remote_decoder_bound_ = false;
82 bool has_connection_error_ = false; 88 bool has_connection_error_ = false;
83 mojo::AssociatedBinding<VideoDecoderClient> client_binding_; 89 mojo::AssociatedBinding<VideoDecoderClient> client_binding_;
84 90
85 bool initialized_ = false; 91 bool initialized_ = false;
86 bool needs_bitstream_conversion_ = false; 92 bool needs_bitstream_conversion_ = false;
87 int32_t max_decode_requests_ = 1; 93 int32_t max_decode_requests_ = 1;
88 94
95 base::WeakPtr<MojoVideoDecoder> weak_this_;
96 base::WeakPtrFactory<MojoVideoDecoder> weak_factory_;
97
89 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder); 98 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoder);
90 }; 99 };
91 100
92 } // namespace media 101 } // namespace media
93 102
94 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_ 103 #endif // MEDIA_MOJO_CLIENTS_MOJO_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/base/video_frame.cc ('k') | media/mojo/clients/mojo_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698