| Previous | Next |
| NS_S_CALLABORTED | NS_S_REBUFFERING |
NS_S_STREAM_TRUNCATED
Windows Media stream ended intentionally before completion
NS_S_STREAM_TRUNCATED is HRESULT 851970 (0x000D0002) from Windows Media. AllStat describes it as “The stream was purposefully stopped before completion.” The severity bit indicates a nonfailure result, but the value carries a specific condition that must not be collapsed into plain S_OK.
In the legacy Windows Media pipeline or Player state, this result means that the stream was purposefully stopped before completion. Before reporting completion for it, the caller must reconcile the code-specific state transition and every usable output.
Where the status is encountered
- Windows Media source, reader, writer, or renderer callbacks; log the exact method and object state instead of interpreting the constant outside that contract.
- Windows Media Player SDK automation; log the exact method and object state instead of interpreting the constant outside that contract.
- Media graph, playlist, image, rights, or buffering state; log the exact method and object state instead of interpreting the constant outside that contract.
Because it is informational, a language binding may expose it as success and hide the symbolic distinction. Keep the original HRESULT available until the code-specific branch has run.
What must be true before accepting it
Verify that the shorter stream is expected and downstream components know the final timestamp and completeness state. Without that proof, it can mask a caller error even though HRESULT failure severity is not set.
Reconcile side effects associated with it before compensation or a second invocation is attempted.
Evidence and telemetry
- preserve planned and actual duration.
- preserve last sample timestamp.
- preserve stop initiator.
- preserve container finalization result.
- preserve complete versus truncated asset flag.
Also record ns_s_stream_truncated_operation, ns_s_stream_truncated_state_before, ns_s_stream_truncated_state_after, UTC time, process and thread identifiers, component version, and a correlation ID. Telemetry for it should omit credentials while retaining nonsecret object identities and version data.
Correct handling and recovery
Finalize the partial stream with correct metadata, mark it truncated, and avoid reporting a complete capture or transcode. Retry only when full output is required.
Retry it only when a documented input or state has changed. An unchanged retry after it is useful only when the API explicitly advances through repeated calls.
Difference from nearby results
It must be distinguished from ordinary S_OK and from failure-severity values in the same API family; its documented state changes control the next action.
Correctly separating it from neighboring values selects the proper continuation and cleanup path.
Practical scenario
A live recording is stopped by the user before its planned duration. The writer closes the container cleanly and labels the asset as intentionally truncated.
A regression test should reproduce it, assert the relevant outputs and state, then change only the decisive condition and verify the expected neighboring result or ordinary completion.
References
- Microsoft: Windows Media Format SDK error codes — official Microsoft material used to interpret it.
- Microsoft: Windows Media Player SDK
- Microsoft: Windows Media Player buffering event
- Microsoft: HRESULT values
Looking for a different code? Search another status or error code.
