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

Unified Diff: media/mojo/services/media_type_converters.cc

Issue 833963003: Pass key_information on SessionKeysChange message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN changes Created 5 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: media/mojo/services/media_type_converters.cc
diff --git a/media/mojo/services/media_type_converters.cc b/media/mojo/services/media_type_converters.cc
index b037f98d991b0f420f58bf497820173506baedea..ccf5368c68d0807b3d8855f25e16205a7c7ad421 100644
--- a/media/mojo/services/media_type_converters.cc
+++ b/media/mojo/services/media_type_converters.cc
@@ -6,6 +6,7 @@
#include "media/base/audio_decoder_config.h"
#include "media/base/buffering_state.h"
+#include "media/base/cdm_key_information.h"
#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
#include "media/base/demuxer_stream.h"
@@ -233,6 +234,17 @@ ASSERT_CDM_EXCEPTION(OUTPUT_ERROR);
ASSERT_CDM_SESSION_TYPE(TEMPORARY_SESSION);
ASSERT_CDM_SESSION_TYPE(PERSISTENT_SESSION);
+// CDM Key Status
+#define ASSERT_CDM_KEY_STATUS(value) \
+ static_assert(media::CdmKeyInformation::value == \
+ static_cast<media::CdmKeyInformation::KeyStatus>( \
+ CDM_KEY_STATUS_##value), \
+ "Mismatched CDM Key Status")
+ASSERT_CDM_KEY_STATUS(USABLE);
+ASSERT_CDM_KEY_STATUS(INTERNAL_ERROR);
+ASSERT_CDM_KEY_STATUS(EXPIRED);
+ASSERT_CDM_KEY_STATUS(OUTPUT_NOT_ALLOWED);
+
// static
SubsampleEntryPtr
TypeConverter<SubsampleEntryPtr, media::SubsampleEntry>::Convert(
@@ -426,4 +438,28 @@ TypeConverter<media::VideoDecoderConfig, VideoDecoderConfigPtr>::Convert(
return config;
}
+// static
+CdmKeyInformationPtr
+TypeConverter<CdmKeyInformationPtr, media::CdmKeyInformation>::Convert(
+ const media::CdmKeyInformation& input) {
+ CdmKeyInformationPtr info(CdmKeyInformation::New());
+ std::vector<uint8_t> key_id_copy(input.KeyId());
+ info->key_id.Swap(&key_id_copy);
+ info->status = static_cast<CdmKeyStatus>(input.Status());
+ info->system_code = input.SystemCode();
+ return info.Pass();
+}
+
+// static
+media::CdmKeyInformation
xhwang 2015/01/02 21:55:08 If you use ScopedVector, you can return scoped_ptr
jrummell 2015/01/05 22:18:00 Done.
+TypeConverter<media::CdmKeyInformation, CdmKeyInformationPtr>::Convert(
+ const CdmKeyInformationPtr& input) {
+ media::CdmKeyInformation info(
+ input->key_id.size() ? &input->key_id.front() : NULL,
+ input->key_id.size(),
xhwang 2015/01/02 21:55:08 Since input->key_id is an array, you should be abl
jrummell 2015/01/05 22:18:00 Done.
+ static_cast<media::CdmKeyInformation::KeyStatus>(input->status),
+ input->system_code);
+ return info;
+}
+
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698