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

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 225903006: PPAPI: Run clang_format.py on content/renderer/pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 8 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 "content/renderer/pepper/content_decryptor_delegate.h" 5 #include "content/renderer/pepper/content_decryptor_delegate.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 25 matching lines...) Expand all
36 36
37 namespace content { 37 namespace content {
38 38
39 namespace { 39 namespace {
40 40
41 // Fills |resource| with a PPB_Buffer_Impl and copies |data| into the buffer 41 // Fills |resource| with a PPB_Buffer_Impl and copies |data| into the buffer
42 // resource. The |*resource|, if valid, will be in the ResourceTracker with a 42 // resource. The |*resource|, if valid, will be in the ResourceTracker with a
43 // reference-count of 0. If |data| is NULL, sets |*resource| to NULL. Returns 43 // reference-count of 0. If |data| is NULL, sets |*resource| to NULL. Returns
44 // true upon success and false if any error happened. 44 // true upon success and false if any error happened.
45 bool MakeBufferResource(PP_Instance instance, 45 bool MakeBufferResource(PP_Instance instance,
46 const uint8* data, uint32_t size, 46 const uint8* data,
47 uint32_t size,
47 scoped_refptr<PPB_Buffer_Impl>* resource) { 48 scoped_refptr<PPB_Buffer_Impl>* resource) {
48 TRACE_EVENT0("media", "ContentDecryptorDelegate - MakeBufferResource"); 49 TRACE_EVENT0("media", "ContentDecryptorDelegate - MakeBufferResource");
49 DCHECK(resource); 50 DCHECK(resource);
50 51
51 if (!data || !size) { 52 if (!data || !size) {
52 DCHECK(!data && !size); 53 DCHECK(!data && !size);
53 resource = NULL; 54 resource = NULL;
54 return true; 55 return true;
55 } 56 }
56 57
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 case Decryptor::kVideo: 362 case Decryptor::kVideo:
362 video_decrypt_cb_.Set(request_id, decrypt_cb); 363 video_decrypt_cb_.Set(request_id, decrypt_cb);
363 break; 364 break;
364 default: 365 default:
365 NOTREACHED(); 366 NOTREACHED();
366 return false; 367 return false;
367 } 368 }
368 369
369 SetBufferToFreeInTrackingInfo(&block_info.tracking_info); 370 SetBufferToFreeInTrackingInfo(&block_info.tracking_info);
370 371
371 plugin_decryption_interface_->Decrypt(pp_instance_, 372 plugin_decryption_interface_->Decrypt(pp_instance_, pp_resource, &block_info);
372 pp_resource,
373 &block_info);
374 return true; 373 return true;
375 } 374 }
376 375
377 bool ContentDecryptorDelegate::CancelDecrypt( 376 bool ContentDecryptorDelegate::CancelDecrypt(
378 Decryptor::StreamType stream_type) { 377 Decryptor::StreamType stream_type) {
379 DVLOG(3) << "CancelDecrypt() - stream_type: " << stream_type; 378 DVLOG(3) << "CancelDecrypt() - stream_type: " << stream_type;
380 379
381 Decryptor::DecryptCB decrypt_cb; 380 Decryptor::DecryptCB decrypt_cb;
382 switch (stream_type) { 381 switch (stream_type) {
383 case Decryptor::kAudio: 382 case Decryptor::kAudio:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 scoped_refptr<PPB_Buffer_Impl> extra_data_resource; 423 scoped_refptr<PPB_Buffer_Impl> extra_data_resource;
425 if (!MakeBufferResource(pp_instance_, 424 if (!MakeBufferResource(pp_instance_,
426 decoder_config.extra_data(), 425 decoder_config.extra_data(),
427 decoder_config.extra_data_size(), 426 decoder_config.extra_data_size(),
428 &extra_data_resource)) { 427 &extra_data_resource)) {
429 return false; 428 return false;
430 } 429 }
431 ScopedPPResource pp_resource(extra_data_resource.get()); 430 ScopedPPResource pp_resource(extra_data_resource.get());
432 431
433 audio_decoder_init_cb_.Set(pp_decoder_config.request_id, init_cb); 432 audio_decoder_init_cb_.Set(pp_decoder_config.request_id, init_cb);
434 plugin_decryption_interface_->InitializeAudioDecoder(pp_instance_, 433 plugin_decryption_interface_->InitializeAudioDecoder(
435 &pp_decoder_config, 434 pp_instance_, &pp_decoder_config, pp_resource);
436 pp_resource);
437 return true; 435 return true;
438 } 436 }
439 437
440 bool ContentDecryptorDelegate::InitializeVideoDecoder( 438 bool ContentDecryptorDelegate::InitializeVideoDecoder(
441 const media::VideoDecoderConfig& decoder_config, 439 const media::VideoDecoderConfig& decoder_config,
442 const Decryptor::DecoderInitCB& init_cb) { 440 const Decryptor::DecoderInitCB& init_cb) {
443 PP_VideoDecoderConfig pp_decoder_config; 441 PP_VideoDecoderConfig pp_decoder_config;
444 pp_decoder_config.codec = 442 pp_decoder_config.codec =
445 MediaVideoCodecToPpVideoCodec(decoder_config.codec()); 443 MediaVideoCodecToPpVideoCodec(decoder_config.codec());
446 pp_decoder_config.profile = 444 pp_decoder_config.profile =
447 MediaVideoCodecProfileToPpVideoCodecProfile(decoder_config.profile()); 445 MediaVideoCodecProfileToPpVideoCodecProfile(decoder_config.profile());
448 pp_decoder_config.format = 446 pp_decoder_config.format =
449 MediaVideoFormatToPpDecryptedFrameFormat(decoder_config.format()); 447 MediaVideoFormatToPpDecryptedFrameFormat(decoder_config.format());
450 pp_decoder_config.width = decoder_config.coded_size().width(); 448 pp_decoder_config.width = decoder_config.coded_size().width();
451 pp_decoder_config.height = decoder_config.coded_size().height(); 449 pp_decoder_config.height = decoder_config.coded_size().height();
452 pp_decoder_config.request_id = next_decryption_request_id_++; 450 pp_decoder_config.request_id = next_decryption_request_id_++;
453 451
454 scoped_refptr<PPB_Buffer_Impl> extra_data_resource; 452 scoped_refptr<PPB_Buffer_Impl> extra_data_resource;
455 if (!MakeBufferResource(pp_instance_, 453 if (!MakeBufferResource(pp_instance_,
456 decoder_config.extra_data(), 454 decoder_config.extra_data(),
457 decoder_config.extra_data_size(), 455 decoder_config.extra_data_size(),
458 &extra_data_resource)) { 456 &extra_data_resource)) {
459 return false; 457 return false;
460 } 458 }
461 ScopedPPResource pp_resource(extra_data_resource.get()); 459 ScopedPPResource pp_resource(extra_data_resource.get());
462 460
463 video_decoder_init_cb_.Set(pp_decoder_config.request_id, init_cb); 461 video_decoder_init_cb_.Set(pp_decoder_config.request_id, init_cb);
464 natural_size_ = decoder_config.natural_size(); 462 natural_size_ = decoder_config.natural_size();
465 463
466 plugin_decryption_interface_->InitializeVideoDecoder(pp_instance_, 464 plugin_decryption_interface_->InitializeVideoDecoder(
467 &pp_decoder_config, 465 pp_instance_, &pp_decoder_config, pp_resource);
468 pp_resource);
469 return true; 466 return true;
470 } 467 }
471 468
472 bool ContentDecryptorDelegate::DeinitializeDecoder( 469 bool ContentDecryptorDelegate::DeinitializeDecoder(
473 Decryptor::StreamType stream_type) { 470 Decryptor::StreamType stream_type) {
474 CancelDecode(stream_type); 471 CancelDecode(stream_type);
475 472
476 if (stream_type == Decryptor::kVideo) 473 if (stream_type == Decryptor::kVideo)
477 natural_size_ = gfx::Size(); 474 natural_size_ = gfx::Size();
478 475
(...skipping 14 matching lines...) Expand all
493 } 490 }
494 491
495 bool ContentDecryptorDelegate::DecryptAndDecodeAudio( 492 bool ContentDecryptorDelegate::DecryptAndDecodeAudio(
496 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 493 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
497 const Decryptor::AudioDecodeCB& audio_decode_cb) { 494 const Decryptor::AudioDecodeCB& audio_decode_cb) {
498 // |audio_input_resource_| is not being used by the plugin now 495 // |audio_input_resource_| is not being used by the plugin now
499 // because there is only one pending audio decode request at any time. 496 // because there is only one pending audio decode request at any time.
500 // This is enforced by the media pipeline. 497 // This is enforced by the media pipeline.
501 scoped_refptr<PPB_Buffer_Impl> encrypted_resource; 498 scoped_refptr<PPB_Buffer_Impl> encrypted_resource;
502 if (!MakeMediaBufferResource( 499 if (!MakeMediaBufferResource(
503 Decryptor::kAudio, encrypted_buffer, &encrypted_resource)) { 500 Decryptor::kAudio, encrypted_buffer, &encrypted_resource)) {
504 return false; 501 return false;
505 } 502 }
506 503
507 // The resource should not be NULL for non-EOS buffer. 504 // The resource should not be NULL for non-EOS buffer.
508 if (!encrypted_buffer->end_of_stream() && !encrypted_resource.get()) 505 if (!encrypted_buffer->end_of_stream() && !encrypted_resource.get())
509 return false; 506 return false;
510 507
511 const uint32_t request_id = next_decryption_request_id_++; 508 const uint32_t request_id = next_decryption_request_id_++;
512 DVLOG(2) << "DecryptAndDecodeAudio() - request_id " << request_id; 509 DVLOG(2) << "DecryptAndDecodeAudio() - request_id " << request_id;
513 510
514 PP_EncryptedBlockInfo block_info = {}; 511 PP_EncryptedBlockInfo block_info = {};
515 if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) { 512 if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) {
516 return false; 513 return false;
517 } 514 }
518 515
519 SetBufferToFreeInTrackingInfo(&block_info.tracking_info); 516 SetBufferToFreeInTrackingInfo(&block_info.tracking_info);
520 517
521 // There is only one pending audio decode request at any time. This is 518 // There is only one pending audio decode request at any time. This is
522 // enforced by the media pipeline. If this DCHECK is violated, our buffer 519 // enforced by the media pipeline. If this DCHECK is violated, our buffer
523 // reuse policy is not valid, and we may have race problems for the shared 520 // reuse policy is not valid, and we may have race problems for the shared
524 // buffer. 521 // buffer.
525 audio_decode_cb_.Set(request_id, audio_decode_cb); 522 audio_decode_cb_.Set(request_id, audio_decode_cb);
526 523
527 ScopedPPResource pp_resource(encrypted_resource.get()); 524 ScopedPPResource pp_resource(encrypted_resource.get());
528 plugin_decryption_interface_->DecryptAndDecode(pp_instance_, 525 plugin_decryption_interface_->DecryptAndDecode(
529 PP_DECRYPTORSTREAMTYPE_AUDIO, 526 pp_instance_, PP_DECRYPTORSTREAMTYPE_AUDIO, pp_resource, &block_info);
530 pp_resource,
531 &block_info);
532 return true; 527 return true;
533 } 528 }
534 529
535 bool ContentDecryptorDelegate::DecryptAndDecodeVideo( 530 bool ContentDecryptorDelegate::DecryptAndDecodeVideo(
536 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, 531 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
537 const Decryptor::VideoDecodeCB& video_decode_cb) { 532 const Decryptor::VideoDecodeCB& video_decode_cb) {
538 // |video_input_resource_| is not being used by the plugin now 533 // |video_input_resource_| is not being used by the plugin now
539 // because there is only one pending video decode request at any time. 534 // because there is only one pending video decode request at any time.
540 // This is enforced by the media pipeline. 535 // This is enforced by the media pipeline.
541 scoped_refptr<PPB_Buffer_Impl> encrypted_resource; 536 scoped_refptr<PPB_Buffer_Impl> encrypted_resource;
542 if (!MakeMediaBufferResource( 537 if (!MakeMediaBufferResource(
543 Decryptor::kVideo, encrypted_buffer, &encrypted_resource)) { 538 Decryptor::kVideo, encrypted_buffer, &encrypted_resource)) {
544 return false; 539 return false;
545 } 540 }
546 541
547 // The resource should not be 0 for non-EOS buffer. 542 // The resource should not be 0 for non-EOS buffer.
548 if (!encrypted_buffer->end_of_stream() && !encrypted_resource.get()) 543 if (!encrypted_buffer->end_of_stream() && !encrypted_resource.get())
549 return false; 544 return false;
550 545
551 const uint32_t request_id = next_decryption_request_id_++; 546 const uint32_t request_id = next_decryption_request_id_++;
552 DVLOG(2) << "DecryptAndDecodeVideo() - request_id " << request_id; 547 DVLOG(2) << "DecryptAndDecodeVideo() - request_id " << request_id;
553 TRACE_EVENT_ASYNC_BEGIN0( 548 TRACE_EVENT_ASYNC_BEGIN0(
554 "media", "ContentDecryptorDelegate::DecryptAndDecodeVideo", request_id); 549 "media", "ContentDecryptorDelegate::DecryptAndDecodeVideo", request_id);
555 550
556 PP_EncryptedBlockInfo block_info = {}; 551 PP_EncryptedBlockInfo block_info = {};
557 if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) { 552 if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) {
558 return false; 553 return false;
559 } 554 }
560 555
561 SetBufferToFreeInTrackingInfo(&block_info.tracking_info); 556 SetBufferToFreeInTrackingInfo(&block_info.tracking_info);
562 557
563 // Only one pending video decode request at any time. This is enforced by the 558 // Only one pending video decode request at any time. This is enforced by the
564 // media pipeline. If this DCHECK is violated, our buffer 559 // media pipeline. If this DCHECK is violated, our buffer
565 // reuse policy is not valid, and we may have race problems for the shared 560 // reuse policy is not valid, and we may have race problems for the shared
566 // buffer. 561 // buffer.
567 video_decode_cb_.Set(request_id, video_decode_cb); 562 video_decode_cb_.Set(request_id, video_decode_cb);
568 563
569 // TODO(tomfinegan): Need to get stream type from media stack. 564 // TODO(tomfinegan): Need to get stream type from media stack.
570 ScopedPPResource pp_resource(encrypted_resource.get()); 565 ScopedPPResource pp_resource(encrypted_resource.get());
571 plugin_decryption_interface_->DecryptAndDecode(pp_instance_, 566 plugin_decryption_interface_->DecryptAndDecode(
572 PP_DECRYPTORSTREAMTYPE_VIDEO, 567 pp_instance_, PP_DECRYPTORSTREAMTYPE_VIDEO, pp_resource, &block_info);
573 pp_resource,
574 &block_info);
575 return true; 568 return true;
576 } 569 }
577 570
578 void ContentDecryptorDelegate::OnSessionCreated(uint32 session_id, 571 void ContentDecryptorDelegate::OnSessionCreated(uint32 session_id,
579 PP_Var web_session_id_var) { 572 PP_Var web_session_id_var) {
580 if (session_created_cb_.is_null()) 573 if (session_created_cb_.is_null())
581 return; 574 return;
582 575
583 StringVar* session_id_string = StringVar::FromPPVar(web_session_id_var); 576 StringVar* session_id_string = StringVar::FromPPVar(web_session_id_var);
584 577
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 uint32_t system_code) { 626 uint32_t system_code) {
634 if (session_error_cb_.is_null()) 627 if (session_error_cb_.is_null())
635 return; 628 return;
636 629
637 session_error_cb_.Run(session_id, 630 session_error_cb_.Run(session_id,
638 static_cast<media::MediaKeys::KeyError>(media_error), 631 static_cast<media::MediaKeys::KeyError>(media_error),
639 system_code); 632 system_code);
640 } 633 }
641 634
642 void ContentDecryptorDelegate::DecoderInitializeDone( 635 void ContentDecryptorDelegate::DecoderInitializeDone(
643 PP_DecryptorStreamType decoder_type, 636 PP_DecryptorStreamType decoder_type,
644 uint32_t request_id, 637 uint32_t request_id,
645 PP_Bool success) { 638 PP_Bool success) {
646 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) { 639 if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) {
647 // If the request ID is not valid or does not match what's saved, do 640 // If the request ID is not valid or does not match what's saved, do
648 // nothing. 641 // nothing.
649 if (request_id == 0 || !audio_decoder_init_cb_.Matches(request_id)) 642 if (request_id == 0 || !audio_decoder_init_cb_.Matches(request_id))
650 return; 643 return;
651 644
652 audio_decoder_init_cb_.ResetAndReturn().Run(PP_ToBool(success)); 645 audio_decoder_init_cb_.ResetAndReturn().Run(PP_ToBool(success));
653 } else { 646 } else {
654 if (request_id == 0 || !video_decoder_init_cb_.Matches(request_id)) 647 if (request_id == 0 || !video_decoder_init_cb_.Matches(request_id))
655 return; 648 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 BufferAutoMapper mapper(enter.object()); 707 BufferAutoMapper mapper(enter.object());
715 if (!mapper.data() || !mapper.size() || 708 if (!mapper.data() || !mapper.size() ||
716 mapper.size() < block_info->data_size) { 709 mapper.size() < block_info->data_size) {
717 decrypt_cb.Run(Decryptor::kError, NULL); 710 decrypt_cb.Run(Decryptor::kError, NULL);
718 return; 711 return;
719 } 712 }
720 713
721 // TODO(tomfinegan): Find a way to take ownership of the shared memory 714 // TODO(tomfinegan): Find a way to take ownership of the shared memory
722 // managed by the PPB_Buffer_Dev, and avoid the extra copy. 715 // managed by the PPB_Buffer_Dev, and avoid the extra copy.
723 scoped_refptr<media::DecoderBuffer> decrypted_buffer( 716 scoped_refptr<media::DecoderBuffer> decrypted_buffer(
724 media::DecoderBuffer::CopyFrom( 717 media::DecoderBuffer::CopyFrom(static_cast<uint8*>(mapper.data()),
725 static_cast<uint8*>(mapper.data()), block_info->data_size)); 718 block_info->data_size));
726 decrypted_buffer->set_timestamp(base::TimeDelta::FromMicroseconds( 719 decrypted_buffer->set_timestamp(
727 block_info->tracking_info.timestamp)); 720 base::TimeDelta::FromMicroseconds(block_info->tracking_info.timestamp));
728 decrypt_cb.Run(Decryptor::kSuccess, decrypted_buffer); 721 decrypt_cb.Run(Decryptor::kSuccess, decrypted_buffer);
729 } 722 }
730 723
731 // Use a non-class-member function here so that if for some reason 724 // Use a non-class-member function here so that if for some reason
732 // ContentDecryptorDelegate is destroyed before VideoFrame calls this callback, 725 // ContentDecryptorDelegate is destroyed before VideoFrame calls this callback,
733 // we can still get the shared memory unmapped. 726 // we can still get the shared memory unmapped.
734 static void BufferNoLongerNeeded( 727 static void BufferNoLongerNeeded(
735 const scoped_refptr<PPB_Buffer_Impl>& ppb_buffer, 728 const scoped_refptr<PPB_Buffer_Impl>& ppb_buffer,
736 base::Closure buffer_no_longer_needed_cb) { 729 base::Closure buffer_no_longer_needed_cb) {
737 ppb_buffer->Unmap(); 730 ppb_buffer->Unmap();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 const uint32_t kMinimumMediaBufferSize = 1024; 915 const uint32_t kMinimumMediaBufferSize = 1024;
923 uint32_t media_resource_size = 916 uint32_t media_resource_size =
924 media_resource.get() ? media_resource->size() : kMinimumMediaBufferSize; 917 media_resource.get() ? media_resource->size() : kMinimumMediaBufferSize;
925 while (media_resource_size < data_size) 918 while (media_resource_size < data_size)
926 media_resource_size *= 2; 919 media_resource_size *= 2;
927 920
928 DVLOG(2) << "Size of media buffer for " 921 DVLOG(2) << "Size of media buffer for "
929 << ((stream_type == Decryptor::kAudio) ? "audio" : "video") 922 << ((stream_type == Decryptor::kAudio) ? "audio" : "video")
930 << " stream bumped to " << media_resource_size 923 << " stream bumped to " << media_resource_size
931 << " bytes to fit input."; 924 << " bytes to fit input.";
932 media_resource = PPB_Buffer_Impl::CreateResource(pp_instance_, 925 media_resource =
933 media_resource_size); 926 PPB_Buffer_Impl::CreateResource(pp_instance_, media_resource_size);
934 if (!media_resource.get()) 927 if (!media_resource.get())
935 return false; 928 return false;
936 } 929 }
937 930
938 BufferAutoMapper mapper(media_resource.get()); 931 BufferAutoMapper mapper(media_resource.get());
939 if (!mapper.data() || mapper.size() < data_size) { 932 if (!mapper.data() || mapper.size() < data_size) {
940 media_resource = NULL; 933 media_resource = NULL;
941 return false; 934 return false;
942 } 935 }
943 memcpy(mapper.data(), encrypted_buffer->data(), data_size); 936 memcpy(mapper.data(), encrypted_buffer->data(), data_size);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 const uint8* cur = static_cast<uint8*>(mapper.data()); 976 const uint8* cur = static_cast<uint8*>(mapper.data());
984 size_t bytes_left = data_size; 977 size_t bytes_left = data_size;
985 978
986 const int audio_bytes_per_frame = 979 const int audio_bytes_per_frame =
987 media::SampleFormatToBytesPerChannel(sample_format) * 980 media::SampleFormatToBytesPerChannel(sample_format) *
988 audio_channel_count_; 981 audio_channel_count_;
989 if (audio_bytes_per_frame <= 0) 982 if (audio_bytes_per_frame <= 0)
990 return false; 983 return false;
991 984
992 // Allocate space for the channel pointers given to AudioBuffer. 985 // Allocate space for the channel pointers given to AudioBuffer.
993 std::vector<const uint8*> channel_ptrs( 986 std::vector<const uint8*> channel_ptrs(audio_channel_count_,
994 audio_channel_count_, static_cast<const uint8*>(NULL)); 987 static_cast<const uint8*>(NULL));
995 do { 988 do {
996 int64 timestamp = 0; 989 int64 timestamp = 0;
997 int64 frame_size = -1; 990 int64 frame_size = -1;
998 const size_t kHeaderSize = sizeof(timestamp) + sizeof(frame_size); 991 const size_t kHeaderSize = sizeof(timestamp) + sizeof(frame_size);
999 992
1000 if (bytes_left < kHeaderSize) 993 if (bytes_left < kHeaderSize)
1001 return false; 994 return false;
1002 995
1003 memcpy(&timestamp, cur, sizeof(timestamp)); 996 memcpy(&timestamp, cur, sizeof(timestamp));
1004 cur += sizeof(timestamp); 997 cur += sizeof(timestamp);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 const media::Decryptor::AudioBuffers empty_frames; 1053 const media::Decryptor::AudioBuffers empty_frames;
1061 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, 1054 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError,
1062 empty_frames); 1055 empty_frames);
1063 } 1056 }
1064 1057
1065 if (!video_decode_cb_.is_null()) 1058 if (!video_decode_cb_.is_null())
1066 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); 1059 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL);
1067 } 1060 }
1068 1061
1069 } // namespace content 1062 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/common.h ('k') | content/renderer/pepper/content_renderer_pepper_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698