Accurate indoor pedestrian positioning has attracted extensive research attention along with the rising popularity of indoor location-based service. Among the indoor positioning methods, pedestrian dead reckoning (PDR) stands out for requiring neither expensive infrastructure nor laborious site survey. However, with time going on, the PDR method suffers from error accumulation problem, whereas the major cause of positioning error is usually heading deviation. To tackle the error-drifting problem, a real-time indoor PDR system using inertial sensors and the frequency-modulated radio receiver is designed in this paper. First, a random forest classifier combining frequency-modulated radio signal and inertial sensor signal is devised to achieve real-time identification of straight-line and turning mode of moving. Based on the classification result, the constraint is applied to headings in straight periods and true headings are extracted from accelerometer and magnetometer measurements to reduce heading deviation in straight periods. Field experiments have been conducted at three sites in two office buildings to evaluate the performance of the proposed system. The experimental results indicate error drifting can be effectively constrained by the proposed PDR system.