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

Side by Side Diff: media/mojo/services/mojo_video_decoder_service.h

Issue 2966643002: media: Plumb MediaLog to MojoVideoDecoderService. (Closed)
Patch Set: Swap client/service directory. Created 3 years, 5 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
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_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 <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/unguessable_token.h" 13 #include "base/unguessable_token.h"
14 #include "media/base/decode_status.h" 14 #include "media/base/decode_status.h"
15 #include "media/mojo/interfaces/video_decoder.mojom.h" 15 #include "media/mojo/interfaces/video_decoder.mojom.h"
16 #include "media/mojo/services/mojo_media_client.h" 16 #include "media/mojo/services/mojo_media_client.h"
17 17
18 namespace gpu { 18 namespace gpu {
19 struct SyncToken; 19 struct SyncToken;
20 }; 20 };
21 21
22 namespace media { 22 namespace media {
23 23
24 class DecoderBuffer; 24 class DecoderBuffer;
25 class MojoDecoderBufferReader; 25 class MojoDecoderBufferReader;
26 class MojoMediaClient; 26 class MojoMediaClient;
27 class MojoMediaLog;
27 class VideoDecoder; 28 class VideoDecoder;
28 class VideoFrame; 29 class VideoFrame;
29 30
30 // Implementation of a mojom::VideoDecoder which runs in the GPU process, 31 // Implementation of a mojom::VideoDecoder which runs in the GPU process,
31 // and wraps a media::VideoDecoder. 32 // and wraps a media::VideoDecoder.
32 class MojoVideoDecoderService : public mojom::VideoDecoder { 33 class MojoVideoDecoderService : public mojom::VideoDecoder {
33 public: 34 public:
34 explicit MojoVideoDecoderService(MojoMediaClient* mojo_media_client); 35 explicit MojoVideoDecoderService(MojoMediaClient* mojo_media_client);
35 ~MojoVideoDecoderService() final; 36 ~MojoVideoDecoderService() final;
36 37
37 // mojom::VideoDecoder implementation 38 // mojom::VideoDecoder implementation
38 void Construct(mojom::VideoDecoderClientAssociatedPtrInfo client, 39 void Construct(mojom::VideoDecoderClientAssociatedPtrInfo client,
40 mojom::MediaLogAssociatedPtrInfo media_log,
39 mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe, 41 mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe,
40 mojom::CommandBufferIdPtr command_buffer_id) final; 42 mojom::CommandBufferIdPtr command_buffer_id) final;
41 void Initialize(mojom::VideoDecoderConfigPtr config, 43 void Initialize(mojom::VideoDecoderConfigPtr config,
42 bool low_delay, 44 bool low_delay,
43 const InitializeCallback& callback) final; 45 const InitializeCallback& callback) final;
44 void Decode(mojom::DecoderBufferPtr buffer, 46 void Decode(mojom::DecoderBufferPtr buffer,
45 const DecodeCallback& callback) final; 47 const DecodeCallback& callback) final;
46 void Reset(const ResetCallback& callback) final; 48 void Reset(const ResetCallback& callback) final;
47 void OnReleaseMailbox(const base::UnguessableToken& release_token, 49 void OnReleaseMailbox(const base::UnguessableToken& release_token,
48 const gpu::SyncToken& release_sync_token) final; 50 const gpu::SyncToken& release_sync_token) final;
49 51
50 private: 52 private:
51 // Helper methods so that we can bind them with a weak pointer to avoid 53 // Helper methods so that we can bind them with a weak pointer to avoid
52 // running mojom::VideoDecoder callbacks after connection error happens and 54 // running mojom::VideoDecoder callbacks after connection error happens and
53 // |this| is deleted. It's not safe to run the callbacks after a connection 55 // |this| is deleted. It's not safe to run the callbacks after a connection
54 // error. 56 // error.
55 void OnDecoderInitialized(const InitializeCallback& callback, bool success); 57 void OnDecoderInitialized(const InitializeCallback& callback, bool success);
56 void OnDecoderRead(const DecodeCallback& callback, 58 void OnDecoderRead(const DecodeCallback& callback,
57 scoped_refptr<DecoderBuffer> buffer); 59 scoped_refptr<DecoderBuffer> buffer);
58 void OnDecoderDecoded(const DecodeCallback& callback, DecodeStatus status); 60 void OnDecoderDecoded(const DecodeCallback& callback, DecodeStatus status);
59 void OnDecoderReset(const ResetCallback& callback); 61 void OnDecoderReset(const ResetCallback& callback);
60 62
61 void OnDecoderOutput(MojoMediaClient::ReleaseMailboxCB, 63 void OnDecoderOutput(MojoMediaClient::ReleaseMailboxCB,
62 const scoped_refptr<VideoFrame>& frame); 64 const scoped_refptr<VideoFrame>& frame);
63 65
64 mojom::VideoDecoderClientAssociatedPtr client_; 66 mojom::VideoDecoderClientAssociatedPtr client_;
67 std::unique_ptr<MojoMediaLog> media_log_;
65 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_; 68 std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_;
66 69
67 MojoMediaClient* mojo_media_client_; 70 MojoMediaClient* mojo_media_client_;
68 std::unique_ptr<media::VideoDecoder> decoder_; 71 std::unique_ptr<media::VideoDecoder> decoder_;
69 std::map<base::UnguessableToken, MojoMediaClient::ReleaseMailboxCB> 72 std::map<base::UnguessableToken, MojoMediaClient::ReleaseMailboxCB>
70 release_mailbox_cbs_; 73 release_mailbox_cbs_;
71 74
72 base::WeakPtr<MojoVideoDecoderService> weak_this_; 75 base::WeakPtr<MojoVideoDecoderService> weak_this_;
73 base::WeakPtrFactory<MojoVideoDecoderService> weak_factory_; 76 base::WeakPtrFactory<MojoVideoDecoderService> weak_factory_;
74 77
75 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoderService); 78 DISALLOW_COPY_AND_ASSIGN(MojoVideoDecoderService);
76 }; 79 };
77 80
78 } // namespace media 81 } // namespace media
79 82
80 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_ 83 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_DECODER_SERVICE_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_media_log.cc ('k') | media/mojo/services/mojo_video_decoder_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698