Bug 1343437 - MediaDataDemuxer::InitPromise resolve-value is now a MediaResult - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Tue, 28 Feb 2017 16:24:57 +1100
changeset 493014 7e4519a64ca3782bcb85de85c04304af1cfc610d
parent 492625 b23d6277acca34a4b1be9a4c24efd3b999e47ec3
child 493015 1e04bc4863d1fe5e7d4d5e83ba6ce0e58d135e13
push id47625
push usergsquelart@mozilla.com
push dateFri, 03 Mar 2017 05:16:08 +0000
reviewersjya
bugs1343437
milestone54.0a1
Bug 1343437 - MediaDataDemuxer::InitPromise resolve-value is now a MediaResult - r?jya In case of successful initialization, there could still be some warning about a recoverable error. To carry more information about this potential warning, the resolve-value type of the promise is changed from nsresult to MediaResult. Existing code doesn't need to be changed: - In Resolve() calls, the stored MediaResult can implicitly be constructed from an nsresult -- always NS_OK at the moment anyway. - In following Then(), the promise's MediaResult can implicitly be converted to an nsresult. Future patches will modify some of the Resolve's and Then's, to forward warning details to some Decoder Doctor object... MozReview-Commit-ID: J0bXDFxXQHQ
dom/media/MediaDataDemuxer.h
--- a/dom/media/MediaDataDemuxer.h
+++ b/dom/media/MediaDataDemuxer.h
@@ -27,17 +27,18 @@ class TrackMetadataHolder;
 // MediaDataDemuxer isn't designed to be thread safe.
 // When used by the MediaFormatDecoder, care is taken to ensure that the demuxer
 // will never be called from more than one thread at once.
 class MediaDataDemuxer
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDemuxer)
 
-  typedef MozPromise<nsresult, MediaResult, /* IsExclusive = */ true> InitPromise;
+  typedef
+    MozPromise<MediaResult, MediaResult, /* IsExclusive = */ true> InitPromise;
 
   // Initializes the demuxer. Other methods cannot be called unless
   // initialization has completed and succeeded.
   // Typically a demuxer will wait to parse the metadata before resolving the
   // promise. The promise must not be resolved until sufficient data is
   // supplied. For example, an incomplete metadata would cause the promise to be
   // rejected should no more data be coming, while the demuxer would wait
   // otherwise.