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 "content/common/gpu/media/omx_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 client_state_ == OMX_StatePause); | 468 client_state_ == OMX_StatePause); |
469 current_state_change_ = DESTROYING; | 469 current_state_change_ = DESTROYING; |
470 client_ = NULL; | 470 client_ = NULL; |
471 BeginTransitionToState(OMX_StateIdle); | 471 BeginTransitionToState(OMX_StateIdle); |
472 BusyLoopInDestroying(deleter.Pass()); | 472 BusyLoopInDestroying(deleter.Pass()); |
473 } | 473 } |
474 | 474 |
475 void OmxVideoDecodeAccelerator::BeginTransitionToState( | 475 void OmxVideoDecodeAccelerator::BeginTransitionToState( |
476 OMX_STATETYPE new_state) { | 476 OMX_STATETYPE new_state) { |
477 DCHECK_EQ(message_loop_, MessageLoop::current()); | 477 DCHECK_EQ(message_loop_, MessageLoop::current()); |
478 DCHECK_NE(current_state_change_, NO_TRANSITION); | 478 if (new_state != OMX_StateInvalid) |
479 DCHECK_NE(current_state_change_, ERRORING); | 479 DCHECK_NE(current_state_change_, NO_TRANSITION); |
Ami GONE FROM CHROMIUM
2012/07/25 22:41:15
I must have been on crack when I wrote this; the e
| |
480 if (current_state_change_ == NO_TRANSITION || | 480 if (current_state_change_ == ERRORING) |
481 current_state_change_ == ERRORING) { | |
482 return; | 481 return; |
483 } | |
484 OMX_ERRORTYPE result = OMX_SendCommand( | 482 OMX_ERRORTYPE result = OMX_SendCommand( |
485 component_handle_, OMX_CommandStateSet, new_state, 0); | 483 component_handle_, OMX_CommandStateSet, new_state, 0); |
486 RETURN_ON_OMX_FAILURE(result, "SendCommand(OMX_CommandStateSet) failed", | 484 RETURN_ON_OMX_FAILURE(result, "SendCommand(OMX_CommandStateSet) failed", |
487 PLATFORM_FAILURE,); | 485 PLATFORM_FAILURE,); |
488 } | 486 } |
489 | 487 |
490 void OmxVideoDecodeAccelerator::OnReachedIdleInInitializing() { | 488 void OmxVideoDecodeAccelerator::OnReachedIdleInInitializing() { |
491 DCHECK_EQ(client_state_, OMX_StateLoaded); | 489 DCHECK_EQ(client_state_, OMX_StateLoaded); |
492 client_state_ = OMX_StateIdle; | 490 client_state_ = OMX_StateIdle; |
493 // Query the resources with the component. | 491 // Query the resources with the component. |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 } | 951 } |
954 return; | 952 return; |
955 case OMX_EventError: | 953 case OMX_EventError: |
956 if (current_state_change_ != DESTROYING && | 954 if (current_state_change_ != DESTROYING && |
957 current_state_change_ != ERRORING) { | 955 current_state_change_ != ERRORING) { |
958 RETURN_ON_FAILURE(false, "EventError: 0x" << std::hex << data1, | 956 RETURN_ON_FAILURE(false, "EventError: 0x" << std::hex << data1, |
959 PLATFORM_FAILURE,); | 957 PLATFORM_FAILURE,); |
960 } | 958 } |
961 return; | 959 return; |
962 case OMX_EventPortSettingsChanged: | 960 case OMX_EventPortSettingsChanged: |
963 if (data2 == OMX_IndexParamPortDefinition) { | 961 if ((data2 == OMX_IndexParamPortDefinition) || // Tegra2/3 |
962 (data2 == 0)) { // Exynos SEC-OMX; http://crosbug.com/p/11665 | |
964 DCHECK_EQ(data1, output_port_); | 963 DCHECK_EQ(data1, output_port_); |
965 // This event is only used for output resize; kick off handling that by | 964 // This event is only used for output resize; kick off handling that by |
966 // pausing the output port. | 965 // pausing the output port. |
967 SendCommandToPort(OMX_CommandPortDisable, output_port_); | 966 SendCommandToPort(OMX_CommandPortDisable, output_port_); |
968 } else if (data1 == output_port_ && | 967 } else if (data1 == output_port_ && |
969 data2 == OMX_IndexConfigCommonOutputCrop) { | 968 data2 == OMX_IndexConfigCommonOutputCrop) { |
970 // TODO(vjain): Handle video crop rect. | 969 // TODO(vjain): Handle video crop rect. |
971 } else if (data1 == output_port_ && | 970 } else if (data1 == output_port_ && |
972 data2 == OMX_IndexConfigCommonScale) { | 971 data2 == OMX_IndexConfigCommonScale) { |
973 // TODO(ashokm@nvidia.com): Handle video SAR change. | 972 // TODO(ashokm@nvidia.com): Handle video SAR change. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1063 | 1062 |
1064 bool OmxVideoDecodeAccelerator::SendCommandToPort( | 1063 bool OmxVideoDecodeAccelerator::SendCommandToPort( |
1065 OMX_COMMANDTYPE cmd, int port_index) { | 1064 OMX_COMMANDTYPE cmd, int port_index) { |
1066 DCHECK_EQ(message_loop_, MessageLoop::current()); | 1065 DCHECK_EQ(message_loop_, MessageLoop::current()); |
1067 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, | 1066 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, |
1068 cmd, port_index, 0); | 1067 cmd, port_index, 0); |
1069 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, | 1068 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, |
1070 PLATFORM_FAILURE, false); | 1069 PLATFORM_FAILURE, false); |
1071 return true; | 1070 return true; |
1072 } | 1071 } |
OLD | NEW |