Commit 7913af1e authored by Yuri Wiitala's avatar Yuri Wiitala Committed by Commit Bot

Remove remaining media/remoting impl related to DRM.

Leave all protobuf messages/enums/fields in-place in the protobuf
definition, but deprecate them all. Then, remove all C++ code related
to DRM. (This is a feature that never launched.)

Bug: 1102847
Change-Id: Iae7ce89e35d22e50c1360d2f4618981f8a79e682
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285875
Commit-Queue: Yuri Wiitala <miu@chromium.org>
Auto-Submit: Yuri Wiitala <miu@chromium.org>
Reviewed-by: default avatarmark a. foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#788367}
parent 1652e07b
...@@ -377,9 +377,6 @@ void CourierRenderer::OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message) { ...@@ -377,9 +377,6 @@ void CourierRenderer::OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message) {
case pb::RpcMessage::RPC_R_FLUSHUNTIL_CALLBACK: case pb::RpcMessage::RPC_R_FLUSHUNTIL_CALLBACK:
FlushUntilCallback(); FlushUntilCallback();
break; break;
case pb::RpcMessage::RPC_R_SETCDM_CALLBACK:
SetCdmCallback(std::move(message));
break;
case pb::RpcMessage::RPC_RC_ONTIMEUPDATE: case pb::RpcMessage::RPC_RC_ONTIMEUPDATE:
OnTimeUpdate(std::move(message)); OnTimeUpdate(std::move(message));
break; break;
...@@ -407,9 +404,6 @@ void CourierRenderer::OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message) { ...@@ -407,9 +404,6 @@ void CourierRenderer::OnReceivedRpc(std::unique_ptr<pb::RpcMessage> message) {
case pb::RpcMessage::RPC_RC_ONSTATISTICSUPDATE: case pb::RpcMessage::RPC_RC_ONSTATISTICSUPDATE:
OnStatisticsUpdate(std::move(message)); OnStatisticsUpdate(std::move(message));
break; break;
case pb::RpcMessage::RPC_RC_ONWAITINGFORDECRYPTIONKEY:
client_->OnWaiting(WaitingReason::kNoDecryptionKey);
break;
default: default:
DVLOG(1) << "Unknown RPC: " << message->proc(); DVLOG(1) << "Unknown RPC: " << message->proc();
...@@ -496,13 +490,6 @@ void CourierRenderer::FlushUntilCallback() { ...@@ -496,13 +490,6 @@ void CourierRenderer::FlushUntilCallback() {
ResetMeasurements(); ResetMeasurements();
} }
void CourierRenderer::SetCdmCallback(std::unique_ptr<pb::RpcMessage> message) {
DCHECK(media_task_runner_->BelongsToCurrentThread());
DCHECK(message);
// TODO(erickung): add implementation once Remote CDM implementation is done.
NOTIMPLEMENTED();
}
void CourierRenderer::OnTimeUpdate(std::unique_ptr<pb::RpcMessage> message) { void CourierRenderer::OnTimeUpdate(std::unique_ptr<pb::RpcMessage> message) {
DCHECK(media_task_runner_->BelongsToCurrentThread()); DCHECK(media_task_runner_->BelongsToCurrentThread());
DCHECK(message); DCHECK(message);
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#define MEDIA_REMOTING_COURIER_RENDERER_H_ #define MEDIA_REMOTING_COURIER_RENDERER_H_
#include <memory> #include <memory>
#include <tuple>
#include <utility>
#include "base/callback.h" #include "base/callback.h"
#include "base/containers/circular_deque.h" #include "base/containers/circular_deque.h"
...@@ -112,7 +114,6 @@ class CourierRenderer : public Renderer { ...@@ -112,7 +114,6 @@ class CourierRenderer : public Renderer {
void AcquireRendererDone(std::unique_ptr<pb::RpcMessage> message); void AcquireRendererDone(std::unique_ptr<pb::RpcMessage> message);
void InitializeCallback(std::unique_ptr<pb::RpcMessage> message); void InitializeCallback(std::unique_ptr<pb::RpcMessage> message);
void FlushUntilCallback(); void FlushUntilCallback();
void SetCdmCallback(std::unique_ptr<pb::RpcMessage> message);
void OnTimeUpdate(std::unique_ptr<pb::RpcMessage> message); void OnTimeUpdate(std::unique_ptr<pb::RpcMessage> message);
void OnBufferingStateChange(std::unique_ptr<pb::RpcMessage> message); void OnBufferingStateChange(std::unique_ptr<pb::RpcMessage> message);
void OnAudioConfigChange(std::unique_ptr<pb::RpcMessage> message); void OnAudioConfigChange(std::unique_ptr<pb::RpcMessage> message);
...@@ -173,7 +174,6 @@ class CourierRenderer : public Renderer { ...@@ -173,7 +174,6 @@ class CourierRenderer : public Renderer {
// Callbacks. // Callbacks.
PipelineStatusCallback init_workflow_done_callback_; PipelineStatusCallback init_workflow_done_callback_;
CdmAttachedCB cdm_attached_cb_;
base::OnceClosure flush_cb_; base::OnceClosure flush_cb_;
VideoRendererSink* const video_renderer_sink_; // Outlives this class. VideoRendererSink* const video_renderer_sink_; // Outlives this class.
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "media/remoting/courier_renderer.h" #include "media/remoting/courier_renderer.h"
#include <memory> #include <memory>
#include <utility>
#include <vector>
#include "base/bind.h" #include "base/bind.h"
#include "base/check.h" #include "base/check.h"
...@@ -273,7 +275,6 @@ class CourierRendererTest : public testing::Test { ...@@ -273,7 +275,6 @@ class CourierRendererTest : public testing::Test {
flush_cb->set_proc(pb::RpcMessage::RPC_R_FLUSHUNTIL_CALLBACK); flush_cb->set_proc(pb::RpcMessage::RPC_R_FLUSHUNTIL_CALLBACK);
controller_->GetRpcBroker()->ProcessMessageFromRemote( controller_->GetRpcBroker()->ProcessMessageFromRemote(
std::move(flush_cb)); std::move(flush_cb));
} break; } break;
case pb::RpcMessage::RPC_R_SETVOLUME: case pb::RpcMessage::RPC_R_SETVOLUME:
// No response needed. // No response needed.
...@@ -418,14 +419,10 @@ class CourierRendererTest : public testing::Test { ...@@ -418,14 +419,10 @@ class CourierRendererTest : public testing::Test {
message->set_video_memory_usage(stats.video_memory_usage); message->set_video_memory_usage(stats.video_memory_usage);
message->mutable_audio_decoder_info()->set_is_platform_decoder( message->mutable_audio_decoder_info()->set_is_platform_decoder(
stats.audio_decoder_info.is_platform_decoder); stats.audio_decoder_info.is_platform_decoder);
message->mutable_audio_decoder_info()->set_has_decrypting_demuxer_stream(
stats.audio_decoder_info.has_decrypting_demuxer_stream);
message->mutable_audio_decoder_info()->set_decoder_name( message->mutable_audio_decoder_info()->set_decoder_name(
stats.audio_decoder_info.decoder_name); stats.audio_decoder_info.decoder_name);
message->mutable_video_decoder_info()->set_is_platform_decoder( message->mutable_video_decoder_info()->set_is_platform_decoder(
stats.video_decoder_info.is_platform_decoder); stats.video_decoder_info.is_platform_decoder);
message->mutable_video_decoder_info()->set_has_decrypting_demuxer_stream(
stats.video_decoder_info.has_decrypting_demuxer_stream);
message->mutable_video_decoder_info()->set_decoder_name( message->mutable_video_decoder_info()->set_decoder_name(
stats.video_decoder_info.decoder_name); stats.video_decoder_info.decoder_name);
OnReceivedRpc(std::move(rpc)); OnReceivedRpc(std::move(rpc));
......
This diff is collapsed.
...@@ -11,32 +11,6 @@ namespace remoting { ...@@ -11,32 +11,6 @@ namespace remoting {
case OriginType::x: \ case OriginType::x: \
return OtherType::x return OtherType::x
base::Optional<EncryptionScheme> ToMediaEncryptionScheme(
pb::EncryptionScheme::CipherMode value) {
switch (value) {
case pb::EncryptionScheme::CIPHER_MODE_UNENCRYPTED:
return EncryptionScheme::kUnencrypted;
case pb::EncryptionScheme::CIPHER_MODE_AES_CTR:
return EncryptionScheme::kCenc;
case pb::EncryptionScheme::CIPHER_MODE_AES_CBC:
return EncryptionScheme::kCbcs;
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::EncryptionScheme::CipherMode>
ToProtoEncryptionSchemeCipherMode(EncryptionScheme value) {
switch (value) {
case EncryptionScheme::kUnencrypted:
return pb::EncryptionScheme::CIPHER_MODE_UNENCRYPTED;
case EncryptionScheme::kCenc:
return pb::EncryptionScheme::CIPHER_MODE_AES_CTR;
case EncryptionScheme::kCbcs:
return pb::EncryptionScheme::CIPHER_MODE_AES_CBC;
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<AudioCodec> ToMediaAudioCodec( base::Optional<AudioCodec> ToMediaAudioCodec(
pb::AudioDecoderConfig::Codec value) { pb::AudioDecoderConfig::Codec value) {
using OriginType = pb::AudioDecoderConfig; using OriginType = pb::AudioDecoderConfig;
...@@ -399,144 +373,6 @@ ToProtoMediaBufferingState(BufferingState value) { ...@@ -399,144 +373,6 @@ ToProtoMediaBufferingState(BufferingState value) {
return base::nullopt; // Not a 'default' to ensure compile-time checks. return base::nullopt; // Not a 'default' to ensure compile-time checks.
} }
base::Optional<CdmKeyInformation::KeyStatus> ToMediaCdmKeyInformationKeyStatus(
pb::CdmKeyInformation::KeyStatus value) {
using OriginType = pb::CdmKeyInformation;
using OtherType = CdmKeyInformation;
switch (value) {
CASE_RETURN_OTHER(USABLE);
CASE_RETURN_OTHER(INTERNAL_ERROR);
CASE_RETURN_OTHER(EXPIRED);
CASE_RETURN_OTHER(OUTPUT_RESTRICTED);
CASE_RETURN_OTHER(OUTPUT_DOWNSCALED);
CASE_RETURN_OTHER(KEY_STATUS_PENDING);
CASE_RETURN_OTHER(RELEASED);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::CdmKeyInformation::KeyStatus> ToProtoCdmKeyInformation(
CdmKeyInformation::KeyStatus value) {
using OriginType = CdmKeyInformation;
using OtherType = pb::CdmKeyInformation;
switch (value) {
CASE_RETURN_OTHER(USABLE);
CASE_RETURN_OTHER(INTERNAL_ERROR);
CASE_RETURN_OTHER(EXPIRED);
CASE_RETURN_OTHER(OUTPUT_RESTRICTED);
CASE_RETURN_OTHER(OUTPUT_DOWNSCALED);
CASE_RETURN_OTHER(KEY_STATUS_PENDING);
CASE_RETURN_OTHER(RELEASED);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<CdmPromise::Exception> ToCdmPromiseException(
pb::CdmException value) {
using OriginType = pb::CdmException;
using OtherType = CdmPromise::Exception;
switch (value) {
CASE_RETURN_OTHER(NOT_SUPPORTED_ERROR);
CASE_RETURN_OTHER(INVALID_STATE_ERROR);
CASE_RETURN_OTHER(QUOTA_EXCEEDED_ERROR);
CASE_RETURN_OTHER(TYPE_ERROR);
// The following were generated with previous versions of the CDM and are
// no longer used by CdmPromise.
case OriginType::INVALID_ACCESS_ERROR:
case OriginType::UNKNOWN_ERROR:
case OriginType::CLIENT_ERROR:
case OriginType::OUTPUT_ERROR:
return OtherType::NOT_SUPPORTED_ERROR;
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::CdmException> ToProtoCdmException(
CdmPromise::Exception value) {
using OriginType = CdmPromise::Exception;
using OtherType = pb::CdmException;
switch (value) {
CASE_RETURN_OTHER(NOT_SUPPORTED_ERROR);
CASE_RETURN_OTHER(INVALID_STATE_ERROR);
CASE_RETURN_OTHER(QUOTA_EXCEEDED_ERROR);
CASE_RETURN_OTHER(TYPE_ERROR);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<CdmMessageType> ToMediaCdmMessageType(pb::CdmMessageType value) {
using OriginType = pb::CdmMessageType;
using OtherType = CdmMessageType;
switch (value) {
CASE_RETURN_OTHER(LICENSE_REQUEST);
CASE_RETURN_OTHER(LICENSE_RENEWAL);
CASE_RETURN_OTHER(LICENSE_RELEASE);
CASE_RETURN_OTHER(INDIVIDUALIZATION_REQUEST);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::CdmMessageType> ToProtoCdmMessageType(CdmMessageType value) {
using OriginType = CdmMessageType;
using OtherType = pb::CdmMessageType;
switch (value) {
CASE_RETURN_OTHER(LICENSE_REQUEST);
CASE_RETURN_OTHER(LICENSE_RENEWAL);
CASE_RETURN_OTHER(LICENSE_RELEASE);
CASE_RETURN_OTHER(INDIVIDUALIZATION_REQUEST);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<CdmSessionType> ToCdmSessionType(pb::CdmSessionType value) {
using OriginType = pb::CdmSessionType;
using OtherType = CdmSessionType;
switch (value) {
CASE_RETURN_OTHER(kTemporary);
CASE_RETURN_OTHER(kPersistentLicense);
CASE_RETURN_OTHER(kPersistentUsageRecord);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::CdmSessionType> ToProtoCdmSessionType(CdmSessionType value) {
using OriginType = CdmSessionType;
using OtherType = pb::CdmSessionType;
switch (value) {
CASE_RETURN_OTHER(kTemporary);
CASE_RETURN_OTHER(kPersistentLicense);
CASE_RETURN_OTHER(kPersistentUsageRecord);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<EmeInitDataType> ToMediaEmeInitDataType(
pb::CdmCreateSessionAndGenerateRequest::EmeInitDataType value) {
using OriginType = pb::CdmCreateSessionAndGenerateRequest;
using OtherType = EmeInitDataType;
switch (value) {
CASE_RETURN_OTHER(UNKNOWN);
CASE_RETURN_OTHER(WEBM);
CASE_RETURN_OTHER(CENC);
CASE_RETURN_OTHER(KEYIDS);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::CdmCreateSessionAndGenerateRequest::EmeInitDataType>
ToProtoMediaEmeInitDataType(EmeInitDataType value) {
using OriginType = EmeInitDataType;
using OtherType = pb::CdmCreateSessionAndGenerateRequest;
switch (value) {
CASE_RETURN_OTHER(UNKNOWN);
CASE_RETURN_OTHER(WEBM);
CASE_RETURN_OTHER(CENC);
CASE_RETURN_OTHER(KEYIDS);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<DemuxerStream::Status> ToDemuxerStreamStatus( base::Optional<DemuxerStream::Status> ToDemuxerStreamStatus(
pb::DemuxerStreamReadUntilCallback::Status value) { pb::DemuxerStreamReadUntilCallback::Status value) {
using OriginType = pb::DemuxerStreamReadUntilCallback; using OriginType = pb::DemuxerStreamReadUntilCallback;
...@@ -563,29 +399,5 @@ ToProtoDemuxerStreamStatus(DemuxerStream::Status value) { ...@@ -563,29 +399,5 @@ ToProtoDemuxerStreamStatus(DemuxerStream::Status value) {
return base::nullopt; // Not a 'default' to ensure compile-time checks. return base::nullopt; // Not a 'default' to ensure compile-time checks.
} }
base::Optional<EncryptionScheme> ToMediaEncryptionScheme(
pb::EncryptionMode value) {
using OriginType = pb::EncryptionMode;
using OtherType = EncryptionScheme;
switch (value) {
CASE_RETURN_OTHER(kUnencrypted);
CASE_RETURN_OTHER(kCenc);
CASE_RETURN_OTHER(kCbcs);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
base::Optional<pb::EncryptionMode> ToProtoEncryptionMode(
EncryptionScheme value) {
using OriginType = EncryptionScheme;
using OtherType = pb::EncryptionMode;
switch (value) {
CASE_RETURN_OTHER(kUnencrypted);
CASE_RETURN_OTHER(kCenc);
CASE_RETURN_OTHER(kCbcs);
}
return base::nullopt; // Not a 'default' to ensure compile-time checks.
}
} // namespace remoting } // namespace remoting
} // namespace media } // namespace media
...@@ -8,13 +8,8 @@ ...@@ -8,13 +8,8 @@
#include "base/optional.h" #include "base/optional.h"
#include "media/base/audio_codecs.h" #include "media/base/audio_codecs.h"
#include "media/base/buffering_state.h" #include "media/base/buffering_state.h"
#include "media/base/cdm_key_information.h"
#include "media/base/cdm_promise.h"
#include "media/base/channel_layout.h" #include "media/base/channel_layout.h"
#include "media/base/content_decryption_module.h"
#include "media/base/decrypt_config.h"
#include "media/base/demuxer_stream.h" #include "media/base/demuxer_stream.h"
#include "media/base/encryption_scheme.h"
#include "media/base/sample_format.h" #include "media/base/sample_format.h"
#include "media/base/video_codecs.h" #include "media/base/video_codecs.h"
#include "media/base/video_types.h" #include "media/base/video_types.h"
...@@ -32,11 +27,6 @@ namespace remoting { ...@@ -32,11 +27,6 @@ namespace remoting {
// Each returns a base::Optional value. If it is not set, that indicates the // Each returns a base::Optional value. If it is not set, that indicates the
// conversion failed. // conversion failed.
base::Optional<EncryptionScheme> ToMediaEncryptionScheme(
pb::EncryptionScheme::CipherMode value);
base::Optional<pb::EncryptionScheme::CipherMode>
ToProtoEncryptionSchemeCipherMode(EncryptionScheme value);
base::Optional<AudioCodec> ToMediaAudioCodec( base::Optional<AudioCodec> ToMediaAudioCodec(
pb::AudioDecoderConfig::Codec value); pb::AudioDecoderConfig::Codec value);
base::Optional<pb::AudioDecoderConfig::Codec> ToProtoAudioDecoderConfigCodec( base::Optional<pb::AudioDecoderConfig::Codec> ToProtoAudioDecoderConfigCodec(
...@@ -70,37 +60,11 @@ base::Optional<BufferingState> ToMediaBufferingState( ...@@ -70,37 +60,11 @@ base::Optional<BufferingState> ToMediaBufferingState(
base::Optional<pb::RendererClientOnBufferingStateChange::State> base::Optional<pb::RendererClientOnBufferingStateChange::State>
ToProtoMediaBufferingState(BufferingState value); ToProtoMediaBufferingState(BufferingState value);
base::Optional<CdmKeyInformation::KeyStatus> ToMediaCdmKeyInformationKeyStatus(
pb::CdmKeyInformation::KeyStatus value);
base::Optional<pb::CdmKeyInformation::KeyStatus> ToProtoCdmKeyInformation(
CdmKeyInformation::KeyStatus value);
base::Optional<CdmPromise::Exception> ToCdmPromiseException(
pb::CdmException value);
base::Optional<pb::CdmException> ToProtoCdmException(
CdmPromise::Exception value);
base::Optional<CdmMessageType> ToMediaCdmMessageType(pb::CdmMessageType value);
base::Optional<pb::CdmMessageType> ToProtoCdmMessageType(CdmMessageType value);
base::Optional<CdmSessionType> ToCdmSessionType(pb::CdmSessionType value);
base::Optional<pb::CdmSessionType> ToProtoCdmSessionType(CdmSessionType value);
base::Optional<EmeInitDataType> ToMediaEmeInitDataType(
pb::CdmCreateSessionAndGenerateRequest::EmeInitDataType value);
base::Optional<pb::CdmCreateSessionAndGenerateRequest::EmeInitDataType>
ToProtoMediaEmeInitDataType(EmeInitDataType value);
base::Optional<DemuxerStream::Status> ToDemuxerStreamStatus( base::Optional<DemuxerStream::Status> ToDemuxerStreamStatus(
pb::DemuxerStreamReadUntilCallback::Status value); pb::DemuxerStreamReadUntilCallback::Status value);
base::Optional<pb::DemuxerStreamReadUntilCallback::Status> base::Optional<pb::DemuxerStreamReadUntilCallback::Status>
ToProtoDemuxerStreamStatus(DemuxerStream::Status value); ToProtoDemuxerStreamStatus(DemuxerStream::Status value);
base::Optional<EncryptionScheme> ToMediaEncryptionScheme(
pb::EncryptionMode value);
base::Optional<pb::EncryptionMode> ToProtoEncryptionMode(
EncryptionScheme value);
} // namespace remoting } // namespace remoting
} // namespace media } // namespace media
......
This diff is collapsed.
...@@ -12,13 +12,8 @@ ...@@ -12,13 +12,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "media/base/audio_decoder_config.h" #include "media/base/audio_decoder_config.h"
#include "media/base/cdm_config.h"
#include "media/base/cdm_key_information.h"
#include "media/base/cdm_promise.h"
#include "media/base/content_decryption_module.h"
#include "media/base/decoder_buffer.h" #include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h" #include "media/base/demuxer_stream.h"
#include "media/base/eme_constants.h"
#include "media/base/pipeline_status.h" #include "media/base/pipeline_status.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
#include "media/remoting/media_remoting_rpc.pb.h" #include "media/remoting/media_remoting_rpc.pb.h"
...@@ -26,15 +21,13 @@ ...@@ -26,15 +21,13 @@
namespace media { namespace media {
namespace remoting { namespace remoting {
class CdmPromiseResult;
// Utility class to convert data between media::DecoderBuffer and byte array. // Utility class to convert data between media::DecoderBuffer and byte array.
// It is to serialize media::DecoderBuffer structure except for actual data // It is to serialize media::DecoderBuffer structure except for actual data
// into pb::DecoderBuffer followed by byte array of decoder buffer. The reason // into pb::DecoderBuffer followed by byte array of decoder buffer. The reason
// data is not part of proto buffer because it would cost unnecessary time to // data is not part of proto buffer because it would cost unnecessary time to
// wait for whole proto received before conversion given the fact that decoder // wait for whole proto received before conversion given the fact that decoder
// buffer data can vary from hundred bytes to 3~5MB. Also, it would costs extra // buffer data can vary from hundred bytes to 3~5MB. Also, it would costs extra
// CPU to sirealize/de-serialize decoder buffer which is encoded and encrypted // CPU to serialize/de-serialize decoder buffer which is encoded and encrypted
// as wire format for data transmission. // as wire format for data transmission.
// //
// DecoderBufferSegment { // DecoderBufferSegment {
...@@ -80,54 +73,6 @@ void ConvertProtoToPipelineStatistics( ...@@ -80,54 +73,6 @@ void ConvertProtoToPipelineStatistics(
const pb::PipelineStatistics& stats_message, const pb::PipelineStatistics& stats_message,
PipelineStatistics* stats); PipelineStatistics* stats);
// Data type conversion between media::CdmKeysInfo and proto buffer.
void ConvertCdmKeyInfoToProto(
const CdmKeysInfo& keys_information,
pb::CdmClientOnSessionKeysChange* key_change_message);
void ConvertProtoToCdmKeyInfo(
const pb::CdmClientOnSessionKeysChange keychange_message,
CdmKeysInfo* key_information);
// Data type conversion between CdmPromiseResult and proto buffer.
void ConvertCdmPromiseToProto(const CdmPromiseResult& result,
pb::CdmPromise* promise_message);
void ConvertCdmPromiseWithSessionIdToProto(const CdmPromiseResult& result,
const std::string& session_id,
pb::CdmPromise* promise_message);
void ConvertCdmPromiseWithCdmIdToProto(const CdmPromiseResult& result,
int cdm_id,
pb::CdmPromise* promise_message);
bool ConvertProtoToCdmPromise(const pb::CdmPromise& promise_message,
CdmPromiseResult* result);
bool ConvertProtoToCdmPromiseWithCdmIdSessionId(const pb::RpcMessage& message,
CdmPromiseResult* result,
int* cdm_id,
std::string* session_id);
//==================================================================
class CdmPromiseResult {
public:
CdmPromiseResult();
CdmPromiseResult(CdmPromise::Exception exception,
uint32_t system_code,
std::string error_message);
CdmPromiseResult(const CdmPromiseResult& other);
~CdmPromiseResult();
static CdmPromiseResult SuccessResult();
bool success() const { return success_; }
CdmPromise::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_;
CdmPromise::Exception exception_;
uint32_t system_code_;
std::string error_message_;
};
} // namespace remoting } // namespace remoting
} // namespace media } // namespace media
......
...@@ -12,13 +12,8 @@ ...@@ -12,13 +12,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "media/base/audio_decoder_config.h" #include "media/base/audio_decoder_config.h"
#include "media/base/cdm_config.h"
#include "media/base/cdm_key_information.h"
#include "media/base/content_decryption_module.h"
#include "media/base/decoder_buffer.h" #include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h" #include "media/base/demuxer_stream.h"
#include "media/base/eme_constants.h"
#include "media/base/encryption_pattern.h"
#include "media/base/encryption_scheme.h" #include "media/base/encryption_scheme.h"
#include "media/base/test_helpers.h" #include "media/base/test_helpers.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
...@@ -32,17 +27,6 @@ using testing::Return; ...@@ -32,17 +27,6 @@ using testing::Return;
namespace media { namespace media {
namespace remoting { namespace remoting {
namespace {
void VerifyCdmPromiseResultsEqual(const CdmPromiseResult& cdm1,
const CdmPromiseResult& cdm2) {
ASSERT_EQ(cdm1.success(), cdm2.success());
ASSERT_EQ(cdm1.exception(), cdm2.exception());
ASSERT_EQ(cdm1.system_code(), cdm2.system_code());
ASSERT_EQ(cdm1.error_message(), cdm2.error_message());
}
} // namespace
class ProtoUtilsTest : public testing::Test { class ProtoUtilsTest : public testing::Test {
protected: protected:
...@@ -113,12 +97,11 @@ TEST_F(ProtoUtilsTest, PassValidDecoderBuffer) { ...@@ -113,12 +97,11 @@ TEST_F(ProtoUtilsTest, PassValidDecoderBuffer) {
} }
TEST_F(ProtoUtilsTest, AudioDecoderConfigConversionTest) { TEST_F(ProtoUtilsTest, AudioDecoderConfigConversionTest) {
const std::string extra_data = "ACEG"; const char extra_data[4] = {'A', 'C', 'E', 'G'};
const EncryptionScheme encryption_scheme = EncryptionScheme::kCenc;
AudioDecoderConfig audio_config( AudioDecoderConfig audio_config(
kCodecAAC, kSampleFormatF32, CHANNEL_LAYOUT_MONO, 48000, kCodecAAC, kSampleFormatF32, CHANNEL_LAYOUT_MONO, 48000,
std::vector<uint8_t>(extra_data.begin(), extra_data.end()), std::vector<uint8_t>(std::begin(extra_data), std::end(extra_data)),
encryption_scheme); EncryptionScheme::kUnencrypted);
ASSERT_TRUE(audio_config.IsValidConfig()); ASSERT_TRUE(audio_config.IsValidConfig());
pb::AudioDecoderConfig audio_message; pb::AudioDecoderConfig audio_message;
...@@ -164,14 +147,10 @@ TEST_F(ProtoUtilsTest, PipelineStatisticsConversion) { ...@@ -164,14 +147,10 @@ TEST_F(ProtoUtilsTest, PipelineStatisticsConversion) {
pb_video_info->set_decoder_name(original.video_decoder_info.decoder_name); pb_video_info->set_decoder_name(original.video_decoder_info.decoder_name);
pb_video_info->set_is_platform_decoder( pb_video_info->set_is_platform_decoder(
original.video_decoder_info.is_platform_decoder); original.video_decoder_info.is_platform_decoder);
pb_video_info->set_has_decrypting_demuxer_stream(
original.video_decoder_info.has_decrypting_demuxer_stream);
pb_audio_info->set_decoder_name(original.audio_decoder_info.decoder_name); pb_audio_info->set_decoder_name(original.audio_decoder_info.decoder_name);
pb_audio_info->set_is_platform_decoder( pb_audio_info->set_is_platform_decoder(
original.audio_decoder_info.is_platform_decoder); original.audio_decoder_info.is_platform_decoder);
pb_audio_info->set_has_decrypting_demuxer_stream(
original.audio_decoder_info.has_decrypting_demuxer_stream);
PipelineStatistics converted; PipelineStatistics converted;
...@@ -201,71 +180,5 @@ TEST_F(ProtoUtilsTest, VideoDecoderConfigConversionTest) { ...@@ -201,71 +180,5 @@ TEST_F(ProtoUtilsTest, VideoDecoderConfigConversionTest) {
ASSERT_TRUE(converted.Matches(video_config)); ASSERT_TRUE(converted.Matches(video_config));
} }
TEST_F(ProtoUtilsTest, CdmPromiseResultConversion) {
CdmPromiseResult success_result = CdmPromiseResult::SuccessResult();
pb::CdmPromise promise_message;
ConvertCdmPromiseToProto(success_result, &promise_message);
CdmPromiseResult output_result;
ASSERT_TRUE(ConvertProtoToCdmPromise(promise_message, &output_result));
VerifyCdmPromiseResultsEqual(success_result, output_result);
}
TEST_F(ProtoUtilsTest, CdmPromiseResultWithCdmIdSessionIdConversion) {
const int kCdmId = 5;
const std::string kSessionId = "session3";
CdmPromiseResult success_result = CdmPromiseResult::SuccessResult();
pb::RpcMessage rpc;
rpc.set_handle(1);
pb::CdmPromise* promise_message = rpc.mutable_cdm_promise_rpc();
ConvertCdmPromiseWithSessionIdToProto(success_result, kSessionId,
promise_message);
CdmPromiseResult output_result;
std::string converted_session_id;
ASSERT_TRUE(ConvertProtoToCdmPromiseWithCdmIdSessionId(
rpc, &output_result, nullptr, &converted_session_id));
VerifyCdmPromiseResultsEqual(success_result, output_result);
ASSERT_EQ(converted_session_id, kSessionId);
ConvertCdmPromiseWithCdmIdToProto(success_result, kCdmId, promise_message);
int converted_cdm_id;
output_result = CdmPromiseResult();
ASSERT_TRUE(ConvertProtoToCdmPromiseWithCdmIdSessionId(
rpc, &output_result, &converted_cdm_id, nullptr));
VerifyCdmPromiseResultsEqual(success_result, output_result);
ASSERT_EQ(converted_cdm_id, kCdmId);
}
TEST_F(ProtoUtilsTest, CdmKeyInformationConversion) {
std::unique_ptr<CdmKeyInformation> cdm_key_info_1(new CdmKeyInformation(
"key_1", CdmKeyInformation::OUTPUT_RESTRICTED, 100));
std::unique_ptr<CdmKeyInformation> cdm_key_info_2(
new CdmKeyInformation("key_2", CdmKeyInformation::EXPIRED, 11));
std::unique_ptr<CdmKeyInformation> cdm_key_info_3(
new CdmKeyInformation("key_3", CdmKeyInformation::RELEASED, 22));
CdmKeysInfo keys_information;
keys_information.push_back(std::move(cdm_key_info_1));
keys_information.push_back(std::move(cdm_key_info_2));
keys_information.push_back(std::move(cdm_key_info_3));
pb::CdmClientOnSessionKeysChange key_message;
ConvertCdmKeyInfoToProto(keys_information, &key_message);
CdmKeysInfo key_output_information;
ConvertProtoToCdmKeyInfo(key_message, &key_output_information);
ASSERT_EQ(keys_information.size(), key_output_information.size());
for (uint32_t i = 0; i < 3; i++) {
ASSERT_EQ(keys_information[i]->key_id, key_output_information[i]->key_id);
ASSERT_EQ(keys_information[i]->status, key_output_information[i]->status);
ASSERT_EQ(keys_information[i]->system_code,
key_output_information[i]->system_code);
}
}
} // namespace remoting } // namespace remoting
} // namespace media } // namespace media
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
#include "media/remoting/receiver.h" #include "media/remoting/receiver.h"
#include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/notreached.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "media/base/bind_to_current_loop.h" #include "media/base/bind_to_current_loop.h"
...@@ -301,12 +304,9 @@ void Receiver::OnBufferingStateChange(BufferingState state, ...@@ -301,12 +304,9 @@ void Receiver::OnBufferingStateChange(BufferingState state,
SendRpcMessageOnMainThread(std::move(rpc)); SendRpcMessageOnMainThread(std::move(rpc));
} }
// TODO: Passes |reason| over.
void Receiver::OnWaiting(WaitingReason reason) { void Receiver::OnWaiting(WaitingReason reason) {
auto rpc = std::make_unique<pb::RpcMessage>(); // Media Remoting has not implemented this concept.
rpc->set_handle(remote_handle_); NOTIMPLEMENTED();
rpc->set_proc(pb::RpcMessage::RPC_RC_ONWAITINGFORDECRYPTIONKEY);
SendRpcMessageOnMainThread(std::move(rpc));
} }
void Receiver::OnAudioConfigChange(const AudioDecoderConfig& config) { void Receiver::OnAudioConfigChange(const AudioDecoderConfig& config) {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "media/remoting/receiver.h" #include "media/remoting/receiver.h"
#include <utility>
#include "base/check.h" #include "base/check.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/test/gmock_callback_support.h" #include "base/test/gmock_callback_support.h"
...@@ -138,9 +140,6 @@ class MockSender { ...@@ -138,9 +140,6 @@ class MockSender {
OnStatisticsUpdate(statistics); OnStatisticsUpdate(statistics);
break; break;
} }
case pb::RpcMessage::RPC_RC_ONWAITINGFORDECRYPTIONKEY:
OnWaiting();
break;
default: default:
VLOG(1) << "Unknown RPC: " << message->proc(); VLOG(1) << "Unknown RPC: " << message->proc();
...@@ -460,11 +459,6 @@ TEST_F(ReceiverTest, RendererClientInterface) { ...@@ -460,11 +459,6 @@ TEST_F(ReceiverTest, RendererClientInterface) {
EXPECT_CALL(*mock_sender_, OnStatisticsUpdate(statistics)).Times(1); EXPECT_CALL(*mock_sender_, OnStatisticsUpdate(statistics)).Times(1);
receiver_->OnStatisticsUpdate(statistics); receiver_->OnStatisticsUpdate(statistics);
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
// OnWaiting
EXPECT_CALL(*mock_sender_, OnWaiting()).Times(1);
receiver_->OnWaiting(WaitingReason::kNoDecryptionKey);
task_environment_.RunUntilIdle();
} }
} // namespace remoting } // namespace remoting
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "media/remoting/renderer_controller.h" #include "media/remoting/renderer_controller.h"
#include <memory> #include <memory>
#include <string>
#include "base/callback.h" #include "base/callback.h"
#include "base/run_loop.h" #include "base/run_loop.h"
...@@ -12,7 +13,6 @@ ...@@ -12,7 +13,6 @@
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/base/audio_decoder_config.h" #include "media/base/audio_decoder_config.h"
#include "media/base/cdm_config.h"
#include "media/base/limits.h" #include "media/base/limits.h"
#include "media/base/media_util.h" #include "media/base/media_util.h"
#include "media/base/test_helpers.h" #include "media/base/test_helpers.h"
...@@ -35,13 +35,12 @@ PipelineMetadata DefaultMetadata(VideoCodec codec) { ...@@ -35,13 +35,12 @@ PipelineMetadata DefaultMetadata(VideoCodec codec) {
return data; return data;
} }
const std::string kDefaultReceiver = "TestingChromeCast"; const char kDefaultReceiver[] = "TestingChromeCast";
mojom::RemotingSinkMetadata GetDefaultSinkMetadata(bool enable) { mojom::RemotingSinkMetadata GetDefaultSinkMetadata(bool enable) {
mojom::RemotingSinkMetadata metadata; mojom::RemotingSinkMetadata metadata;
if (enable) { if (enable) {
metadata.features.push_back(mojom::RemotingSinkFeature::RENDERING); metadata.features.push_back(mojom::RemotingSinkFeature::RENDERING);
metadata.features.push_back(mojom::RemotingSinkFeature::CONTENT_DECRYPTION);
} else { } else {
metadata.features.clear(); metadata.features.clear();
} }
...@@ -92,8 +91,6 @@ class RendererControllerTest : public ::testing::Test, ...@@ -92,8 +91,6 @@ class RendererControllerTest : public ::testing::Test,
is_remote_playback_compatible_ = is_compatible; is_remote_playback_compatible_ = is_compatible;
} }
void CreateCdm(bool is_remoting) { is_remoting_cdm_ = is_remoting; }
void InitializeControllerAndBecomeDominant( void InitializeControllerAndBecomeDominant(
const PipelineMetadata& pipeline_metadata, const PipelineMetadata& pipeline_metadata,
const mojom::RemotingSinkMetadata& sink_metadata) { const mojom::RemotingSinkMetadata& sink_metadata) {
...@@ -162,7 +159,6 @@ class RendererControllerTest : public ::testing::Test, ...@@ -162,7 +159,6 @@ class RendererControllerTest : public ::testing::Test,
protected: protected:
bool is_rendering_remotely_ = false; bool is_rendering_remotely_ = false;
bool is_remoting_cdm_ = false;
bool disable_pipeline_suspend_ = false; bool disable_pipeline_suspend_ = false;
bool is_remote_playback_compatible_ = false; bool is_remote_playback_compatible_ = false;
size_t decoded_bytes_ = 0; size_t decoded_bytes_ = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment