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

Side by Side Diff: chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.cc

Issue 659343003: Chromecast media pipeline: handle CENC "full sample encryption" case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: formatting Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.h" 5 #include "chromecast/media/cma/ipc_streamer/decoder_buffer_base_marshaller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chromecast/media/cma/base/decoder_buffer_base.h" 8 #include "chromecast/media/cma/base/decoder_buffer_base.h"
9 #include "chromecast/media/cma/ipc/media_message.h" 9 #include "chromecast/media/cma/ipc/media_message.h"
10 #include "chromecast/media/cma/ipc/media_message_type.h" 10 #include "chromecast/media/cma/ipc/media_message_type.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 CHECK(msg->WritePod(buffer->end_of_stream())); 134 CHECK(msg->WritePod(buffer->end_of_stream()));
135 if (buffer->end_of_stream()) 135 if (buffer->end_of_stream())
136 return; 136 return;
137 137
138 CHECK(msg->WritePod(buffer->timestamp().ToInternalValue())); 138 CHECK(msg->WritePod(buffer->timestamp().ToInternalValue()));
139 139
140 bool has_decrypt_config = 140 bool has_decrypt_config =
141 (buffer->decrypt_config() != NULL && 141 (buffer->decrypt_config() != NULL &&
142 buffer->decrypt_config()->iv().size() > 0); 142 buffer->decrypt_config()->iv().size() > 0);
143 CHECK(msg->WritePod(has_decrypt_config)); 143 CHECK(msg->WritePod(has_decrypt_config));
144 if (has_decrypt_config) 144
145 DecryptConfigMarshaller::Write(*buffer->decrypt_config(), msg); 145 if (has_decrypt_config) {
146 // DecryptConfig may contain 0 subsamples if all content is encrypted.
147 // Map this case to a single fully-encrypted "subsample" for more consistent
148 // backend handling.
149 if (buffer->decrypt_config()->subsamples().empty()) {
150 std::vector< ::media::SubsampleEntry> encrypted_subsample_list(1);
151 encrypted_subsample_list[0].clear_bytes = 0;
152 encrypted_subsample_list[0].cypher_bytes = buffer->data_size();
153 ::media::DecryptConfig full_sample_config(
154 buffer->decrypt_config()->key_id(),
155 buffer->decrypt_config()->iv(),
156 encrypted_subsample_list);
157 DecryptConfigMarshaller::Write(full_sample_config, msg);
158 } else {
159 DecryptConfigMarshaller::Write(*buffer->decrypt_config(), msg);
160 }
161 }
146 162
147 CHECK(msg->WritePod(buffer->data_size())); 163 CHECK(msg->WritePod(buffer->data_size()));
148 CHECK(msg->WriteBuffer(buffer->data(), buffer->data_size())); 164 CHECK(msg->WriteBuffer(buffer->data(), buffer->data_size()));
149 } 165 }
150 166
151 // static 167 // static
152 scoped_refptr<DecoderBufferBase> DecoderBufferBaseMarshaller::Read( 168 scoped_refptr<DecoderBufferBase> DecoderBufferBaseMarshaller::Read(
153 scoped_ptr<MediaMessage> msg) { 169 scoped_ptr<MediaMessage> msg) {
154 scoped_refptr<DecoderBufferFromMsg> buffer( 170 scoped_refptr<DecoderBufferFromMsg> buffer(
155 new DecoderBufferFromMsg(msg.Pass())); 171 new DecoderBufferFromMsg(msg.Pass()));
156 buffer->Initialize(); 172 buffer->Initialize();
157 return buffer; 173 return buffer;
158 } 174 }
159 175
160 } // namespace media 176 } // namespace media
161 } // namespace chromecast 177 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698