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

Side by Side Diff: media/webm/webm_stream_parser.cc

Issue 10910293: Add is_encrypted() in VideoDecoderConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/webm/webm_stream_parser.h" 5 #include "media/webm/webm_stream_parser.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 duration = base::TimeDelta::FromMicroseconds(duration_in_us); 345 duration = base::TimeDelta::FromMicroseconds(duration_in_us);
346 } 346 }
347 347
348 FFmpegConfigHelper config_helper; 348 FFmpegConfigHelper config_helper;
349 349
350 if (!config_helper.Parse(data, bytes_parsed)) { 350 if (!config_helper.Parse(data, bytes_parsed)) {
351 DVLOG(1) << "Failed to parse config data."; 351 DVLOG(1) << "Failed to parse config data.";
352 return -1; 352 return -1;
353 } 353 }
354 354
355 // TODO(xhwang): Support decryption of audio (see http://crbug.com/123421).
356 bool is_audio_encrypted = false;
357 bool is_video_encrypted = !tracks_parser.video_encryption_key_id().empty();
358
355 if (!config_cb_.Run(config_helper.audio_config(), 359 if (!config_cb_.Run(config_helper.audio_config(),
356 config_helper.video_config())) { 360 config_helper.video_config(),
361 is_audio_encrypted,
362 is_video_encrypted)) {
357 DVLOG(1) << "New config data isn't allowed."; 363 DVLOG(1) << "New config data isn't allowed.";
358 return -1; 364 return -1;
359 } 365 }
360 366
361 // TODO(xhwang): Support decryption of audio (see http://crbug.com/123421). 367 // TODO(xhwang): Support decryption of audio (see http://crbug.com/123421).
362 if (!tracks_parser.video_encryption_key_id().empty()) { 368 if (is_video_encrypted) {
363 std::string key_id = tracks_parser.video_encryption_key_id(); 369 std::string key_id = tracks_parser.video_encryption_key_id();
364 int key_id_size = key_id.size(); 370 int key_id_size = key_id.size();
365 CHECK_GT(key_id_size, 0); 371 CHECK_GT(key_id_size, 0);
366 CHECK_LT(key_id_size, 2048); 372 CHECK_LT(key_id_size, 2048);
367 scoped_array<uint8> key_id_array(new uint8[key_id_size]); 373 scoped_array<uint8> key_id_array(new uint8[key_id_size]);
368 memcpy(key_id_array.get(), key_id.data(), key_id_size); 374 memcpy(key_id_array.get(), key_id.data(), key_id_size);
369 need_key_cb_.Run(key_id_array.Pass(), key_id_size); 375 need_key_cb_.Run(key_id_array.Pass(), key_id_size);
370 } 376 }
371 377
372 cluster_parser_.reset(new WebMClusterParser( 378 cluster_parser_.reset(new WebMClusterParser(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 if (!video_buffers.empty() && !video_cb_.Run(video_buffers)) 440 if (!video_buffers.empty() && !video_cb_.Run(video_buffers))
435 return -1; 441 return -1;
436 442
437 if (cluster_ended) 443 if (cluster_ended)
438 end_of_segment_cb_.Run(); 444 end_of_segment_cb_.Run();
439 445
440 return bytes_parsed; 446 return bytes_parsed;
441 } 447 }
442 448
443 } // namespace media 449 } // namespace media
OLDNEW
« media/filters/chunk_demuxer.cc ('K') | « media/mp4/mp4_stream_parser_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698