Chromium Code Reviews| Index: media/remoting/rpc/rpc.h |
| diff --git a/media/remoting/rpc/rpc.h b/media/remoting/rpc/rpc.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..044359fcd3ff5cd9db5124d2da0dc3fff1dde612 |
| --- /dev/null |
| +++ b/media/remoting/rpc/rpc.h |
| @@ -0,0 +1,101 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_REMOTING_RPC_RPC_H_ |
| +#define MEDIA_REMOTING_RPC_RPC_H_ |
| + |
| +#include <cstdint> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "media/base/audio_decoder_config.h" |
| +#include "media/base/cdm_config.h" |
| +#include "media/base/cdm_key_information.h" |
| +#include "media/base/demuxer_stream.h" |
| +#include "media/base/eme_constants.h" |
| +#include "media/base/media_keys.h" |
| +#include "media/base/pipeline_status.h" |
| +#include "media/base/video_decoder_config.h" |
| +#include "media/remoting/remoting_rpc_message.pb.h" |
| + |
| +namespace media { |
| +namespace remoting { |
| + |
| +class CdmPromiseResult; |
| + |
| +extern const int kInvalidHandle; |
|
miu
2016/09/13 05:40:58
These don't seem to be used anywhere. Are you plan
erickung1
2016/09/15 02:13:33
I updated the code to use kReceiverHandle when RPC
|
| +extern const int kReceiverHandle; |
| + |
| +void SerializeEncryptionScheme( |
|
miu
2016/09/13 05:40:58
General comment for these Serialize/Deserialize fu
erickung1
2016/09/15 02:13:33
I made the change for #1 #2 and most #3.
When you
miu
2016/09/16 18:14:13
Normal route. General guideline: If a value is not
|
| + pb::EncryptionScheme* message, |
| + const ::media::EncryptionScheme& encryption_scheme); |
| +void DeserializeEncryptionScheme(const pb::EncryptionScheme& message, |
| + ::media::EncryptionScheme* encryption_scheme); |
| + |
| +void SerializeAudioConfig(const ::media::AudioDecoderConfig& audio_config, |
| + pb::AudioDecoderConfig* audio_message); |
| +bool DeserializeAudioConfig(const pb::AudioDecoderConfig& audio_message, |
| + ::media::AudioDecoderConfig* audio_config); |
| + |
| +void SerializeVideoConfig(const ::media::VideoDecoderConfig& video_config, |
| + pb::VideoDecoderConfig* video_message); |
| +bool DeserializeVideoConfig(const pb::VideoDecoderConfig& video_message, |
| + ::media::VideoDecoderConfig* video_config); |
| + |
| +void SerializeCdmConfig(const ::media::CdmConfig& cdm_config, |
| + pb::CdmInitialize* message); |
| + |
| +void SerializeCdmPromiseResult(pb::CdmPromise* promise_message, |
| + const CdmPromiseResult& result); |
| +bool DeserializeCdmPromiseResult(const pb::CdmPromise& promise_message, |
| + CdmPromiseResult* result); |
| + |
| +void SerializeCdmKeyInformation( |
| + const ::media::CdmKeysInfo& keys_information, |
| + pb::CdmClientOnSessionKeysChange* key_change_message); |
| +bool DeserializeCdmKeyInformation( |
| + const pb::CdmClientOnSessionKeysChange keychange_message, |
| + CdmKeysInfo* key_information); |
| + |
| +bool CdmPromiseFromMessage(const pb::RpcMessage& message, |
| + CdmPromiseResult* result, |
| + int* cdm_id, |
| + std::string* session_id); |
| +void CdmPromiseToMessage(pb::CdmPromise* promise_message, |
| + const CdmPromiseResult& result, |
| + const std::string& session_id); |
| +void CdmPromiseWithCdmIdToMessage(pb::CdmPromise* promise_message, |
| + const CdmPromiseResult& result, |
| + int cdm_id); |
| + |
| +//================================================================== |
| +class CdmPromiseResult { |
| + public: |
| + CdmPromiseResult(); |
| + CdmPromiseResult(::media::MediaKeys::Exception exception, |
| + uint32_t system_code, |
| + std::string error_message); |
| + CdmPromiseResult(const CdmPromiseResult& other); |
| + ~CdmPromiseResult(); |
| + |
| + static CdmPromiseResult SuccessResult(); |
| + |
| + bool success() const { return success_; } |
| + ::media::MediaKeys::Exception exception() const { return exception_; } |
| + uint32_t system_code() const { return system_code_; } |
| + const std::string& error_message() const { return error_message_; } |
| + |
| + private: |
| + bool success_; |
| + ::media::MediaKeys::Exception exception_; |
| + uint32_t system_code_; |
| + std::string error_message_; |
| +}; |
| + |
| +} // namespace remoting |
| +} // namespace media |
| + |
| +#endif // MEDIA_REMOTING_RPC_RPC_H_ |