OLD | NEW |
---|---|
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 make_context_current_(make_context_current), | 60 make_context_current_(make_context_current), |
61 state_(kUninitialized), | 61 state_(kUninitialized), |
62 input_ready_(&lock_), | 62 input_ready_(&lock_), |
63 output_ready_(&lock_), | 63 output_ready_(&lock_), |
64 message_loop_(MessageLoop::current()), | 64 message_loop_(MessageLoop::current()), |
65 weak_this_(base::AsWeakPtr(this)), | 65 weak_this_(base::AsWeakPtr(this)), |
66 client_ptr_factory_(client), | 66 client_ptr_factory_(client), |
67 client_(client_ptr_factory_.GetWeakPtr()), | 67 client_(client_ptr_factory_.GetWeakPtr()), |
68 decoder_thread_("VaapiDecoderThread") { | 68 decoder_thread_("VaapiDecoderThread") { |
69 DCHECK(client); | 69 DCHECK(client); |
70 static bool vaapi_functions_initialized = PostSandboxInitialization(); | |
piman
2012/08/04 01:02:24
nit: Do you want to use pre_sandbox_init_done_ ins
Ami GONE FROM CHROMIUM
2012/08/04 01:44:42
Removed (was vestigial).
| |
71 RETURN_AND_NOTIFY_ON_FAILURE(vaapi_functions_initialized, | |
72 "Failed to initialize VAAPI libs", | |
73 PLATFORM_FAILURE, ); | |
70 } | 74 } |
71 | 75 |
72 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { | 76 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { |
73 DCHECK_EQ(message_loop_, MessageLoop::current()); | 77 DCHECK_EQ(message_loop_, MessageLoop::current()); |
74 } | 78 } |
75 | 79 |
76 bool VaapiVideoDecodeAccelerator::Initialize( | 80 bool VaapiVideoDecodeAccelerator::Initialize( |
77 media::VideoCodecProfile profile) { | 81 media::VideoCodecProfile profile) { |
78 DCHECK_EQ(message_loop_, MessageLoop::current()); | 82 DCHECK_EQ(message_loop_, MessageLoop::current()); |
79 | 83 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 decoder_.Destroy(); | 534 decoder_.Destroy(); |
531 state_ = kUninitialized; | 535 state_ = kUninitialized; |
532 } | 536 } |
533 | 537 |
534 void VaapiVideoDecodeAccelerator::Destroy() { | 538 void VaapiVideoDecodeAccelerator::Destroy() { |
535 DCHECK_EQ(message_loop_, MessageLoop::current()); | 539 DCHECK_EQ(message_loop_, MessageLoop::current()); |
536 Cleanup(); | 540 Cleanup(); |
537 delete this; | 541 delete this; |
538 } | 542 } |
539 | 543 |
544 // static | |
545 void VaapiVideoDecodeAccelerator::PreSandboxInitialization() { | |
546 VaapiH264Decoder::PreSandboxInitialization(); | |
547 } | |
548 | |
549 // static | |
550 bool VaapiVideoDecodeAccelerator::PostSandboxInitialization() { | |
551 return VaapiH264Decoder::PostSandboxInitialization(); | |
552 } | |
553 | |
540 void VaapiVideoDecodeAccelerator::OutputPicCallback(int32 input_id, | 554 void VaapiVideoDecodeAccelerator::OutputPicCallback(int32 input_id, |
541 int32 output_id) { | 555 int32 output_id) { |
542 TRACE_EVENT2("Video Decoder", "VAVDA::OutputPicCallback", | 556 TRACE_EVENT2("Video Decoder", "VAVDA::OutputPicCallback", |
543 "Input id", input_id, "Picture id", output_id); | 557 "Input id", input_id, "Picture id", output_id); |
544 DVLOG(4) << "Outputting picture, input id: " << input_id | 558 DVLOG(4) << "Outputting picture, input id: " << input_id |
545 << " output id: " << output_id; | 559 << " output id: " << output_id; |
546 | 560 |
547 // Forward the request to the main thread. | 561 // Forward the request to the main thread. |
548 DCHECK_EQ(decoder_thread_.message_loop(), MessageLoop::current()); | 562 DCHECK_EQ(decoder_thread_.message_loop(), MessageLoop::current()); |
549 message_loop_->PostTask(FROM_HERE, base::Bind( | 563 message_loop_->PostTask(FROM_HERE, base::Bind( |
550 &VaapiVideoDecodeAccelerator::SyncAndNotifyPictureReady, weak_this_, | 564 &VaapiVideoDecodeAccelerator::SyncAndNotifyPictureReady, weak_this_, |
551 input_id, output_id)); | 565 input_id, output_id)); |
552 } | 566 } |
OLD | NEW |