{"action":"created","issue":{"url":"https://api.github.com/repos/mmaitre314/MediaReader/issues/7","repository_url":"https://api.github.com/repos/mmaitre314/MediaReader","labels_url":"https://api.github.com/repos/mmaitre314/MediaReader/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/mmaitre314/MediaReader/issues/7/comments","events_url":"https://api.github.com/repos/mmaitre314/MediaReader/issues/7/events","html_url":"https://github.com/mmaitre314/MediaReader/issues/7","id":116669624,"number":7,"title":"Await utility in unit testing not usable for the store","user":{"login":"bilal-sou","id":10742657,"avatar_url":"https://avatars.githubusercontent.com/u/10742657?v=3","gravatar_id":"","url":"https://api.github.com/users/bilal-sou","html_url":"https://github.com/bilal-sou","followers_url":"https://api.github.com/users/bilal-sou/followers","following_url":"https://api.github.com/users/bilal-sou/following{/other_user}","gists_url":"https://api.github.com/users/bilal-sou/gists{/gist_id}","starred_url":"https://api.github.com/users/bilal-sou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bilal-sou/subscriptions","organizations_url":"https://api.github.com/users/bilal-sou/orgs","repos_url":"https://api.github.com/users/bilal-sou/repos","events_url":"https://api.github.com/users/bilal-sou/events{/privacy}","received_events_url":"https://api.github.com/users/bilal-sou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-11-12T23:57:00Z","updated_at":"2016-03-16T16:09:37Z","closed_at":null,"body":"Hi there, \r\nFirst thing amazing job you've done with this library. Been playing around with it and taught me so many things regarding WRL/WinRT and the whole video pipeline.In your unit testing, you're using a custom Await method which does exactly what is so hard to do on WinRT and C++/CX which is awaiting on the UI thread. \r\nThe app I'm working on is pure C++ and C++/CX and I tried to use this Await outside of the unit testing environment and it works really well. Unfortunately it seems that the cowaitformultiplehandles is completely forbidden to use for an app released on the store as it doesn't get past the certification. I know why they did it, because cowaitformultiplehandles and its messages pumping can be quite dangerous as it allows reentrancy. Nevertheless it's a shame we can't use some stuff like PeekMessage and some other nice COM/Win32 functions. \r\n\r\nAnyway I've modified the way I was doing things like that \r\n\r\n\t\t\tMediaReaderReadResult^ readResult = nullptr;\r\n\r\n\t\t\tstd::shared_ptr<Concurrency::event> completed = std::make_shared<Concurrency::event>();\r\n\r\n\t\t\tauto workItem = ref new Windows::System::Threading::WorkItemHandler(\r\n\t\t\t\t[completed, &readResult, this](Windows::Foundation::IAsyncAction^ workItem)\r\n\t\t\t{\r\n\t\t\t\tConcurrency::task<MediaReaderReadResult^> getReaderTask(m_reader->VideoStream->ReadAsync());\r\n\r\n\t\t\t\tgetReaderTask.then([completed, &readResult, this](MediaReaderReadResult^ result)\r\n\t\t\t\t{\r\n\t\t\t\t\treadResult = result;\r\n\r\n\t\t\t\t\tcompleted->set();\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\r\n\t\t\tauto asyncAction = Windows::System::Threading::ThreadPool::RunAsync(workItem);\r\n\r\n\t\t\tcompleted->wait();\r\n\r\nand it works well, but unfortunately when I use the same method on let's say InitializeAsync or ClearEffectsAsync it won't work as both needs to be dispatched on the UI thread. \r\n\r\nDo you know of anything that could be similar to that and would allow waiting for some async call on a UI thread ?\r\n\r\nThanks a lot and keep up the good work !\r\nB."},"comment":{"url":"https://api.github.com/repos/mmaitre314/MediaReader/issues/comments/197401796","html_url":"https://github.com/mmaitre314/MediaReader/issues/7#issuecomment-197401796","issue_url":"https://api.github.com/repos/mmaitre314/MediaReader/issues/7","id":197401796,"user":{"login":"mmaitre314","id":8584604,"avatar_url":"https://avatars.githubusercontent.com/u/8584604?v=3","gravatar_id":"","url":"https://api.github.com/users/mmaitre314","html_url":"https://github.com/mmaitre314","followers_url":"https://api.github.com/users/mmaitre314/followers","following_url":"https://api.github.com/users/mmaitre314/following{/other_user}","gists_url":"https://api.github.com/users/mmaitre314/gists{/gist_id}","starred_url":"https://api.github.com/users/mmaitre314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmaitre314/subscriptions","organizations_url":"https://api.github.com/users/mmaitre314/orgs","repos_url":"https://api.github.com/users/mmaitre314/repos","events_url":"https://api.github.com/users/mmaitre314/events{/privacy}","received_events_url":"https://api.github.com/users/mmaitre314/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T16:09:37Z","updated_at":"2016-03-16T16:09:37Z","body":"I found some code sample here (toward the bottom of the file): https://github.com/mmaitre314/MediaCaptureWPF/blob/5e46dbc0700e06425363fd0db2bbd01fc59ae34e/MediaCaptureWPF.Native/CapturePreviewNative.cpp\r\nIt uses DX texture sharing to go from a DX11 device (MediaCapture) to a DX9 device (WPF).\r\n\r\nI did not fully read your code but it looks like 'texture' is on the camera DX device and CopySubresourceRegion() is called on the renderer DX device, while CopySubresourceRegion() should be called with two textures on the same DX device.\r\n"}}