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
3 // found in the LICENSE file.
5 #include "chromecast/media/cma/backend/media_clock_device.h"
7 #include "base/logging.h"
12 MediaClockDevice::MediaClockDevice() {
15 MediaClockDevice::~MediaClockDevice() {
19 bool MediaClockDevice::IsValidStateTransition(State state1
, State state2
) {
23 // All states can transition to |kStateError|.
24 bool is_transition_valid
= (state2
== kStateError
);
26 // All the other valid FSM transitions.
27 is_transition_valid
= is_transition_valid
||
28 (state1
== kStateUninitialized
&& (state2
== kStateIdle
)) ||
29 (state1
== kStateIdle
&& (state2
== kStateRunning
||
30 state2
== kStateUninitialized
)) ||
31 (state1
== kStateRunning
&& (state2
== kStateIdle
)) ||
32 (state1
== kStateError
&& (state2
== kStateUninitialized
));
34 return is_transition_valid
;
38 std::string
MediaClockDevice::StateToString(const State
& state
) {
40 case kStateUninitialized
:
41 return "Uninitialized";
49 NOTREACHED() << "Unknown MediaClockDevice::State: " << state
;
55 } // namespace chromecast