File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
audiostream/src/ni/media/audio/os/win Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ template <class Source>
65
65
class SyncronousByteStream : public IMFByteStream
66
66
{
67
67
68
+ static constexpr auto endOfSequence = -1 ;
69
+
68
70
auto tell () -> std::streamsize
69
71
{
70
72
auto pos = m_source.seek ( boost::iostreams::stream_offset ( 0 ), BOOST_IOS::cur );
@@ -87,7 +89,11 @@ class SyncronousByteStream : public IMFByteStream
87
89
try
88
90
{
89
91
const auto result = m_source.read ( reinterpret_cast <char *>( buffer ), toRead );
90
- *read = static_cast <ULONG>( result == -1 ? 0 : result );
92
+ if (result < endOfSequence)
93
+ {
94
+ return E_FAIL;
95
+ }
96
+ *read = static_cast <ULONG>( result == endOfSequence ? 0 : result );
91
97
return S_OK;
92
98
}
93
99
catch ( const std::system_error& )
You can’t perform that action at this time.
0 commit comments