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

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

Issue 1538063003: Use data pipe to pass DecoderBuffer contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_DECRYPTOR_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "media/base/decryptor.h" 10 #include "media/base/decryptor.h"
11 #include "media/mojo/interfaces/decryptor.mojom.h" 11 #include "media/mojo/interfaces/decryptor.mojom.h"
12 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "mojo/public/cpp/system/data_pipe.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 class MojoDecryptor : public Decryptor { 17 class MojoDecryptor : public Decryptor {
17 public: 18 public:
18 explicit MojoDecryptor(interfaces::DecryptorPtr remote_decryptor); 19 explicit MojoDecryptor(interfaces::DecryptorPtr remote_decryptor);
19 ~MojoDecryptor() final; 20 ~MojoDecryptor() final;
20 21
21 // Decryptor implementation. 22 // Decryptor implementation.
22 void RegisterNewKeyCB(StreamType stream_type, 23 void RegisterNewKeyCB(StreamType stream_type,
(...skipping 21 matching lines...) Expand all
44 void OnBufferDecrypted(const DecryptCB& decrypt_cb, 45 void OnBufferDecrypted(const DecryptCB& decrypt_cb,
45 interfaces::Decryptor::Status status, 46 interfaces::Decryptor::Status status,
46 interfaces::DecoderBufferPtr buffer); 47 interfaces::DecoderBufferPtr buffer);
47 void OnAudioDecoded(const AudioDecodeCB& audio_decode_cb, 48 void OnAudioDecoded(const AudioDecodeCB& audio_decode_cb,
48 interfaces::Decryptor::Status status, 49 interfaces::Decryptor::Status status,
49 mojo::Array<interfaces::AudioBufferPtr> audio_buffers); 50 mojo::Array<interfaces::AudioBufferPtr> audio_buffers);
50 void OnVideoDecoded(const VideoDecodeCB& video_decode_cb, 51 void OnVideoDecoded(const VideoDecodeCB& video_decode_cb,
51 interfaces::Decryptor::Status status, 52 interfaces::Decryptor::Status status,
52 interfaces::VideoFramePtr video_frame); 53 interfaces::VideoFramePtr video_frame);
53 54
55 // To pass DecoderBuffers to and from the MojoDecryptorService, 2 data pipes
56 // are required (one each way). At initialization both pipes are created,
57 // and then the handles are passed to the MojoDecryptorService.
58 void CreateDataPipes();
59 void WriteDataIntoDataPipe(const scoped_refptr<DecoderBuffer>& buffer);
60 void ReadDataFromDataPipe(const scoped_refptr<DecoderBuffer>& buffer);
61
54 interfaces::DecryptorPtr remote_decryptor_; 62 interfaces::DecryptorPtr remote_decryptor_;
55 63
64 // DataPipes for serializing the data section of DecoderBuffer into/from.
65 mojo::ScopedDataPipeProducerHandle write_pipe_;
66 mojo::ScopedDataPipeConsumerHandle read_pipe_;
xhwang 2015/12/19 18:16:30 It's probably easier to understand if we just call
jrummell 2015/12/21 23:20:55 Done.
67
56 NewKeyCB new_audio_key_cb_; 68 NewKeyCB new_audio_key_cb_;
57 NewKeyCB new_video_key_cb_; 69 NewKeyCB new_video_key_cb_;
58 70
59 base::WeakPtrFactory<MojoDecryptor> weak_factory_; 71 base::WeakPtrFactory<MojoDecryptor> weak_factory_;
60 72
61 DISALLOW_COPY_AND_ASSIGN(MojoDecryptor); 73 DISALLOW_COPY_AND_ASSIGN(MojoDecryptor);
62 }; 74 };
63 75
64 } // namespace media 76 } // namespace media
65 77
66 #endif // MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_H_ 78 #endif // MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698