Called when a new sample is available from the source reader.
(
&self,
hrstatus: windows_core::HRESULT,
_dwstreamindex: u32,
_dwstreamflags: u32,
lltimestamp: i64,
psample: windows_core::Ref<'_, IMFSample>,
)
| 105 | impl IMFSourceReaderCallback_Impl for MsmfCallback_Impl { |
| 106 | /// Called when a new sample is available from the source reader. |
| 107 | fn OnReadSample( |
| 108 | &self, |
| 109 | hrstatus: windows_core::HRESULT, |
| 110 | _dwstreamindex: u32, |
| 111 | _dwstreamflags: u32, |
| 112 | lltimestamp: i64, |
| 113 | psample: windows_core::Ref<'_, IMFSample>, |
| 114 | ) -> windows_core::Result<()> { |
| 115 | if !self.shared.is_running.load(Ordering::Acquire) || hrstatus.is_err() { |
| 116 | return Ok(()); |
| 117 | } |
| 118 | |
| 119 | if let Some(psample) = psample.as_ref() { |
| 120 | let mut slot = self.shared.sample_slot.lock().unwrap(); |
| 121 | let was_empty = slot.is_none(); |
| 122 | *slot = Some(SendableSample(psample.clone())); |
| 123 | drop(slot); |
| 124 | |
| 125 | if was_empty { |
| 126 | self.shared.frame_ready.add_permits(1); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | self.shared.timestamp.store(lltimestamp, Ordering::Release); |
| 131 | |
| 132 | if let Some(reader) = self.shared.reader.read().unwrap().upgrade() { |
| 133 | unsafe { |
| 134 | let _ = reader.0.ReadSample( |
| 135 | MF_SOURCE_READER_FIRST_VIDEO_STREAM.0 as u32, |
| 136 | 0, |
| 137 | None, |
| 138 | None, |
| 139 | None, |
| 140 | None, |
| 141 | ); |
| 142 | } |
| 143 | } |
| 144 | Ok(()) |
| 145 | } |
| 146 | |
| 147 | fn OnFlush(&self, _: u32) -> windows_core::Result<()> { |
| 148 | Ok(()) |
nothing calls this directly
no test coverage detected