http_streamer: Implement IsRunning, more reliability
* The init sem is released also when the request is completed to be sure the backend doesn't lock on us. * Implement IsRunning relying on BUrlRequest::IsRunning.
This commit is contained in:
@@ -45,11 +45,7 @@ public:
|
||||
void DataReceived(BUrlRequest* request, const char* data,
|
||||
off_t position, ssize_t size)
|
||||
{
|
||||
if (fInitSem != -1) {
|
||||
release_sem(fInitSem);
|
||||
delete_sem(fInitSem);
|
||||
fInitSem = -1;
|
||||
}
|
||||
_ReleaseInit();
|
||||
|
||||
if (request != fRequest)
|
||||
delete request;
|
||||
@@ -59,6 +55,8 @@ public:
|
||||
|
||||
void RequestCompleted(BUrlRequest* request, bool success)
|
||||
{
|
||||
_ReleaseInit();
|
||||
|
||||
if (request != fRequest)
|
||||
return;
|
||||
|
||||
@@ -72,6 +70,15 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void _ReleaseInit()
|
||||
{
|
||||
if (fInitSem != -1) {
|
||||
release_sem(fInitSem);
|
||||
delete_sem(fInitSem);
|
||||
fInitSem = -1;
|
||||
}
|
||||
}
|
||||
|
||||
BUrlRequest* fRequest;
|
||||
BAdapterIO* fAdapterIO;
|
||||
BInputAdapter* fInputAdapter;
|
||||
@@ -166,6 +173,13 @@ HTTPMediaIO::Close()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
HTTPMediaIO::IsRunning() const
|
||||
{
|
||||
return fReq != NULL && fReq->IsRunning();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
HTTPMediaIO::SeekRequested(off_t position)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
virtual status_t Open();
|
||||
virtual void Close();
|
||||
|
||||
virtual bool IsRunning() const;
|
||||
|
||||
protected:
|
||||
virtual status_t SeekRequested(off_t position);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user